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,194 @@
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 InlineResponse200
17
+ attr_accessor :data
18
+
19
+ attr_accessor :status
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'data' => :'data',
25
+ :'status' => :'status'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'data' => :'Array<Map>',
33
+ :'status' => :'Status'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ if attributes.has_key?(:'data')
46
+ if (value = attributes[:'data']).is_a?(Array)
47
+ self.data = value
48
+ end
49
+ end
50
+
51
+ if attributes.has_key?(:'status')
52
+ self.status = attributes[:'status']
53
+ end
54
+ end
55
+
56
+ # Show invalid properties with the reasons. Usually used together with valid?
57
+ # @return Array for valid properties with the reasons
58
+ def list_invalid_properties
59
+ invalid_properties = Array.new
60
+ invalid_properties
61
+ end
62
+
63
+ # Check to see if the all the properties in the model are valid
64
+ # @return true if the model is valid
65
+ def valid?
66
+ true
67
+ end
68
+
69
+ # Checks equality by comparing each attribute.
70
+ # @param [Object] Object to be compared
71
+ def ==(o)
72
+ return true if self.equal?(o)
73
+ self.class == o.class &&
74
+ data == o.data &&
75
+ status == o.status
76
+ end
77
+
78
+ # @see the `==` method
79
+ # @param [Object] Object to be compared
80
+ def eql?(o)
81
+ self == o
82
+ end
83
+
84
+ # Calculates hash code according to all attributes.
85
+ # @return [Fixnum] Hash code
86
+ def hash
87
+ [data, status].hash
88
+ end
89
+
90
+ # Builds the object from hash
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ # @return [Object] Returns the model itself
93
+ def build_from_hash(attributes)
94
+ return nil unless attributes.is_a?(Hash)
95
+ self.class.swagger_types.each_pair do |key, type|
96
+ if type =~ /\AArray<(.*)>/i
97
+ # check to ensure the input is an array given that the the attribute
98
+ # is documented as an array but the input is not
99
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
100
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
101
+ end
102
+ elsif !attributes[self.class.attribute_map[key]].nil?
103
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
104
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
105
+ end
106
+
107
+ self
108
+ end
109
+
110
+ # Deserializes the data based on type
111
+ # @param string type Data type
112
+ # @param string value Value to be deserialized
113
+ # @return [Object] Deserialized data
114
+ def _deserialize(type, value)
115
+ case type.to_sym
116
+ when :DateTime
117
+ DateTime.parse(value)
118
+ when :Date
119
+ Date.parse(value)
120
+ when :String
121
+ value.to_s
122
+ when :Integer
123
+ value.to_i
124
+ when :Float
125
+ value.to_f
126
+ when :BOOLEAN
127
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
128
+ true
129
+ else
130
+ false
131
+ end
132
+ when :Object
133
+ # generic object (usually a Hash), return directly
134
+ value
135
+ when /\AArray<(?<inner_type>.+)>\z/
136
+ inner_type = Regexp.last_match[:inner_type]
137
+ value.map { |v| _deserialize(inner_type, v) }
138
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
139
+ k_type = Regexp.last_match[:k_type]
140
+ v_type = Regexp.last_match[:v_type]
141
+ {}.tap do |hash|
142
+ value.each do |k, v|
143
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
144
+ end
145
+ end
146
+ else # model
147
+ temp_model = CoinmarketcapAPI.const_get(type).new
148
+ temp_model.build_from_hash(value)
149
+ end
150
+ end
151
+
152
+ # Returns the string representation of the object
153
+ # @return [String] String presentation of the object
154
+ def to_s
155
+ to_hash.to_s
156
+ end
157
+
158
+ # to_body is an alias to to_hash (backward compatibility)
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_body
161
+ to_hash
162
+ end
163
+
164
+ # Returns the object in the form of hash
165
+ # @return [Hash] Returns the object in the form of hash
166
+ def to_hash
167
+ hash = {}
168
+ self.class.attribute_map.each_pair do |attr, param|
169
+ value = self.send(attr)
170
+ next if value.nil?
171
+ hash[param] = _to_hash(value)
172
+ end
173
+ hash
174
+ end
175
+
176
+ # Outputs non-array value in the form of hash
177
+ # For object, use to_hash. Otherwise, just return the value
178
+ # @param [Object] value Any valid value
179
+ # @return [Hash] Returns the value in the form of hash
180
+ def _to_hash(value)
181
+ if value.is_a?(Array)
182
+ value.compact.map { |v| _to_hash(v) }
183
+ elsif value.is_a?(Hash)
184
+ {}.tap do |hash|
185
+ value.each { |k, v| hash[k] = _to_hash(v) }
186
+ end
187
+ elsif value.respond_to? :to_hash
188
+ value.to_hash
189
+ else
190
+ value
191
+ end
192
+ end
193
+ end
194
+ end
@@ -0,0 +1,185 @@
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 InlineResponse2001
17
+ attr_accessor :data
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'data' => :'data'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.swagger_types
28
+ {
29
+ :'data' => :'Hash<String, Info>'
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?(:'data')
42
+ if (value = attributes[:'data']).is_a?(Hash)
43
+ self.data = value
44
+ end
45
+ end
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properties with the reasons
50
+ def list_invalid_properties
51
+ invalid_properties = Array.new
52
+ invalid_properties
53
+ end
54
+
55
+ # Check to see if the all the properties in the model are valid
56
+ # @return true if the model is valid
57
+ def valid?
58
+ true
59
+ end
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] Object to be compared
63
+ def ==(o)
64
+ return true if self.equal?(o)
65
+ self.class == o.class &&
66
+ data == o.data
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] Object to be compared
71
+ def eql?(o)
72
+ self == o
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Fixnum] Hash code
77
+ def hash
78
+ [data].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def build_from_hash(attributes)
85
+ return nil unless attributes.is_a?(Hash)
86
+ self.class.swagger_types.each_pair do |key, type|
87
+ if type =~ /\AArray<(.*)>/i
88
+ # check to ensure the input is an array given that the the attribute
89
+ # is documented as an array but the input is not
90
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
91
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
92
+ end
93
+ elsif !attributes[self.class.attribute_map[key]].nil?
94
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
95
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
96
+ end
97
+
98
+ self
99
+ end
100
+
101
+ # Deserializes the data based on type
102
+ # @param string type Data type
103
+ # @param string value Value to be deserialized
104
+ # @return [Object] Deserialized data
105
+ def _deserialize(type, value)
106
+ case type.to_sym
107
+ when :DateTime
108
+ DateTime.parse(value)
109
+ when :Date
110
+ Date.parse(value)
111
+ when :String
112
+ value.to_s
113
+ when :Integer
114
+ value.to_i
115
+ when :Float
116
+ value.to_f
117
+ when :BOOLEAN
118
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
119
+ true
120
+ else
121
+ false
122
+ end
123
+ when :Object
124
+ # generic object (usually a Hash), return directly
125
+ value
126
+ when /\AArray<(?<inner_type>.+)>\z/
127
+ inner_type = Regexp.last_match[:inner_type]
128
+ value.map { |v| _deserialize(inner_type, v) }
129
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
130
+ k_type = Regexp.last_match[:k_type]
131
+ v_type = Regexp.last_match[:v_type]
132
+ {}.tap do |hash|
133
+ value.each do |k, v|
134
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
135
+ end
136
+ end
137
+ else # model
138
+ temp_model = CoinmarketcapAPI.const_get(type).new
139
+ temp_model.build_from_hash(value)
140
+ end
141
+ end
142
+
143
+ # Returns the string representation of the object
144
+ # @return [String] String presentation of the object
145
+ def to_s
146
+ to_hash.to_s
147
+ end
148
+
149
+ # to_body is an alias to to_hash (backward compatibility)
150
+ # @return [Hash] Returns the object in the form of hash
151
+ def to_body
152
+ to_hash
153
+ end
154
+
155
+ # Returns the object in the form of hash
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_hash
158
+ hash = {}
159
+ self.class.attribute_map.each_pair do |attr, param|
160
+ value = self.send(attr)
161
+ next if value.nil?
162
+ hash[param] = _to_hash(value)
163
+ end
164
+ hash
165
+ end
166
+
167
+ # Outputs non-array value in the form of hash
168
+ # For object, use to_hash. Otherwise, just return the value
169
+ # @param [Object] value Any valid value
170
+ # @return [Hash] Returns the value in the form of hash
171
+ def _to_hash(value)
172
+ if value.is_a?(Array)
173
+ value.compact.map { |v| _to_hash(v) }
174
+ elsif value.is_a?(Hash)
175
+ {}.tap do |hash|
176
+ value.each { |k, v| hash[k] = _to_hash(v) }
177
+ end
178
+ elsif value.respond_to? :to_hash
179
+ value.to_hash
180
+ else
181
+ value
182
+ end
183
+ end
184
+ end
185
+ end
@@ -0,0 +1,194 @@
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 InlineResponse2002
17
+ attr_accessor :data
18
+
19
+ attr_accessor :status
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'data' => :'data',
25
+ :'status' => :'status'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'data' => :'Array<Map>',
33
+ :'status' => :'Status'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ if attributes.has_key?(:'data')
46
+ if (value = attributes[:'data']).is_a?(Array)
47
+ self.data = value
48
+ end
49
+ end
50
+
51
+ if attributes.has_key?(:'status')
52
+ self.status = attributes[:'status']
53
+ end
54
+ end
55
+
56
+ # Show invalid properties with the reasons. Usually used together with valid?
57
+ # @return Array for valid properties with the reasons
58
+ def list_invalid_properties
59
+ invalid_properties = Array.new
60
+ invalid_properties
61
+ end
62
+
63
+ # Check to see if the all the properties in the model are valid
64
+ # @return true if the model is valid
65
+ def valid?
66
+ true
67
+ end
68
+
69
+ # Checks equality by comparing each attribute.
70
+ # @param [Object] Object to be compared
71
+ def ==(o)
72
+ return true if self.equal?(o)
73
+ self.class == o.class &&
74
+ data == o.data &&
75
+ status == o.status
76
+ end
77
+
78
+ # @see the `==` method
79
+ # @param [Object] Object to be compared
80
+ def eql?(o)
81
+ self == o
82
+ end
83
+
84
+ # Calculates hash code according to all attributes.
85
+ # @return [Fixnum] Hash code
86
+ def hash
87
+ [data, status].hash
88
+ end
89
+
90
+ # Builds the object from hash
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ # @return [Object] Returns the model itself
93
+ def build_from_hash(attributes)
94
+ return nil unless attributes.is_a?(Hash)
95
+ self.class.swagger_types.each_pair do |key, type|
96
+ if type =~ /\AArray<(.*)>/i
97
+ # check to ensure the input is an array given that the the attribute
98
+ # is documented as an array but the input is not
99
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
100
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
101
+ end
102
+ elsif !attributes[self.class.attribute_map[key]].nil?
103
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
104
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
105
+ end
106
+
107
+ self
108
+ end
109
+
110
+ # Deserializes the data based on type
111
+ # @param string type Data type
112
+ # @param string value Value to be deserialized
113
+ # @return [Object] Deserialized data
114
+ def _deserialize(type, value)
115
+ case type.to_sym
116
+ when :DateTime
117
+ DateTime.parse(value)
118
+ when :Date
119
+ Date.parse(value)
120
+ when :String
121
+ value.to_s
122
+ when :Integer
123
+ value.to_i
124
+ when :Float
125
+ value.to_f
126
+ when :BOOLEAN
127
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
128
+ true
129
+ else
130
+ false
131
+ end
132
+ when :Object
133
+ # generic object (usually a Hash), return directly
134
+ value
135
+ when /\AArray<(?<inner_type>.+)>\z/
136
+ inner_type = Regexp.last_match[:inner_type]
137
+ value.map { |v| _deserialize(inner_type, v) }
138
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
139
+ k_type = Regexp.last_match[:k_type]
140
+ v_type = Regexp.last_match[:v_type]
141
+ {}.tap do |hash|
142
+ value.each do |k, v|
143
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
144
+ end
145
+ end
146
+ else # model
147
+ temp_model = CoinmarketcapAPI.const_get(type).new
148
+ temp_model.build_from_hash(value)
149
+ end
150
+ end
151
+
152
+ # Returns the string representation of the object
153
+ # @return [String] String presentation of the object
154
+ def to_s
155
+ to_hash.to_s
156
+ end
157
+
158
+ # to_body is an alias to to_hash (backward compatibility)
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_body
161
+ to_hash
162
+ end
163
+
164
+ # Returns the object in the form of hash
165
+ # @return [Hash] Returns the object in the form of hash
166
+ def to_hash
167
+ hash = {}
168
+ self.class.attribute_map.each_pair do |attr, param|
169
+ value = self.send(attr)
170
+ next if value.nil?
171
+ hash[param] = _to_hash(value)
172
+ end
173
+ hash
174
+ end
175
+
176
+ # Outputs non-array value in the form of hash
177
+ # For object, use to_hash. Otherwise, just return the value
178
+ # @param [Object] value Any valid value
179
+ # @return [Hash] Returns the value in the form of hash
180
+ def _to_hash(value)
181
+ if value.is_a?(Array)
182
+ value.compact.map { |v| _to_hash(v) }
183
+ elsif value.is_a?(Hash)
184
+ {}.tap do |hash|
185
+ value.each { |k, v| hash[k] = _to_hash(v) }
186
+ end
187
+ elsif value.respond_to? :to_hash
188
+ value.to_hash
189
+ else
190
+ value
191
+ end
192
+ end
193
+ end
194
+ end