vantage-client 0.0.1.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +111 -0
  4. data/Rakefile +8 -0
  5. data/docs/PingApi.md +53 -0
  6. data/docs/Price.md +14 -0
  7. data/docs/Prices.md +9 -0
  8. data/docs/PricesApi.md +323 -0
  9. data/docs/Product.md +12 -0
  10. data/docs/Products.md +9 -0
  11. data/docs/Provider.md +10 -0
  12. data/docs/Providers.md +9 -0
  13. data/docs/Service.md +11 -0
  14. data/docs/Services.md +9 -0
  15. data/git_push.sh +55 -0
  16. data/lib/vantage-client/api/ping_api.rb +66 -0
  17. data/lib/vantage-client/api/prices_api.rb +323 -0
  18. data/lib/vantage-client/api_client.rb +391 -0
  19. data/lib/vantage-client/api_error.rb +38 -0
  20. data/lib/vantage-client/configuration.rb +209 -0
  21. data/lib/vantage-client/models/price.rb +245 -0
  22. data/lib/vantage-client/models/prices.rb +196 -0
  23. data/lib/vantage-client/models/product.rb +225 -0
  24. data/lib/vantage-client/models/products.rb +196 -0
  25. data/lib/vantage-client/models/provider.rb +204 -0
  26. data/lib/vantage-client/models/providers.rb +196 -0
  27. data/lib/vantage-client/models/service.rb +214 -0
  28. data/lib/vantage-client/models/services.rb +196 -0
  29. data/lib/vantage-client/version.rb +15 -0
  30. data/lib/vantage-client.rb +49 -0
  31. data/spec/api/ping_api_spec.rb +45 -0
  32. data/spec/api/prices_api_spec.rb +103 -0
  33. data/spec/api_client_spec.rb +243 -0
  34. data/spec/configuration_spec.rb +42 -0
  35. data/spec/models/price_spec.rb +77 -0
  36. data/spec/models/prices_spec.rb +47 -0
  37. data/spec/models/product_spec.rb +65 -0
  38. data/spec/models/products_spec.rb +47 -0
  39. data/spec/models/provider_spec.rb +53 -0
  40. data/spec/models/providers_spec.rb +47 -0
  41. data/spec/models/service_spec.rb +59 -0
  42. data/spec/models/services_spec.rb +47 -0
  43. data/spec/spec_helper.rb +111 -0
  44. data/vantage-client-0.0.1.pre.gem +0 -0
  45. data/vantage-client.gemspec +46 -0
  46. metadata +300 -0
@@ -0,0 +1,214 @@
1
+ =begin
2
+ #Vantage
3
+
4
+ #Vantage API
5
+
6
+ OpenAPI spec version: 1.0.0
7
+ Contact: support@vantage.sh
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.19
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Vantage
16
+ class Service
17
+ attr_accessor :id
18
+
19
+ # The type of cloud service.
20
+ attr_accessor :category
21
+
22
+ # The common name of the service. Usually an abbreviation.
23
+ attr_accessor :name
24
+
25
+ # The full name of the service.
26
+ attr_accessor :description
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'id' => :'id',
32
+ :'category' => :'category',
33
+ :'name' => :'name',
34
+ :'description' => :'description'
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.swagger_types
40
+ {
41
+ :'id' => :'String',
42
+ :'category' => :'String',
43
+ :'name' => :'String',
44
+ :'description' => :'String'
45
+ }
46
+ end
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ def initialize(attributes = {})
51
+ return unless attributes.is_a?(Hash)
52
+
53
+ # convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
55
+
56
+ if attributes.has_key?(:'id')
57
+ self.id = attributes[:'id']
58
+ end
59
+
60
+ if attributes.has_key?(:'category')
61
+ self.category = attributes[:'category']
62
+ end
63
+
64
+ if attributes.has_key?(:'name')
65
+ self.name = attributes[:'name']
66
+ end
67
+
68
+ if attributes.has_key?(:'description')
69
+ self.description = attributes[:'description']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ id == o.id &&
92
+ category == o.category &&
93
+ name == o.name &&
94
+ description == o.description
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Fixnum] Hash code
105
+ def hash
106
+ [id, category, name, description].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ self.class.swagger_types.each_pair do |key, type|
115
+ if type =~ /\AArray<(.*)>/i
116
+ # check to ensure the input is an array given that the attribute
117
+ # is documented as an array but the input is not
118
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
119
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
120
+ end
121
+ elsif !attributes[self.class.attribute_map[key]].nil?
122
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
123
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def _deserialize(type, value)
134
+ case type.to_sym
135
+ when :DateTime
136
+ DateTime.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :BOOLEAN
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ temp_model = Vantage.const_get(type).new
167
+ temp_model.build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ next if value.nil?
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map { |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end
212
+
213
+ end
214
+ end
@@ -0,0 +1,196 @@
1
+ =begin
2
+ #Vantage
3
+
4
+ #Vantage API
5
+
6
+ OpenAPI spec version: 1.0.0
7
+ Contact: support@vantage.sh
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.19
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Vantage
16
+ # Services model
17
+ class Services
18
+ attr_accessor :links
19
+
20
+ attr_accessor :services
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'links' => :'links',
26
+ :'services' => :'services'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.swagger_types
32
+ {
33
+ :'links' => :'Object',
34
+ :'services' => :'Array<Service>'
35
+ }
36
+ end
37
+
38
+ # Initializes the object
39
+ # @param [Hash] attributes Model attributes in the form of hash
40
+ def initialize(attributes = {})
41
+ return unless attributes.is_a?(Hash)
42
+
43
+ # convert string to symbol for hash key
44
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
45
+
46
+ if attributes.has_key?(:'links')
47
+ self.links = attributes[:'links']
48
+ end
49
+
50
+ if attributes.has_key?(:'services')
51
+ if (value = attributes[:'services']).is_a?(Array)
52
+ self.services = value
53
+ end
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ invalid_properties
62
+ end
63
+
64
+ # Check to see if the all the properties in the model are valid
65
+ # @return true if the model is valid
66
+ def valid?
67
+ true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ links == o.links &&
76
+ services == o.services
77
+ end
78
+
79
+ # @see the `==` method
80
+ # @param [Object] Object to be compared
81
+ def eql?(o)
82
+ self == o
83
+ end
84
+
85
+ # Calculates hash code according to all attributes.
86
+ # @return [Fixnum] Hash code
87
+ def hash
88
+ [links, services].hash
89
+ end
90
+
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def build_from_hash(attributes)
95
+ return nil unless attributes.is_a?(Hash)
96
+ self.class.swagger_types.each_pair do |key, type|
97
+ if type =~ /\AArray<(.*)>/i
98
+ # check to ensure the input is an array given that the attribute
99
+ # is documented as an array but the input is not
100
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
101
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
102
+ end
103
+ elsif !attributes[self.class.attribute_map[key]].nil?
104
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
105
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
106
+ end
107
+
108
+ self
109
+ end
110
+
111
+ # Deserializes the data based on type
112
+ # @param string type Data type
113
+ # @param string value Value to be deserialized
114
+ # @return [Object] Deserialized data
115
+ def _deserialize(type, value)
116
+ case type.to_sym
117
+ when :DateTime
118
+ DateTime.parse(value)
119
+ when :Date
120
+ Date.parse(value)
121
+ when :String
122
+ value.to_s
123
+ when :Integer
124
+ value.to_i
125
+ when :Float
126
+ value.to_f
127
+ when :BOOLEAN
128
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
+ true
130
+ else
131
+ false
132
+ end
133
+ when :Object
134
+ # generic object (usually a Hash), return directly
135
+ value
136
+ when /\AArray<(?<inner_type>.+)>\z/
137
+ inner_type = Regexp.last_match[:inner_type]
138
+ value.map { |v| _deserialize(inner_type, v) }
139
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
140
+ k_type = Regexp.last_match[:k_type]
141
+ v_type = Regexp.last_match[:v_type]
142
+ {}.tap do |hash|
143
+ value.each do |k, v|
144
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
+ end
146
+ end
147
+ else # model
148
+ temp_model = Vantage.const_get(type).new
149
+ temp_model.build_from_hash(value)
150
+ end
151
+ end
152
+
153
+ # Returns the string representation of the object
154
+ # @return [String] String presentation of the object
155
+ def to_s
156
+ to_hash.to_s
157
+ end
158
+
159
+ # to_body is an alias to to_hash (backward compatibility)
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_body
162
+ to_hash
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ next if value.nil?
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map { |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+
195
+ end
196
+ end
@@ -0,0 +1,15 @@
1
+ =begin
2
+ #Vantage
3
+
4
+ #Vantage API
5
+
6
+ OpenAPI spec version: 1.0.0
7
+ Contact: support@vantage.sh
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.19
10
+
11
+ =end
12
+
13
+ module Vantage
14
+ VERSION = '0.0.1.beta.1'
15
+ end
@@ -0,0 +1,49 @@
1
+ =begin
2
+ #Vantage
3
+
4
+ #Vantage API
5
+
6
+ OpenAPI spec version: 1.0.0
7
+ Contact: support@vantage.sh
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.19
10
+
11
+ =end
12
+
13
+ # Common files
14
+ require 'vantage-client/api_client'
15
+ require 'vantage-client/api_error'
16
+ require 'vantage-client/version'
17
+ require 'vantage-client/configuration'
18
+
19
+ # Models
20
+ require 'vantage-client/models/price'
21
+ require 'vantage-client/models/prices'
22
+ require 'vantage-client/models/product'
23
+ require 'vantage-client/models/products'
24
+ require 'vantage-client/models/provider'
25
+ require 'vantage-client/models/providers'
26
+ require 'vantage-client/models/service'
27
+ require 'vantage-client/models/services'
28
+
29
+ # APIs
30
+ require 'vantage-client/api/ping_api'
31
+ require 'vantage-client/api/prices_api'
32
+
33
+ module Vantage
34
+ class << self
35
+ # Customize default settings for the SDK using block.
36
+ # Vantage.configure do |config|
37
+ # config.username = "xxx"
38
+ # config.password = "xxx"
39
+ # end
40
+ # If no block given, return the default Configuration object.
41
+ def configure
42
+ if block_given?
43
+ yield(Configuration.default)
44
+ else
45
+ Configuration.default
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,45 @@
1
+ =begin
2
+ #Vantage
3
+
4
+ #Vantage API
5
+
6
+ OpenAPI spec version: 1.0.0
7
+ Contact: support@vantage.sh
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.19
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for Vantage::PingApi
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'PingApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = Vantage::PingApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of PingApi' do
30
+ it 'should create an instance of PingApi' do
31
+ expect(@instance).to be_instance_of(Vantage::PingApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for ping
36
+ # This is a health check endpoint that can be used to determine Vantage API healthiness. It will return a 200 success with the raw text of \&quot;pong\&quot; if everything is running smoothly.
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [nil]
39
+ describe 'ping test' do
40
+ it 'should work' do
41
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
42
+ end
43
+ end
44
+
45
+ end
@@ -0,0 +1,103 @@
1
+ =begin
2
+ #Vantage
3
+
4
+ #Vantage API
5
+
6
+ OpenAPI spec version: 1.0.0
7
+ Contact: support@vantage.sh
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.19
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for Vantage::PricesApi
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'PricesApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = Vantage::PricesApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of PricesApi' do
30
+ it 'should create an instance of PricesApi' do
31
+ expect(@instance).to be_instance_of(Vantage::PricesApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for get_price
36
+ # Returns a price
37
+ # @param product_id
38
+ # @param id Unique identifier of the price e.g. aws-ec2-m5d_16xlarge-eu_central_1-on_demand-linux_enterprise
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [Price]
41
+ describe 'get_price test' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ # unit tests for get_prices
48
+ # Return available Prices across all Regions for a Product.
49
+ # @param product_id The Product ID that you wish to query prices for.
50
+ # @param [Hash] opts the optional parameters
51
+ # @return [Prices]
52
+ describe 'get_prices test' do
53
+ it 'should work' do
54
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
55
+ end
56
+ end
57
+
58
+ # unit tests for get_product
59
+ # Return a product
60
+ # @param id Unique identifier of the product e.g. aws-ec2-m5d_16xlarge
61
+ # @param [Hash] opts the optional parameters
62
+ # @return [Product]
63
+ describe 'get_product test' do
64
+ it 'should work' do
65
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
66
+ end
67
+ end
68
+
69
+ # unit tests for get_products
70
+ # Return available Products for a Service. For example, with a Provider of AWS and a Service of EC2, Products will be a list of all EC2 Instances. By default, this endpoint returns all Products across all Services and Providers but has optional query parameters for filtering listed below.
71
+ # @param [Hash] opts the optional parameters
72
+ # @option opts [String] :provider_id Query by Provider to list all Products across all Services for a Provider. e.g. aws
73
+ # @option opts [String] :service_id Query by Service to list all Products for a specific provider service. e.g. aws-ec2
74
+ # @option opts [String] :name Query by name of the Product to see a list of products which match that name. e.g. m5a.16xlarge
75
+ # @return [Products]
76
+ describe 'get_products test' do
77
+ it 'should work' do
78
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
79
+ end
80
+ end
81
+
82
+ # unit tests for get_providers
83
+ # Providers are cloud infrastructure and service providers from which all cloud prices are derived. You can think of example Providers as being AWS, GCP, Cloudflare or Datadog. Currently, Vantage only supports a single provider of AWS but over time more will be added. Use this endpoint to retrieve a provider id for other API calls.
84
+ # @param [Hash] opts the optional parameters
85
+ # @return [Providers]
86
+ describe 'get_providers test' do
87
+ it 'should work' do
88
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
89
+ end
90
+ end
91
+
92
+ # unit tests for get_services
93
+ # Return all Services. Examples of Services are EC2 for AWS. This endpoint will return all Services by default but you have the ability to filter Services by Provider using the optional query parameter documented below.
94
+ # @param [Hash] opts the optional parameters
95
+ # @option opts [String] :provider_id Query services for a specific provider. e.g. aws
96
+ # @return [Services]
97
+ describe 'get_services test' do
98
+ it 'should work' do
99
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
100
+ end
101
+ end
102
+
103
+ end