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