-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
264 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ruby_version: 2.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
appraise "faraday-1" do | ||
gem "faraday", "~> 1.10" | ||
gem "base64", "~> 0.2.0" | ||
end | ||
|
||
appraise "faraday-2" do | ||
gem "faraday", "~> 2.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ gemspec | |
gem "rake" | ||
gem "minitest", ">= 5.0.5" | ||
gem "standard" | ||
gem "appraisal" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
||
gem "rake" | ||
gem "minitest", ">= 5.0.5" | ||
gem "standard" | ||
gem "appraisal" | ||
gem "faraday", "~> 1.10" | ||
gem "base64", "~> 0.2.0" | ||
|
||
gemspec path: "../" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
PATH | ||
remote: .. | ||
specs: | ||
vultr (1.0.0) | ||
faraday (>= 1.0, < 3.0) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
appraisal (2.5.0) | ||
bundler | ||
rake | ||
thor (>= 0.14.0) | ||
ast (2.4.2) | ||
base64 (0.2.0) | ||
faraday (1.10.3) | ||
faraday-em_http (~> 1.0) | ||
faraday-em_synchrony (~> 1.0) | ||
faraday-excon (~> 1.1) | ||
faraday-httpclient (~> 1.0) | ||
faraday-multipart (~> 1.0) | ||
faraday-net_http (~> 1.0) | ||
faraday-net_http_persistent (~> 1.0) | ||
faraday-patron (~> 1.0) | ||
faraday-rack (~> 1.0) | ||
faraday-retry (~> 1.0) | ||
ruby2_keywords (>= 0.0.4) | ||
faraday-em_http (1.0.0) | ||
faraday-em_synchrony (1.0.0) | ||
faraday-excon (1.1.0) | ||
faraday-httpclient (1.0.1) | ||
faraday-multipart (1.0.4) | ||
multipart-post (~> 2) | ||
faraday-net_http (1.0.1) | ||
faraday-net_http_persistent (1.2.0) | ||
faraday-patron (1.0.0) | ||
faraday-rack (1.0.0) | ||
faraday-retry (1.0.3) | ||
json (2.7.2) | ||
language_server-protocol (3.17.0.3) | ||
lint_roller (1.1.0) | ||
minitest (5.23.1) | ||
multipart-post (2.4.1) | ||
parallel (1.24.0) | ||
parser (3.3.2.0) | ||
ast (~> 2.4.1) | ||
racc | ||
racc (1.8.0) | ||
rainbow (3.1.1) | ||
rake (13.2.1) | ||
regexp_parser (2.9.2) | ||
rexml (3.2.8) | ||
strscan (>= 3.0.9) | ||
rubocop (1.63.5) | ||
json (~> 2.3) | ||
language_server-protocol (>= 3.17.0) | ||
parallel (~> 1.10) | ||
parser (>= 3.3.0.2) | ||
rainbow (>= 2.2.2, < 4.0) | ||
regexp_parser (>= 1.8, < 3.0) | ||
rexml (>= 3.2.5, < 4.0) | ||
rubocop-ast (>= 1.31.1, < 2.0) | ||
ruby-progressbar (~> 1.7) | ||
unicode-display_width (>= 2.4.0, < 3.0) | ||
rubocop-ast (1.31.3) | ||
parser (>= 3.3.1.0) | ||
rubocop-performance (1.21.0) | ||
rubocop (>= 1.48.1, < 2.0) | ||
rubocop-ast (>= 1.31.1, < 2.0) | ||
ruby-progressbar (1.13.0) | ||
ruby2_keywords (0.0.5) | ||
standard (1.36.0) | ||
language_server-protocol (~> 3.17.0.2) | ||
lint_roller (~> 1.0) | ||
rubocop (~> 1.63.0) | ||
standard-custom (~> 1.0.0) | ||
standard-performance (~> 1.4) | ||
standard-custom (1.0.2) | ||
lint_roller (~> 1.0) | ||
rubocop (~> 1.50) | ||
standard-performance (1.4.0) | ||
lint_roller (~> 1.1) | ||
rubocop-performance (~> 1.21.0) | ||
strscan (3.1.0) | ||
thor (1.3.1) | ||
unicode-display_width (2.5.0) | ||
|
||
PLATFORMS | ||
ruby | ||
x86_64-darwin-23 | ||
|
||
DEPENDENCIES | ||
appraisal | ||
base64 (~> 0.2.0) | ||
faraday (~> 1.10) | ||
minitest (>= 5.0.5) | ||
rake | ||
standard | ||
vultr! | ||
|
||
BUNDLED WITH | ||
2.5.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
||
gem "rake" | ||
gem "minitest", ">= 5.0.5" | ||
gem "standard" | ||
gem "appraisal" | ||
gem "faraday", "~> 2.0" | ||
|
||
gemspec path: "../" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
PATH | ||
remote: .. | ||
specs: | ||
vultr (1.0.0) | ||
faraday (>= 1.0, < 3.0) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
appraisal (2.5.0) | ||
bundler | ||
rake | ||
thor (>= 0.14.0) | ||
ast (2.4.2) | ||
faraday (2.9.0) | ||
faraday-net_http (>= 2.0, < 3.2) | ||
faraday-net_http (3.1.0) | ||
net-http | ||
json (2.7.2) | ||
language_server-protocol (3.17.0.3) | ||
lint_roller (1.1.0) | ||
minitest (5.23.1) | ||
net-http (0.4.1) | ||
uri | ||
parallel (1.24.0) | ||
parser (3.3.2.0) | ||
ast (~> 2.4.1) | ||
racc | ||
racc (1.8.0) | ||
rainbow (3.1.1) | ||
rake (13.2.1) | ||
regexp_parser (2.9.2) | ||
rexml (3.2.8) | ||
strscan (>= 3.0.9) | ||
rubocop (1.63.5) | ||
json (~> 2.3) | ||
language_server-protocol (>= 3.17.0) | ||
parallel (~> 1.10) | ||
parser (>= 3.3.0.2) | ||
rainbow (>= 2.2.2, < 4.0) | ||
regexp_parser (>= 1.8, < 3.0) | ||
rexml (>= 3.2.5, < 4.0) | ||
rubocop-ast (>= 1.31.1, < 2.0) | ||
ruby-progressbar (~> 1.7) | ||
unicode-display_width (>= 2.4.0, < 3.0) | ||
rubocop-ast (1.31.3) | ||
parser (>= 3.3.1.0) | ||
rubocop-performance (1.21.0) | ||
rubocop (>= 1.48.1, < 2.0) | ||
rubocop-ast (>= 1.31.1, < 2.0) | ||
ruby-progressbar (1.13.0) | ||
standard (1.36.0) | ||
language_server-protocol (~> 3.17.0.2) | ||
lint_roller (~> 1.0) | ||
rubocop (~> 1.63.0) | ||
standard-custom (~> 1.0.0) | ||
standard-performance (~> 1.4) | ||
standard-custom (1.0.2) | ||
lint_roller (~> 1.0) | ||
rubocop (~> 1.50) | ||
standard-performance (1.4.0) | ||
lint_roller (~> 1.1) | ||
rubocop-performance (~> 1.21.0) | ||
strscan (3.1.0) | ||
thor (1.3.1) | ||
unicode-display_width (2.5.0) | ||
uri (0.13.0) | ||
|
||
PLATFORMS | ||
ruby | ||
x86_64-darwin-23 | ||
|
||
DEPENDENCIES | ||
appraisal | ||
faraday (~> 2.0) | ||
minitest (>= 5.0.5) | ||
rake | ||
standard | ||
vultr! | ||
|
||
BUNDLED WITH | ||
2.5.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require "time" | ||
|
||
module Vultr | ||
class Middleware < Faraday::Middleware | ||
ISO_DATE_FORMAT = /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|((\+|-)\d{2}:?\d{2}))\Z/xm | ||
|
||
# This method will be called when the response is being processed. | ||
# You can alter it as you like, accessing things like response_body, response_headers, and more. | ||
# Refer to Faraday::Env for a list of accessible fields: | ||
# https://github.com/lostisland/faraday/blob/main/lib/faraday/options/env.rb | ||
# | ||
# @param env [Faraday::Env] the environment of the response being processed. | ||
def on_complete(env) | ||
parse_dates! env[:body] | ||
end | ||
|
||
private | ||
|
||
def parse_dates!(value) | ||
case value | ||
when Hash | ||
value.each { |key, element| value[key] = parse_dates!(element) } | ||
when Array | ||
value.each_with_index { |element, index| value[index] = parse_dates!(element) } | ||
when ISO_DATE_FORMAT | ||
Time.parse(value) | ||
else | ||
value | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,20 +7,18 @@ require "vultr/version" | |
Gem::Specification.new do |s| | ||
s.name = "vultr" | ||
s.version = Vultr::VERSION | ||
s.authors = ["Gao Jiangmiao"] | ||
s.email = ["[email protected]"] | ||
s.authors = ["Gao Jiangmiao", "Chris Oliver"] | ||
s.email = ["[email protected]", "[email protected]"] | ||
s.summary = "Ruby bindings for VULTR API." | ||
s.description = "Ruby bindings for VULTR API. VULTR APIs can be found here: https://www.vultr.com/api/" | ||
s.homepage = "https://github.com/tolbkni/vultr.rb" | ||
s.license = "MIT" | ||
|
||
s.files = `git ls-files -z`.split("\x0") | ||
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) } | ||
s.test_files = s.files.grep(%r{^(test|spec|features)/}) | ||
s.require_paths = ["lib"] | ||
|
||
s.required_ruby_version = ">= 2.4" | ||
|
||
s.add_dependency "faraday", "~> 1.7" | ||
s.add_dependency "faraday_middleware", "~> 1.1" | ||
s.add_dependency "faraday", ">= 1.0", "< 3.0" | ||
end |