coinmarketcap_client 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -9
  3. data/docs/{Info.md → CryptocurrencyInfo.md} +2 -2
  4. data/docs/{InfoUrls.md → CryptocurrencyInfoUrls.md} +1 -1
  5. data/docs/{MarketData.md → CryptocurrencyListings.md} +1 -1
  6. data/docs/{Map.md → CryptocurrencyMap.md} +1 -1
  7. data/docs/DefaultApi.md +146 -22
  8. data/docs/GlobalMetricsHistoricalQuote.md +10 -0
  9. data/docs/GlobalMetricsQuote.md +10 -0
  10. data/docs/GlobalMetricsQuotesHistorical.md +10 -0
  11. data/docs/GlobalMetricsQuotesLatest.md +14 -0
  12. data/docs/InlineResponse200.md +1 -1
  13. data/docs/InlineResponse2001.md +1 -1
  14. data/docs/InlineResponse2002.md +1 -1
  15. data/docs/InlineResponse2003.md +1 -1
  16. data/docs/InlineResponse2004.md +1 -1
  17. data/docs/InlineResponse2004Data.md +8 -0
  18. data/docs/InlineResponse2005.md +1 -1
  19. data/docs/InlineResponse2006.md +9 -0
  20. data/docs/InlineResponse2007.md +9 -0
  21. data/docs/InlineResponse2008.md +9 -0
  22. data/docs/InlineResponse2009.md +9 -0
  23. data/docs/Quote.md +1 -1
  24. data/lib/coinmarketcap_client.rb +13 -4
  25. data/lib/coinmarketcap_client/api/default_api.rb +150 -26
  26. data/lib/coinmarketcap_client/models/{info.rb → cryptocurrency_info.rb} +2 -2
  27. data/lib/coinmarketcap_client/models/{info_urls.rb → cryptocurrency_info_urls.rb} +1 -1
  28. data/lib/coinmarketcap_client/models/{market_data.rb → cryptocurrency_listings.rb} +1 -1
  29. data/lib/coinmarketcap_client/models/{map.rb → cryptocurrency_map.rb} +1 -1
  30. data/lib/coinmarketcap_client/models/global_metrics_historical_quote.rb +202 -0
  31. data/lib/coinmarketcap_client/models/global_metrics_quote.rb +202 -0
  32. data/lib/{coinmarketcap_api/models/inline_response_200_3.rb → coinmarketcap_client/models/global_metrics_quotes_historical.rb} +30 -11
  33. data/lib/{coinmarketcap_api/models/map.rb → coinmarketcap_client/models/global_metrics_quotes_latest.rb} +49 -55
  34. data/lib/coinmarketcap_client/models/inline_response_200.rb +1 -1
  35. data/lib/coinmarketcap_client/models/inline_response_200_1.rb +1 -1
  36. data/lib/coinmarketcap_client/models/inline_response_200_2.rb +1 -1
  37. data/lib/coinmarketcap_client/models/inline_response_200_3.rb +2 -4
  38. data/lib/coinmarketcap_client/models/inline_response_200_4.rb +2 -4
  39. data/lib/{coinmarketcap_api/models/inline_response_200_1.rb → coinmarketcap_client/models/inline_response_200_4_data.rb} +11 -11
  40. data/lib/coinmarketcap_client/models/inline_response_200_5.rb +1 -1
  41. data/lib/{coinmarketcap_api/models/inline_response_200_2.rb → coinmarketcap_client/models/inline_response_200_6.rb} +5 -5
  42. data/lib/{coinmarketcap_api/models/inline_response_200.rb → coinmarketcap_client/models/inline_response_200_7.rb} +4 -4
  43. data/lib/{coinmarketcap_api/models/inline_response_default_1.rb → coinmarketcap_client/models/inline_response_200_8.rb} +13 -4
  44. data/lib/{coinmarketcap_api/models/inline_response_default.rb → coinmarketcap_client/models/inline_response_200_9.rb} +13 -4
  45. data/lib/coinmarketcap_client/models/quote.rb +1 -1
  46. data/lib/coinmarketcap_client/version.rb +1 -1
  47. data/spec/api/default_api_spec.rb +71 -6
  48. data/spec/api_client_spec.rb +29 -29
  49. data/spec/configuration_spec.rb +3 -3
  50. data/spec/models/{info_spec.rb → cryptocurrency_info_spec.rb} +6 -6
  51. data/spec/models/{info_urls_spec.rb → cryptocurrency_info_urls_spec.rb} +6 -6
  52. data/spec/models/{market_data_spec.rb → cryptocurrency_listings_spec.rb} +6 -6
  53. data/spec/models/{map_spec.rb → cryptocurrency_map_spec.rb} +6 -6
  54. data/spec/models/global_metrics_historical_quote_spec.rb +53 -0
  55. data/spec/models/global_metrics_quote_spec.rb +53 -0
  56. data/spec/models/global_metrics_quotes_historical_spec.rb +53 -0
  57. data/spec/models/global_metrics_quotes_latest_spec.rb +77 -0
  58. data/spec/models/inline_response_200_1_spec.rb +9 -3
  59. data/spec/models/inline_response_200_2_spec.rb +3 -3
  60. data/spec/models/inline_response_200_3_spec.rb +9 -3
  61. data/spec/models/inline_response_200_4_data_spec.rb +41 -0
  62. data/spec/models/inline_response_200_4_spec.rb +3 -3
  63. data/spec/models/inline_response_200_5_spec.rb +3 -3
  64. data/spec/models/inline_response_200_6_spec.rb +47 -0
  65. data/spec/models/inline_response_200_7_spec.rb +47 -0
  66. data/spec/models/inline_response_200_8_spec.rb +47 -0
  67. data/spec/models/inline_response_200_9_spec.rb +47 -0
  68. data/spec/models/inline_response_200_spec.rb +3 -3
  69. data/spec/models/inline_response_default_1_spec.rb +3 -3
  70. data/spec/models/inline_response_default_spec.rb +3 -3
  71. data/spec/models/platform_spec.rb +3 -3
  72. data/spec/models/quote_spec.rb +3 -3
  73. data/spec/models/status_spec.rb +3 -3
  74. data/spec/spec_helper.rb +1 -1
  75. metadata +54 -34
  76. data/lib/coinmarketcap_api.rb +0 -50
  77. data/lib/coinmarketcap_api/api/default_api.rb +0 -145
  78. data/lib/coinmarketcap_api/api_client.rb +0 -389
  79. data/lib/coinmarketcap_api/api_error.rb +0 -38
  80. data/lib/coinmarketcap_api/configuration.rb +0 -209
  81. data/lib/coinmarketcap_api/models/info.rb +0 -276
  82. data/lib/coinmarketcap_api/models/info_urls.rb +0 -263
  83. data/lib/coinmarketcap_api/models/status.rb +0 -219
  84. data/lib/coinmarketcap_api/version.rb +0 -15
@@ -0,0 +1,202 @@
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 CoinmarketcapClient
16
+ # Global market quote object
17
+ class GlobalMetricsQuote
18
+ attr_accessor :total_market_cap
19
+
20
+ attr_accessor :total_volume_24h
21
+
22
+ attr_accessor :last_updated
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'total_market_cap' => :'total_market_cap',
28
+ :'total_volume_24h' => :'total_volume_24h',
29
+ :'last_updated' => :'last_updated'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'total_market_cap' => :'Float',
37
+ :'total_volume_24h' => :'Float',
38
+ :'last_updated' => :'DateTime'
39
+ }
40
+ end
41
+
42
+ # Initializes the object
43
+ # @param [Hash] attributes Model attributes in the form of hash
44
+ def initialize(attributes = {})
45
+ return unless attributes.is_a?(Hash)
46
+
47
+ # convert string to symbol for hash key
48
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
49
+
50
+ if attributes.has_key?(:'total_market_cap')
51
+ self.total_market_cap = attributes[:'total_market_cap']
52
+ end
53
+
54
+ if attributes.has_key?(:'total_volume_24h')
55
+ self.total_volume_24h = attributes[:'total_volume_24h']
56
+ end
57
+
58
+ if attributes.has_key?(:'last_updated')
59
+ self.last_updated = attributes[:'last_updated']
60
+ end
61
+ end
62
+
63
+ # Show invalid properties with the reasons. Usually used together with valid?
64
+ # @return Array for valid properties with the reasons
65
+ def list_invalid_properties
66
+ invalid_properties = Array.new
67
+ invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ true
74
+ end
75
+
76
+ # Checks equality by comparing each attribute.
77
+ # @param [Object] Object to be compared
78
+ def ==(o)
79
+ return true if self.equal?(o)
80
+ self.class == o.class &&
81
+ total_market_cap == o.total_market_cap &&
82
+ total_volume_24h == o.total_volume_24h &&
83
+ last_updated == o.last_updated
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Fixnum] Hash code
94
+ def hash
95
+ [total_market_cap, total_volume_24h, last_updated].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def build_from_hash(attributes)
102
+ return nil unless attributes.is_a?(Hash)
103
+ self.class.swagger_types.each_pair do |key, type|
104
+ if type =~ /\AArray<(.*)>/i
105
+ # check to ensure the input is an array given that the the attribute
106
+ # is documented as an array but the input is not
107
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
108
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
109
+ end
110
+ elsif !attributes[self.class.attribute_map[key]].nil?
111
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
112
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
113
+ end
114
+
115
+ self
116
+ end
117
+
118
+ # Deserializes the data based on type
119
+ # @param string type Data type
120
+ # @param string value Value to be deserialized
121
+ # @return [Object] Deserialized data
122
+ def _deserialize(type, value)
123
+ case type.to_sym
124
+ when :DateTime
125
+ DateTime.parse(value)
126
+ when :Date
127
+ Date.parse(value)
128
+ when :String
129
+ value.to_s
130
+ when :Integer
131
+ value.to_i
132
+ when :Float
133
+ value.to_f
134
+ when :BOOLEAN
135
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
136
+ true
137
+ else
138
+ false
139
+ end
140
+ when :Object
141
+ # generic object (usually a Hash), return directly
142
+ value
143
+ when /\AArray<(?<inner_type>.+)>\z/
144
+ inner_type = Regexp.last_match[:inner_type]
145
+ value.map { |v| _deserialize(inner_type, v) }
146
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
147
+ k_type = Regexp.last_match[:k_type]
148
+ v_type = Regexp.last_match[:v_type]
149
+ {}.tap do |hash|
150
+ value.each do |k, v|
151
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
152
+ end
153
+ end
154
+ else # model
155
+ temp_model = CoinmarketcapClient.const_get(type).new
156
+ temp_model.build_from_hash(value)
157
+ end
158
+ end
159
+
160
+ # Returns the string representation of the object
161
+ # @return [String] String presentation of the object
162
+ def to_s
163
+ to_hash.to_s
164
+ end
165
+
166
+ # to_body is an alias to to_hash (backward compatibility)
167
+ # @return [Hash] Returns the object in the form of hash
168
+ def to_body
169
+ to_hash
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ next if value.nil?
179
+ hash[param] = _to_hash(value)
180
+ end
181
+ hash
182
+ end
183
+
184
+ # Outputs non-array value in the form of hash
185
+ # For object, use to_hash. Otherwise, just return the value
186
+ # @param [Object] value Any valid value
187
+ # @return [Hash] Returns the value in the form of hash
188
+ def _to_hash(value)
189
+ if value.is_a?(Array)
190
+ value.compact.map { |v| _to_hash(v) }
191
+ elsif value.is_a?(Hash)
192
+ {}.tap do |hash|
193
+ value.each { |k, v| hash[k] = _to_hash(v) }
194
+ end
195
+ elsif value.respond_to? :to_hash
196
+ value.to_hash
197
+ else
198
+ value
199
+ end
200
+ end
201
+ end
202
+ end
@@ -12,21 +12,30 @@ Swagger Codegen version: 2.4.4
12
12
 
13
13
  require 'date'
14
14
 
15
- module CoinmarketcapAPI
16
- class InlineResponse2003
17
- attr_accessor :data
15
+ module CoinmarketcapClient
16
+ # Global metrics historical object
17
+ class GlobalMetricsQuotesHistorical
18
+ attr_accessor :timestamp
19
+
20
+ attr_accessor :btc_dominance
21
+
22
+ attr_accessor :quote
18
23
 
19
24
  # Attribute mapping from ruby-style variable name to JSON key.
20
25
  def self.attribute_map
21
26
  {
22
- :'data' => :'data'
27
+ :'timestamp' => :'timestamp',
28
+ :'btc_dominance' => :'btc_dominance',
29
+ :'quote' => :'quote'
23
30
  }
24
31
  end
25
32
 
26
33
  # Attribute type mapping.
27
34
  def self.swagger_types
28
35
  {
29
- :'data' => :'Hash<String, Info>'
36
+ :'timestamp' => :'DateTime',
37
+ :'btc_dominance' => :'Float',
38
+ :'quote' => :'Hash<String, GlobalMetricsHistoricalQuote>'
30
39
  }
31
40
  end
32
41
 
@@ -38,9 +47,17 @@ module CoinmarketcapAPI
38
47
  # convert string to symbol for hash key
39
48
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
40
49
 
41
- if attributes.has_key?(:'data')
42
- if (value = attributes[:'data']).is_a?(Hash)
43
- self.data = value
50
+ if attributes.has_key?(:'timestamp')
51
+ self.timestamp = attributes[:'timestamp']
52
+ end
53
+
54
+ if attributes.has_key?(:'btc_dominance')
55
+ self.btc_dominance = attributes[:'btc_dominance']
56
+ end
57
+
58
+ if attributes.has_key?(:'quote')
59
+ if (value = attributes[:'quote']).is_a?(Hash)
60
+ self.quote = value
44
61
  end
45
62
  end
46
63
  end
@@ -63,7 +80,9 @@ module CoinmarketcapAPI
63
80
  def ==(o)
64
81
  return true if self.equal?(o)
65
82
  self.class == o.class &&
66
- data == o.data
83
+ timestamp == o.timestamp &&
84
+ btc_dominance == o.btc_dominance &&
85
+ quote == o.quote
67
86
  end
68
87
 
69
88
  # @see the `==` method
@@ -75,7 +94,7 @@ module CoinmarketcapAPI
75
94
  # Calculates hash code according to all attributes.
76
95
  # @return [Fixnum] Hash code
77
96
  def hash
78
- [data].hash
97
+ [timestamp, btc_dominance, quote].hash
79
98
  end
80
99
 
81
100
  # Builds the object from hash
@@ -135,7 +154,7 @@ module CoinmarketcapAPI
135
154
  end
136
155
  end
137
156
  else # model
138
- temp_model = CoinmarketcapAPI.const_get(type).new
157
+ temp_model = CoinmarketcapClient.const_get(type).new
139
158
  temp_model.build_from_hash(value)
140
159
  end
141
160
  end
@@ -12,49 +12,46 @@ Swagger Codegen version: 2.4.4
12
12
 
13
13
  require 'date'
14
14
 
15
- module CoinmarketcapAPI
16
- class Map
17
- attr_accessor :id
15
+ module CoinmarketcapClient
16
+ # Global metrics object
17
+ class GlobalMetricsQuotesLatest
18
+ attr_accessor :btc_dominance
18
19
 
19
- attr_accessor :name
20
+ attr_accessor :eth_dominance
20
21
 
21
- attr_accessor :symbol
22
+ attr_accessor :active_cryptocurrencies
22
23
 
23
- attr_accessor :slug
24
+ attr_accessor :active_market_pairs
24
25
 
25
- attr_accessor :is_active
26
+ attr_accessor :active_exchanges
26
27
 
27
- attr_accessor :first_historical_data
28
+ attr_accessor :last_updated
28
29
 
29
- attr_accessor :last_historical_data
30
-
31
- attr_accessor :platform
30
+ attr_accessor :quote
32
31
 
33
32
  # Attribute mapping from ruby-style variable name to JSON key.
34
33
  def self.attribute_map
35
34
  {
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'
35
+ :'btc_dominance' => :'btc_dominance',
36
+ :'eth_dominance' => :'eth_dominance',
37
+ :'active_cryptocurrencies' => :'active_cryptocurrencies',
38
+ :'active_market_pairs' => :'active_market_pairs',
39
+ :'active_exchanges' => :'active_exchanges',
40
+ :'last_updated' => :'last_updated',
41
+ :'quote' => :'quote'
44
42
  }
45
43
  end
46
44
 
47
45
  # Attribute type mapping.
48
46
  def self.swagger_types
49
47
  {
50
- :'id' => :'Integer',
51
- :'name' => :'String',
52
- :'symbol' => :'String',
53
- :'slug' => :'String',
54
- :'is_active' => :'Integer',
55
- :'first_historical_data' => :'String',
56
- :'last_historical_data' => :'String',
57
- :'platform' => :'String'
48
+ :'btc_dominance' => :'Float',
49
+ :'eth_dominance' => :'Float',
50
+ :'active_cryptocurrencies' => :'Integer',
51
+ :'active_market_pairs' => :'Integer',
52
+ :'active_exchanges' => :'Integer',
53
+ :'last_updated' => :'DateTime',
54
+ :'quote' => :'Hash<String, GlobalMetricsQuote>'
58
55
  }
59
56
  end
60
57
 
@@ -66,36 +63,34 @@ module CoinmarketcapAPI
66
63
  # convert string to symbol for hash key
67
64
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
68
65
 
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']
66
+ if attributes.has_key?(:'btc_dominance')
67
+ self.btc_dominance = attributes[:'btc_dominance']
75
68
  end
76
69
 
77
- if attributes.has_key?(:'symbol')
78
- self.symbol = attributes[:'symbol']
70
+ if attributes.has_key?(:'eth_dominance')
71
+ self.eth_dominance = attributes[:'eth_dominance']
79
72
  end
80
73
 
81
- if attributes.has_key?(:'slug')
82
- self.slug = attributes[:'slug']
74
+ if attributes.has_key?(:'active_cryptocurrencies')
75
+ self.active_cryptocurrencies = attributes[:'active_cryptocurrencies']
83
76
  end
84
77
 
85
- if attributes.has_key?(:'is_active')
86
- self.is_active = attributes[:'is_active']
78
+ if attributes.has_key?(:'active_market_pairs')
79
+ self.active_market_pairs = attributes[:'active_market_pairs']
87
80
  end
88
81
 
89
- if attributes.has_key?(:'first_historical_data')
90
- self.first_historical_data = attributes[:'first_historical_data']
82
+ if attributes.has_key?(:'active_exchanges')
83
+ self.active_exchanges = attributes[:'active_exchanges']
91
84
  end
92
85
 
93
- if attributes.has_key?(:'last_historical_data')
94
- self.last_historical_data = attributes[:'last_historical_data']
86
+ if attributes.has_key?(:'last_updated')
87
+ self.last_updated = attributes[:'last_updated']
95
88
  end
96
89
 
97
- if attributes.has_key?(:'platform')
98
- self.platform = attributes[:'platform']
90
+ if attributes.has_key?(:'quote')
91
+ if (value = attributes[:'quote']).is_a?(Hash)
92
+ self.quote = value
93
+ end
99
94
  end
100
95
  end
101
96
 
@@ -117,14 +112,13 @@ module CoinmarketcapAPI
117
112
  def ==(o)
118
113
  return true if self.equal?(o)
119
114
  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
115
+ btc_dominance == o.btc_dominance &&
116
+ eth_dominance == o.eth_dominance &&
117
+ active_cryptocurrencies == o.active_cryptocurrencies &&
118
+ active_market_pairs == o.active_market_pairs &&
119
+ active_exchanges == o.active_exchanges &&
120
+ last_updated == o.last_updated &&
121
+ quote == o.quote
128
122
  end
129
123
 
130
124
  # @see the `==` method
@@ -136,7 +130,7 @@ module CoinmarketcapAPI
136
130
  # Calculates hash code according to all attributes.
137
131
  # @return [Fixnum] Hash code
138
132
  def hash
139
- [id, name, symbol, slug, is_active, first_historical_data, last_historical_data, platform].hash
133
+ [btc_dominance, eth_dominance, active_cryptocurrencies, active_market_pairs, active_exchanges, last_updated, quote].hash
140
134
  end
141
135
 
142
136
  # Builds the object from hash
@@ -196,7 +190,7 @@ module CoinmarketcapAPI
196
190
  end
197
191
  end
198
192
  else # model
199
- temp_model = CoinmarketcapAPI.const_get(type).new
193
+ temp_model = CoinmarketcapClient.const_get(type).new
200
194
  temp_model.build_from_hash(value)
201
195
  end
202
196
  end