coinmarketcap_client 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +121 -0
  4. data/Rakefile +8 -0
  5. data/coinmarketcap_api.gemspec +45 -0
  6. data/coinmarketcap_client.gemspec +45 -0
  7. data/docs/DefaultApi.md +262 -0
  8. data/docs/Info.md +18 -0
  9. data/docs/InfoUrls.md +15 -0
  10. data/docs/InlineResponse200.md +9 -0
  11. data/docs/InlineResponse2001.md +9 -0
  12. data/docs/InlineResponse2002.md +9 -0
  13. data/docs/InlineResponse2003.md +9 -0
  14. data/docs/InlineResponse2004.md +9 -0
  15. data/docs/InlineResponse2005.md +9 -0
  16. data/docs/InlineResponseDefault.md +8 -0
  17. data/docs/InlineResponseDefault1.md +8 -0
  18. data/docs/Map.md +15 -0
  19. data/docs/MarketData.md +21 -0
  20. data/docs/Platform.md +12 -0
  21. data/docs/Quote.md +14 -0
  22. data/docs/Status.md +12 -0
  23. data/git_push.sh +55 -0
  24. data/lib/coinmarketcap_api.rb +50 -0
  25. data/lib/coinmarketcap_api/api/default_api.rb +145 -0
  26. data/lib/coinmarketcap_api/api_client.rb +389 -0
  27. data/lib/coinmarketcap_api/api_error.rb +38 -0
  28. data/lib/coinmarketcap_api/configuration.rb +209 -0
  29. data/lib/coinmarketcap_api/models/info.rb +276 -0
  30. data/lib/coinmarketcap_api/models/info_urls.rb +263 -0
  31. data/lib/coinmarketcap_api/models/inline_response_200.rb +194 -0
  32. data/lib/coinmarketcap_api/models/inline_response_200_1.rb +185 -0
  33. data/lib/coinmarketcap_api/models/inline_response_200_2.rb +194 -0
  34. data/lib/coinmarketcap_api/models/inline_response_200_3.rb +185 -0
  35. data/lib/coinmarketcap_api/models/inline_response_default.rb +183 -0
  36. data/lib/coinmarketcap_api/models/inline_response_default_1.rb +183 -0
  37. data/lib/coinmarketcap_api/models/map.rb +246 -0
  38. data/lib/coinmarketcap_api/models/status.rb +219 -0
  39. data/lib/coinmarketcap_api/version.rb +15 -0
  40. data/lib/coinmarketcap_client.rb +55 -0
  41. data/lib/coinmarketcap_client/api/default_api.rb +300 -0
  42. data/lib/coinmarketcap_client/api_client.rb +389 -0
  43. data/lib/coinmarketcap_client/api_error.rb +38 -0
  44. data/lib/coinmarketcap_client/configuration.rb +209 -0
  45. data/lib/coinmarketcap_client/models/info.rb +276 -0
  46. data/lib/coinmarketcap_client/models/info_urls.rb +263 -0
  47. data/lib/coinmarketcap_client/models/inline_response_200.rb +194 -0
  48. data/lib/coinmarketcap_client/models/inline_response_200_1.rb +194 -0
  49. data/lib/coinmarketcap_client/models/inline_response_200_2.rb +194 -0
  50. data/lib/coinmarketcap_client/models/inline_response_200_3.rb +194 -0
  51. data/lib/coinmarketcap_client/models/inline_response_200_4.rb +194 -0
  52. data/lib/coinmarketcap_client/models/inline_response_200_5.rb +194 -0
  53. data/lib/coinmarketcap_client/models/inline_response_default.rb +183 -0
  54. data/lib/coinmarketcap_client/models/inline_response_default_1.rb +183 -0
  55. data/lib/coinmarketcap_client/models/map.rb +246 -0
  56. data/lib/coinmarketcap_client/models/market_data.rb +304 -0
  57. data/lib/coinmarketcap_client/models/platform.rb +220 -0
  58. data/lib/coinmarketcap_client/models/quote.rb +237 -0
  59. data/lib/coinmarketcap_client/models/status.rb +219 -0
  60. data/lib/coinmarketcap_client/version.rb +15 -0
  61. data/spec/api/default_api_spec.rb +63 -0
  62. data/spec/api_client_spec.rb +226 -0
  63. data/spec/configuration_spec.rb +42 -0
  64. data/spec/models/info_spec.rb +101 -0
  65. data/spec/models/info_urls_spec.rb +83 -0
  66. data/spec/models/inline_response_200_1_spec.rb +41 -0
  67. data/spec/models/inline_response_200_2_spec.rb +47 -0
  68. data/spec/models/inline_response_200_3_spec.rb +41 -0
  69. data/spec/models/inline_response_200_4_spec.rb +47 -0
  70. data/spec/models/inline_response_200_5_spec.rb +47 -0
  71. data/spec/models/inline_response_200_spec.rb +47 -0
  72. data/spec/models/inline_response_default_1_spec.rb +41 -0
  73. data/spec/models/inline_response_default_spec.rb +41 -0
  74. data/spec/models/map_spec.rb +83 -0
  75. data/spec/models/market_data_spec.rb +119 -0
  76. data/spec/models/platform_spec.rb +65 -0
  77. data/spec/models/quote_spec.rb +77 -0
  78. data/spec/models/status_spec.rb +65 -0
  79. data/spec/spec_helper.rb +111 -0
  80. metadata +320 -0
@@ -0,0 +1,220 @@
1
+ =begin
2
+ #Coinmarketcap API Swagger Implementation
3
+
4
+ #Define coinmarketcap's api in swagger 2.0 openapi standard
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.4
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CoinmarketcapAPI
16
+ # Metadata about the parent cryptocurrency platform this cryptocurrency belongs to if it is a token, otherwise null.
17
+ class Platform
18
+ attr_accessor :id
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :symbol
23
+
24
+ attr_accessor :slug
25
+
26
+ attr_accessor :token_address
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'id' => :'id',
32
+ :'name' => :'name',
33
+ :'symbol' => :'symbol',
34
+ :'slug' => :'slug',
35
+ :'token_address' => :'token_address'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.swagger_types
41
+ {
42
+ :'id' => :'Integer',
43
+ :'name' => :'String',
44
+ :'symbol' => :'String',
45
+ :'slug' => :'String',
46
+ :'token_address' => :'String'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'id')
59
+ self.id = attributes[:'id']
60
+ end
61
+
62
+ if attributes.has_key?(:'name')
63
+ self.name = attributes[:'name']
64
+ end
65
+
66
+ if attributes.has_key?(:'symbol')
67
+ self.symbol = attributes[:'symbol']
68
+ end
69
+
70
+ if attributes.has_key?(:'slug')
71
+ self.slug = attributes[:'slug']
72
+ end
73
+
74
+ if attributes.has_key?(:'token_address')
75
+ self.token_address = attributes[:'token_address']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ id == o.id &&
98
+ name == o.name &&
99
+ symbol == o.symbol &&
100
+ slug == o.slug &&
101
+ token_address == o.token_address
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Fixnum] Hash code
112
+ def hash
113
+ [id, name, symbol, slug, token_address].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ self.class.swagger_types.each_pair do |key, type|
122
+ if type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :DateTime
143
+ DateTime.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :BOOLEAN
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ temp_model = CoinmarketcapAPI.const_get(type).new
174
+ temp_model.build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ # Returns the object in the form of hash
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_hash
193
+ hash = {}
194
+ self.class.attribute_map.each_pair do |attr, param|
195
+ value = self.send(attr)
196
+ next if value.nil?
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+ end
220
+ end
@@ -0,0 +1,237 @@
1
+ =begin
2
+ #Coinmarketcap API Swagger Implementation
3
+
4
+ #Define coinmarketcap's api in swagger 2.0 openapi standard
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.4
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CoinmarketcapAPI
16
+ class Quote
17
+ attr_accessor :price
18
+
19
+ attr_accessor :volume_24h
20
+
21
+ attr_accessor :percent_change_1h
22
+
23
+ attr_accessor :percent_change_24h
24
+
25
+ attr_accessor :percent_change_7d
26
+
27
+ attr_accessor :market_cap
28
+
29
+ attr_accessor :last_updated
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'price' => :'price',
35
+ :'volume_24h' => :'volume_24h',
36
+ :'percent_change_1h' => :'percent_change_1h',
37
+ :'percent_change_24h' => :'percent_change_24h',
38
+ :'percent_change_7d' => :'percent_change_7d',
39
+ :'market_cap' => :'market_cap',
40
+ :'last_updated' => :'last_updated'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.swagger_types
46
+ {
47
+ :'price' => :'Float',
48
+ :'volume_24h' => :'Integer',
49
+ :'percent_change_1h' => :'Float',
50
+ :'percent_change_24h' => :'Float',
51
+ :'percent_change_7d' => :'Float',
52
+ :'market_cap' => :'Integer',
53
+ :'last_updated' => :'DateTime'
54
+ }
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ return unless attributes.is_a?(Hash)
61
+
62
+ # convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
64
+
65
+ if attributes.has_key?(:'price')
66
+ self.price = attributes[:'price']
67
+ end
68
+
69
+ if attributes.has_key?(:'volume_24h')
70
+ self.volume_24h = attributes[:'volume_24h']
71
+ end
72
+
73
+ if attributes.has_key?(:'percent_change_1h')
74
+ self.percent_change_1h = attributes[:'percent_change_1h']
75
+ end
76
+
77
+ if attributes.has_key?(:'percent_change_24h')
78
+ self.percent_change_24h = attributes[:'percent_change_24h']
79
+ end
80
+
81
+ if attributes.has_key?(:'percent_change_7d')
82
+ self.percent_change_7d = attributes[:'percent_change_7d']
83
+ end
84
+
85
+ if attributes.has_key?(:'market_cap')
86
+ self.market_cap = attributes[:'market_cap']
87
+ end
88
+
89
+ if attributes.has_key?(:'last_updated')
90
+ self.last_updated = attributes[:'last_updated']
91
+ end
92
+ end
93
+
94
+ # Show invalid properties with the reasons. Usually used together with valid?
95
+ # @return Array for valid properties with the reasons
96
+ def list_invalid_properties
97
+ invalid_properties = Array.new
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ true
105
+ end
106
+
107
+ # Checks equality by comparing each attribute.
108
+ # @param [Object] Object to be compared
109
+ def ==(o)
110
+ return true if self.equal?(o)
111
+ self.class == o.class &&
112
+ price == o.price &&
113
+ volume_24h == o.volume_24h &&
114
+ percent_change_1h == o.percent_change_1h &&
115
+ percent_change_24h == o.percent_change_24h &&
116
+ percent_change_7d == o.percent_change_7d &&
117
+ market_cap == o.market_cap &&
118
+ last_updated == o.last_updated
119
+ end
120
+
121
+ # @see the `==` method
122
+ # @param [Object] Object to be compared
123
+ def eql?(o)
124
+ self == o
125
+ end
126
+
127
+ # Calculates hash code according to all attributes.
128
+ # @return [Fixnum] Hash code
129
+ def hash
130
+ [price, volume_24h, percent_change_1h, percent_change_24h, percent_change_7d, market_cap, last_updated].hash
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def build_from_hash(attributes)
137
+ return nil unless attributes.is_a?(Hash)
138
+ self.class.swagger_types.each_pair do |key, type|
139
+ if type =~ /\AArray<(.*)>/i
140
+ # check to ensure the input is an array given that the the attribute
141
+ # is documented as an array but the input is not
142
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
143
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
144
+ end
145
+ elsif !attributes[self.class.attribute_map[key]].nil?
146
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
147
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
148
+ end
149
+
150
+ self
151
+ end
152
+
153
+ # Deserializes the data based on type
154
+ # @param string type Data type
155
+ # @param string value Value to be deserialized
156
+ # @return [Object] Deserialized data
157
+ def _deserialize(type, value)
158
+ case type.to_sym
159
+ when :DateTime
160
+ DateTime.parse(value)
161
+ when :Date
162
+ Date.parse(value)
163
+ when :String
164
+ value.to_s
165
+ when :Integer
166
+ value.to_i
167
+ when :Float
168
+ value.to_f
169
+ when :BOOLEAN
170
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
171
+ true
172
+ else
173
+ false
174
+ end
175
+ when :Object
176
+ # generic object (usually a Hash), return directly
177
+ value
178
+ when /\AArray<(?<inner_type>.+)>\z/
179
+ inner_type = Regexp.last_match[:inner_type]
180
+ value.map { |v| _deserialize(inner_type, v) }
181
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
182
+ k_type = Regexp.last_match[:k_type]
183
+ v_type = Regexp.last_match[:v_type]
184
+ {}.tap do |hash|
185
+ value.each do |k, v|
186
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
187
+ end
188
+ end
189
+ else # model
190
+ temp_model = CoinmarketcapAPI.const_get(type).new
191
+ temp_model.build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ next if value.nil?
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+ end
237
+ end