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,276 @@
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 Info
17
+ attr_accessor :id
18
+
19
+ attr_accessor :name
20
+
21
+ attr_accessor :symbol
22
+
23
+ attr_accessor :category
24
+
25
+ attr_accessor :slug
26
+
27
+ attr_accessor :logo
28
+
29
+ # coin tags
30
+ attr_accessor :tags
31
+
32
+ attr_accessor :description
33
+
34
+ attr_accessor :date_added
35
+
36
+ attr_accessor :platform
37
+
38
+ attr_accessor :urls
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'id' => :'id',
44
+ :'name' => :'name',
45
+ :'symbol' => :'symbol',
46
+ :'category' => :'category',
47
+ :'slug' => :'slug',
48
+ :'logo' => :'logo',
49
+ :'tags' => :'tags',
50
+ :'description' => :'description',
51
+ :'date_added' => :'date_added',
52
+ :'platform' => :'platform',
53
+ :'urls' => :'urls'
54
+ }
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.swagger_types
59
+ {
60
+ :'id' => :'Integer',
61
+ :'name' => :'String',
62
+ :'symbol' => :'String',
63
+ :'category' => :'String',
64
+ :'slug' => :'String',
65
+ :'logo' => :'String',
66
+ :'tags' => :'Array<String>',
67
+ :'description' => :'String',
68
+ :'date_added' => :'String',
69
+ :'platform' => :'String',
70
+ :'urls' => :'InfoUrls'
71
+ }
72
+ end
73
+
74
+ # Initializes the object
75
+ # @param [Hash] attributes Model attributes in the form of hash
76
+ def initialize(attributes = {})
77
+ return unless attributes.is_a?(Hash)
78
+
79
+ # convert string to symbol for hash key
80
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
81
+
82
+ if attributes.has_key?(:'id')
83
+ self.id = attributes[:'id']
84
+ end
85
+
86
+ if attributes.has_key?(:'name')
87
+ self.name = attributes[:'name']
88
+ end
89
+
90
+ if attributes.has_key?(:'symbol')
91
+ self.symbol = attributes[:'symbol']
92
+ end
93
+
94
+ if attributes.has_key?(:'category')
95
+ self.category = attributes[:'category']
96
+ end
97
+
98
+ if attributes.has_key?(:'slug')
99
+ self.slug = attributes[:'slug']
100
+ end
101
+
102
+ if attributes.has_key?(:'logo')
103
+ self.logo = attributes[:'logo']
104
+ end
105
+
106
+ if attributes.has_key?(:'tags')
107
+ if (value = attributes[:'tags']).is_a?(Array)
108
+ self.tags = value
109
+ end
110
+ end
111
+
112
+ if attributes.has_key?(:'description')
113
+ self.description = attributes[:'description']
114
+ end
115
+
116
+ if attributes.has_key?(:'date_added')
117
+ self.date_added = attributes[:'date_added']
118
+ end
119
+
120
+ if attributes.has_key?(:'platform')
121
+ self.platform = attributes[:'platform']
122
+ end
123
+
124
+ if attributes.has_key?(:'urls')
125
+ self.urls = attributes[:'urls']
126
+ end
127
+ end
128
+
129
+ # Show invalid properties with the reasons. Usually used together with valid?
130
+ # @return Array for valid properties with the reasons
131
+ def list_invalid_properties
132
+ invalid_properties = Array.new
133
+ invalid_properties
134
+ end
135
+
136
+ # Check to see if the all the properties in the model are valid
137
+ # @return true if the model is valid
138
+ def valid?
139
+ true
140
+ end
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(o)
145
+ return true if self.equal?(o)
146
+ self.class == o.class &&
147
+ id == o.id &&
148
+ name == o.name &&
149
+ symbol == o.symbol &&
150
+ category == o.category &&
151
+ slug == o.slug &&
152
+ logo == o.logo &&
153
+ tags == o.tags &&
154
+ description == o.description &&
155
+ date_added == o.date_added &&
156
+ platform == o.platform &&
157
+ urls == o.urls
158
+ end
159
+
160
+ # @see the `==` method
161
+ # @param [Object] Object to be compared
162
+ def eql?(o)
163
+ self == o
164
+ end
165
+
166
+ # Calculates hash code according to all attributes.
167
+ # @return [Fixnum] Hash code
168
+ def hash
169
+ [id, name, symbol, category, slug, logo, tags, description, date_added, platform, urls].hash
170
+ end
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def build_from_hash(attributes)
176
+ return nil unless attributes.is_a?(Hash)
177
+ self.class.swagger_types.each_pair do |key, type|
178
+ if type =~ /\AArray<(.*)>/i
179
+ # check to ensure the input is an array given that the the attribute
180
+ # is documented as an array but the input is not
181
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
182
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
183
+ end
184
+ elsif !attributes[self.class.attribute_map[key]].nil?
185
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
186
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
187
+ end
188
+
189
+ self
190
+ end
191
+
192
+ # Deserializes the data based on type
193
+ # @param string type Data type
194
+ # @param string value Value to be deserialized
195
+ # @return [Object] Deserialized data
196
+ def _deserialize(type, value)
197
+ case type.to_sym
198
+ when :DateTime
199
+ DateTime.parse(value)
200
+ when :Date
201
+ Date.parse(value)
202
+ when :String
203
+ value.to_s
204
+ when :Integer
205
+ value.to_i
206
+ when :Float
207
+ value.to_f
208
+ when :BOOLEAN
209
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
210
+ true
211
+ else
212
+ false
213
+ end
214
+ when :Object
215
+ # generic object (usually a Hash), return directly
216
+ value
217
+ when /\AArray<(?<inner_type>.+)>\z/
218
+ inner_type = Regexp.last_match[:inner_type]
219
+ value.map { |v| _deserialize(inner_type, v) }
220
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
221
+ k_type = Regexp.last_match[:k_type]
222
+ v_type = Regexp.last_match[:v_type]
223
+ {}.tap do |hash|
224
+ value.each do |k, v|
225
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
226
+ end
227
+ end
228
+ else # model
229
+ temp_model = CoinmarketcapAPI.const_get(type).new
230
+ temp_model.build_from_hash(value)
231
+ end
232
+ end
233
+
234
+ # Returns the string representation of the object
235
+ # @return [String] String presentation of the object
236
+ def to_s
237
+ to_hash.to_s
238
+ end
239
+
240
+ # to_body is an alias to to_hash (backward compatibility)
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_body
243
+ to_hash
244
+ end
245
+
246
+ # Returns the object in the form of hash
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_hash
249
+ hash = {}
250
+ self.class.attribute_map.each_pair do |attr, param|
251
+ value = self.send(attr)
252
+ next if value.nil?
253
+ hash[param] = _to_hash(value)
254
+ end
255
+ hash
256
+ end
257
+
258
+ # Outputs non-array value in the form of hash
259
+ # For object, use to_hash. Otherwise, just return the value
260
+ # @param [Object] value Any valid value
261
+ # @return [Hash] Returns the value in the form of hash
262
+ def _to_hash(value)
263
+ if value.is_a?(Array)
264
+ value.compact.map { |v| _to_hash(v) }
265
+ elsif value.is_a?(Hash)
266
+ {}.tap do |hash|
267
+ value.each { |k, v| hash[k] = _to_hash(v) }
268
+ end
269
+ elsif value.respond_to? :to_hash
270
+ value.to_hash
271
+ else
272
+ value
273
+ end
274
+ end
275
+ end
276
+ end
@@ -0,0 +1,263 @@
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
+ # Players associated with the
17
+ class InfoUrls
18
+ attr_accessor :website
19
+
20
+ attr_accessor :explorer
21
+
22
+ attr_accessor :source_code
23
+
24
+ attr_accessor :message_board
25
+
26
+ attr_accessor :chat
27
+
28
+ attr_accessor :announcement
29
+
30
+ attr_accessor :reddit
31
+
32
+ attr_accessor :twitter
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'website' => :'website',
38
+ :'explorer' => :'explorer',
39
+ :'source_code' => :'source_code',
40
+ :'message_board' => :'message_board',
41
+ :'chat' => :'chat',
42
+ :'announcement' => :'announcement',
43
+ :'reddit' => :'reddit',
44
+ :'twitter' => :'twitter'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.swagger_types
50
+ {
51
+ :'website' => :'Array<String>',
52
+ :'explorer' => :'Array<String>',
53
+ :'source_code' => :'Array<String>',
54
+ :'message_board' => :'Array<String>',
55
+ :'chat' => :'Array<String>',
56
+ :'announcement' => :'Array<String>',
57
+ :'reddit' => :'Array<String>',
58
+ :'twitter' => :'Array<String>'
59
+ }
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ return unless attributes.is_a?(Hash)
66
+
67
+ # convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
69
+
70
+ if attributes.has_key?(:'website')
71
+ if (value = attributes[:'website']).is_a?(Array)
72
+ self.website = value
73
+ end
74
+ end
75
+
76
+ if attributes.has_key?(:'explorer')
77
+ if (value = attributes[:'explorer']).is_a?(Array)
78
+ self.explorer = value
79
+ end
80
+ end
81
+
82
+ if attributes.has_key?(:'source_code')
83
+ if (value = attributes[:'source_code']).is_a?(Array)
84
+ self.source_code = value
85
+ end
86
+ end
87
+
88
+ if attributes.has_key?(:'message_board')
89
+ if (value = attributes[:'message_board']).is_a?(Array)
90
+ self.message_board = value
91
+ end
92
+ end
93
+
94
+ if attributes.has_key?(:'chat')
95
+ if (value = attributes[:'chat']).is_a?(Array)
96
+ self.chat = value
97
+ end
98
+ end
99
+
100
+ if attributes.has_key?(:'announcement')
101
+ if (value = attributes[:'announcement']).is_a?(Array)
102
+ self.announcement = value
103
+ end
104
+ end
105
+
106
+ if attributes.has_key?(:'reddit')
107
+ if (value = attributes[:'reddit']).is_a?(Array)
108
+ self.reddit = value
109
+ end
110
+ end
111
+
112
+ if attributes.has_key?(:'twitter')
113
+ if (value = attributes[:'twitter']).is_a?(Array)
114
+ self.twitter = value
115
+ end
116
+ end
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properties with the reasons
121
+ def list_invalid_properties
122
+ invalid_properties = Array.new
123
+ invalid_properties
124
+ end
125
+
126
+ # Check to see if the all the properties in the model are valid
127
+ # @return true if the model is valid
128
+ def valid?
129
+ true
130
+ end
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] Object to be compared
134
+ def ==(o)
135
+ return true if self.equal?(o)
136
+ self.class == o.class &&
137
+ website == o.website &&
138
+ explorer == o.explorer &&
139
+ source_code == o.source_code &&
140
+ message_board == o.message_board &&
141
+ chat == o.chat &&
142
+ announcement == o.announcement &&
143
+ reddit == o.reddit &&
144
+ twitter == o.twitter
145
+ end
146
+
147
+ # @see the `==` method
148
+ # @param [Object] Object to be compared
149
+ def eql?(o)
150
+ self == o
151
+ end
152
+
153
+ # Calculates hash code according to all attributes.
154
+ # @return [Fixnum] Hash code
155
+ def hash
156
+ [website, explorer, source_code, message_board, chat, announcement, reddit, twitter].hash
157
+ end
158
+
159
+ # Builds the object from hash
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ # @return [Object] Returns the model itself
162
+ def build_from_hash(attributes)
163
+ return nil unless attributes.is_a?(Hash)
164
+ self.class.swagger_types.each_pair do |key, type|
165
+ if type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
170
+ end
171
+ elsif !attributes[self.class.attribute_map[key]].nil?
172
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
173
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
174
+ end
175
+
176
+ self
177
+ end
178
+
179
+ # Deserializes the data based on type
180
+ # @param string type Data type
181
+ # @param string value Value to be deserialized
182
+ # @return [Object] Deserialized data
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :DateTime
186
+ DateTime.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :BOOLEAN
196
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when :Object
202
+ # generic object (usually a Hash), return directly
203
+ value
204
+ when /\AArray<(?<inner_type>.+)>\z/
205
+ inner_type = Regexp.last_match[:inner_type]
206
+ value.map { |v| _deserialize(inner_type, v) }
207
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
208
+ k_type = Regexp.last_match[:k_type]
209
+ v_type = Regexp.last_match[:v_type]
210
+ {}.tap do |hash|
211
+ value.each do |k, v|
212
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
+ end
214
+ end
215
+ else # model
216
+ temp_model = CoinmarketcapAPI.const_get(type).new
217
+ temp_model.build_from_hash(value)
218
+ end
219
+ end
220
+
221
+ # Returns the string representation of the object
222
+ # @return [String] String presentation of the object
223
+ def to_s
224
+ to_hash.to_s
225
+ end
226
+
227
+ # to_body is an alias to to_hash (backward compatibility)
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_body
230
+ to_hash
231
+ end
232
+
233
+ # Returns the object in the form of hash
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_hash
236
+ hash = {}
237
+ self.class.attribute_map.each_pair do |attr, param|
238
+ value = self.send(attr)
239
+ next if value.nil?
240
+ hash[param] = _to_hash(value)
241
+ end
242
+ hash
243
+ end
244
+
245
+ # Outputs non-array value in the form of hash
246
+ # For object, use to_hash. Otherwise, just return the value
247
+ # @param [Object] value Any valid value
248
+ # @return [Hash] Returns the value in the form of hash
249
+ def _to_hash(value)
250
+ if value.is_a?(Array)
251
+ value.compact.map { |v| _to_hash(v) }
252
+ elsif value.is_a?(Hash)
253
+ {}.tap do |hash|
254
+ value.each { |k, v| hash[k] = _to_hash(v) }
255
+ end
256
+ elsif value.respond_to? :to_hash
257
+ value.to_hash
258
+ else
259
+ value
260
+ end
261
+ end
262
+ end
263
+ end