devme-sdk-ruby 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +8 -0
  3. data/Gemfile +9 -0
  4. data/Gemfile.lock +71 -0
  5. data/LICENSE.md +25 -0
  6. data/README.md +97 -0
  7. data/Rakefile +10 -0
  8. data/devme-sdk-ruby.gemspec +38 -0
  9. data/examples/app/.gitignore +198 -0
  10. data/examples/app/Gemfile +6 -0
  11. data/examples/app/Gemfile.lock +23 -0
  12. data/examples/app/test-api.rb +20 -0
  13. data/lib/devme-sdk-ruby/api/country_api.rb +178 -0
  14. data/lib/devme-sdk-ruby/api/currency_api.rb +333 -0
  15. data/lib/devme-sdk-ruby/api/domain_api.rb +81 -0
  16. data/lib/devme-sdk-ruby/api/email_api.rb +91 -0
  17. data/lib/devme-sdk-ruby/api/ip_api.rb +81 -0
  18. data/lib/devme-sdk-ruby/api/phone_api.rb +85 -0
  19. data/lib/devme-sdk-ruby/api/utils_api.rb +78 -0
  20. data/lib/devme-sdk-ruby/api_client.rb +390 -0
  21. data/lib/devme-sdk-ruby/api_error.rb +57 -0
  22. data/lib/devme-sdk-ruby/configuration.rb +285 -0
  23. data/lib/devme-sdk-ruby/models/convert_currency_out.rb +280 -0
  24. data/lib/devme-sdk-ruby/models/error.rb +251 -0
  25. data/lib/devme-sdk-ruby/models/get_country_details_out.rb +230 -0
  26. data/lib/devme-sdk-ruby/models/get_currency_details_out.rb +230 -0
  27. data/lib/devme-sdk-ruby/models/get_currency_exchange_rate_out.rb +250 -0
  28. data/lib/devme-sdk-ruby/models/get_domain_whois_out.rb +230 -0
  29. data/lib/devme-sdk-ruby/models/get_email_details_out.rb +290 -0
  30. data/lib/devme-sdk-ruby/models/get_ip_details_city_out.rb +260 -0
  31. data/lib/devme-sdk-ruby/models/get_ip_details_out.rb +269 -0
  32. data/lib/devme-sdk-ruby/models/get_phone_details_out.rb +270 -0
  33. data/lib/devme-sdk-ruby/models/http_error_out.rb +252 -0
  34. data/lib/devme-sdk-ruby/models/list_countries_item.rb +230 -0
  35. data/lib/devme-sdk-ruby/models/list_countries_out.rb +242 -0
  36. data/lib/devme-sdk-ruby/models/list_currencies_item.rb +314 -0
  37. data/lib/devme-sdk-ruby/models/list_currencies_out.rb +242 -0
  38. data/lib/devme-sdk-ruby/models/who_am_i_out.rb +264 -0
  39. data/lib/devme-sdk-ruby/version.rb +15 -0
  40. data/lib/devme-sdk-ruby.rb +62 -0
  41. data/spec/api/country_api_spec.rb +66 -0
  42. data/spec/api/currency_api_spec.rb +101 -0
  43. data/spec/api/domain_api_spec.rb +46 -0
  44. data/spec/api/email_api_spec.rb +48 -0
  45. data/spec/api/ip_api_spec.rb +53 -0
  46. data/spec/api/phone_api_spec.rb +46 -0
  47. data/spec/api/utils_api_spec.rb +45 -0
  48. data/spec/api_client_spec.rb +226 -0
  49. data/spec/configuration_spec.rb +42 -0
  50. data/spec/spec_helper.rb +111 -0
  51. metadata +146 -0
@@ -0,0 +1,290 @@
1
+ =begin
2
+ #DEV.ME API Documentation
3
+
4
+ #DEV.ME API Documentation [Currency Conversion and Exchange Rates API](https://dev.me/products/currency) - [IP2Location, IP Country, IP Information API](https://dev.me/products/ip) - [Email Validation, Mailbox Verification](https://dev.me/products/email) - [Phone Number Validation](https://dev.me/products/phone). You can learn more at [dev.me](https://dev.me). For this example you can use api key `demo-key` to test the APIs
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@dev.me
8
+
9
+
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DevmeSdk
17
+ class GetEmailDetailsOut
18
+ # email address
19
+ attr_accessor :email
20
+
21
+ # is the domain is valid with dns MX record
22
+ attr_accessor :valid_mx
23
+
24
+ # is email address valid with SMTP Connect and Reply
25
+ attr_accessor :valid_smtp
26
+
27
+ # is email valid format
28
+ attr_accessor :valid_format
29
+
30
+ # is disposable email
31
+ attr_accessor :is_disposable
32
+
33
+ # is free email
34
+ attr_accessor :is_free
35
+
36
+ # domain age
37
+ attr_accessor :domain_age
38
+
39
+ # quality score
40
+ attr_accessor :score
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'email' => :'email',
46
+ :'valid_mx' => :'validMx',
47
+ :'valid_smtp' => :'validSmtp',
48
+ :'valid_format' => :'validFormat',
49
+ :'is_disposable' => :'isDisposable',
50
+ :'is_free' => :'isFree',
51
+ :'domain_age' => :'domainAge',
52
+ :'score' => :'score'
53
+ }
54
+ end
55
+
56
+ # Returns all the JSON keys this model knows about
57
+ def self.acceptable_attributes
58
+ attribute_map.values
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.openapi_types
63
+ {
64
+ :'email' => :'String',
65
+ :'valid_mx' => :'Boolean',
66
+ :'valid_smtp' => :'Boolean',
67
+ :'valid_format' => :'Boolean',
68
+ :'is_disposable' => :'Boolean',
69
+ :'is_free' => :'Boolean',
70
+ :'domain_age' => :'Float',
71
+ :'score' => :'Float'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ ])
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ if (!attributes.is_a?(Hash))
85
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DevmeSdk::GetEmailDetailsOut` initialize method"
86
+ end
87
+
88
+ # check to see if the attribute exists and convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!self.class.attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DevmeSdk::GetEmailDetailsOut`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'email')
97
+ self.email = attributes[:'email']
98
+ end
99
+
100
+ if attributes.key?(:'valid_mx')
101
+ self.valid_mx = attributes[:'valid_mx']
102
+ end
103
+
104
+ if attributes.key?(:'valid_smtp')
105
+ self.valid_smtp = attributes[:'valid_smtp']
106
+ end
107
+
108
+ if attributes.key?(:'valid_format')
109
+ self.valid_format = attributes[:'valid_format']
110
+ end
111
+
112
+ if attributes.key?(:'is_disposable')
113
+ self.is_disposable = attributes[:'is_disposable']
114
+ end
115
+
116
+ if attributes.key?(:'is_free')
117
+ self.is_free = attributes[:'is_free']
118
+ end
119
+
120
+ if attributes.key?(:'domain_age')
121
+ self.domain_age = attributes[:'domain_age']
122
+ end
123
+
124
+ if attributes.key?(:'score')
125
+ self.score = attributes[:'score']
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
+ email == o.email &&
148
+ valid_mx == o.valid_mx &&
149
+ valid_smtp == o.valid_smtp &&
150
+ valid_format == o.valid_format &&
151
+ is_disposable == o.is_disposable &&
152
+ is_free == o.is_free &&
153
+ domain_age == o.domain_age &&
154
+ score == o.score
155
+ end
156
+
157
+ # @see the `==` method
158
+ # @param [Object] Object to be compared
159
+ def eql?(o)
160
+ self == o
161
+ end
162
+
163
+ # Calculates hash code according to all attributes.
164
+ # @return [Integer] Hash code
165
+ def hash
166
+ [email, valid_mx, valid_smtp, valid_format, is_disposable, is_free, domain_age, score].hash
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def self.build_from_hash(attributes)
173
+ new.build_from_hash(attributes)
174
+ end
175
+
176
+ # Builds the object from hash
177
+ # @param [Hash] attributes Model attributes in the form of hash
178
+ # @return [Object] Returns the model itself
179
+ def build_from_hash(attributes)
180
+ return nil unless attributes.is_a?(Hash)
181
+ self.class.openapi_types.each_pair do |key, type|
182
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
183
+ self.send("#{key}=", nil)
184
+ elsif type =~ /\AArray<(.*)>/i
185
+ # check to ensure the input is an array given that the attribute
186
+ # is documented as an array but the input is not
187
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
188
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
189
+ end
190
+ elsif !attributes[self.class.attribute_map[key]].nil?
191
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
192
+ end
193
+ end
194
+
195
+ self
196
+ end
197
+
198
+ # Deserializes the data based on type
199
+ # @param string type Data type
200
+ # @param string value Value to be deserialized
201
+ # @return [Object] Deserialized data
202
+ def _deserialize(type, value)
203
+ case type.to_sym
204
+ when :Time
205
+ Time.parse(value)
206
+ when :Date
207
+ Date.parse(value)
208
+ when :String
209
+ value.to_s
210
+ when :Integer
211
+ value.to_i
212
+ when :Float
213
+ value.to_f
214
+ when :Boolean
215
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
216
+ true
217
+ else
218
+ false
219
+ end
220
+ when :Object
221
+ # generic object (usually a Hash), return directly
222
+ value
223
+ when /\AArray<(?<inner_type>.+)>\z/
224
+ inner_type = Regexp.last_match[:inner_type]
225
+ value.map { |v| _deserialize(inner_type, v) }
226
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
227
+ k_type = Regexp.last_match[:k_type]
228
+ v_type = Regexp.last_match[:v_type]
229
+ {}.tap do |hash|
230
+ value.each do |k, v|
231
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
232
+ end
233
+ end
234
+ else
235
+ # model
236
+ # models (e.g. Pet) or oneOf
237
+ klass = DevmeSdk.const_get(type)
238
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
239
+ end
240
+ end
241
+
242
+ # Returns the string representation of the object
243
+ # @return [String] String presentation of the object
244
+ def to_s
245
+ to_hash.to_s
246
+ end
247
+
248
+ # to_body is an alias to to_hash (backward compatibility)
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_body
251
+ to_hash
252
+ end
253
+
254
+ # Returns the object in the form of hash
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_hash
257
+ hash = {}
258
+ self.class.attribute_map.each_pair do |attr, param|
259
+ value = self.send(attr)
260
+ if value.nil?
261
+ is_nullable = self.class.openapi_nullable.include?(attr)
262
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
263
+ end
264
+
265
+ hash[param] = _to_hash(value)
266
+ end
267
+ hash
268
+ end
269
+
270
+ # Outputs non-array value in the form of hash
271
+ # For object, use to_hash. Otherwise, just return the value
272
+ # @param [Object] value Any valid value
273
+ # @return [Hash] Returns the value in the form of hash
274
+ def _to_hash(value)
275
+ if value.is_a?(Array)
276
+ value.compact.map { |v| _to_hash(v) }
277
+ elsif value.is_a?(Hash)
278
+ {}.tap do |hash|
279
+ value.each { |k, v| hash[k] = _to_hash(v) }
280
+ end
281
+ elsif value.respond_to? :to_hash
282
+ value.to_hash
283
+ else
284
+ value
285
+ end
286
+ end
287
+
288
+ end
289
+
290
+ end
@@ -0,0 +1,260 @@
1
+ =begin
2
+ #DEV.ME API Documentation
3
+
4
+ #DEV.ME API Documentation [Currency Conversion and Exchange Rates API](https://dev.me/products/currency) - [IP2Location, IP Country, IP Information API](https://dev.me/products/ip) - [Email Validation, Mailbox Verification](https://dev.me/products/email) - [Phone Number Validation](https://dev.me/products/phone). You can learn more at [dev.me](https://dev.me). For this example you can use api key `demo-key` to test the APIs
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@dev.me
8
+
9
+
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DevmeSdk
17
+ class GetIpDetailsCityOut
18
+ # Accuracy Radius
19
+ attr_accessor :accuracy_radius
20
+
21
+ # Latitude
22
+ attr_accessor :latitude
23
+
24
+ # Longitude
25
+ attr_accessor :longitude
26
+
27
+ # Time Zone
28
+ attr_accessor :time_zone
29
+
30
+ # City Name
31
+ attr_accessor :name
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'accuracy_radius' => :'accuracyRadius',
37
+ :'latitude' => :'latitude',
38
+ :'longitude' => :'longitude',
39
+ :'time_zone' => :'timeZone',
40
+ :'name' => :'name'
41
+ }
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'accuracy_radius' => :'Float',
53
+ :'latitude' => :'Float',
54
+ :'longitude' => :'String',
55
+ :'time_zone' => :'String',
56
+ :'name' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DevmeSdk::GetIpDetailsCityOut` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!self.class.attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DevmeSdk::GetIpDetailsCityOut`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'accuracy_radius')
82
+ self.accuracy_radius = attributes[:'accuracy_radius']
83
+ end
84
+
85
+ if attributes.key?(:'latitude')
86
+ self.latitude = attributes[:'latitude']
87
+ end
88
+
89
+ if attributes.key?(:'longitude')
90
+ self.longitude = attributes[:'longitude']
91
+ end
92
+
93
+ if attributes.key?(:'time_zone')
94
+ self.time_zone = attributes[:'time_zone']
95
+ end
96
+
97
+ if attributes.key?(:'name')
98
+ self.name = attributes[:'name']
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
+ accuracy_radius == o.accuracy_radius &&
121
+ latitude == o.latitude &&
122
+ longitude == o.longitude &&
123
+ time_zone == o.time_zone &&
124
+ name == o.name
125
+ end
126
+
127
+ # @see the `==` method
128
+ # @param [Object] Object to be compared
129
+ def eql?(o)
130
+ self == o
131
+ end
132
+
133
+ # Calculates hash code according to all attributes.
134
+ # @return [Integer] Hash code
135
+ def hash
136
+ [accuracy_radius, latitude, longitude, time_zone, name].hash
137
+ end
138
+
139
+ # Builds the object from hash
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ # @return [Object] Returns the model itself
142
+ def self.build_from_hash(attributes)
143
+ new.build_from_hash(attributes)
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def build_from_hash(attributes)
150
+ return nil unless attributes.is_a?(Hash)
151
+ self.class.openapi_types.each_pair do |key, type|
152
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
153
+ self.send("#{key}=", nil)
154
+ elsif type =~ /\AArray<(.*)>/i
155
+ # check to ensure the input is an array given that the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
158
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
159
+ end
160
+ elsif !attributes[self.class.attribute_map[key]].nil?
161
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
162
+ end
163
+ end
164
+
165
+ self
166
+ end
167
+
168
+ # Deserializes the data based on type
169
+ # @param string type Data type
170
+ # @param string value Value to be deserialized
171
+ # @return [Object] Deserialized data
172
+ def _deserialize(type, value)
173
+ case type.to_sym
174
+ when :Time
175
+ Time.parse(value)
176
+ when :Date
177
+ Date.parse(value)
178
+ when :String
179
+ value.to_s
180
+ when :Integer
181
+ value.to_i
182
+ when :Float
183
+ value.to_f
184
+ when :Boolean
185
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
186
+ true
187
+ else
188
+ false
189
+ end
190
+ when :Object
191
+ # generic object (usually a Hash), return directly
192
+ value
193
+ when /\AArray<(?<inner_type>.+)>\z/
194
+ inner_type = Regexp.last_match[:inner_type]
195
+ value.map { |v| _deserialize(inner_type, v) }
196
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
197
+ k_type = Regexp.last_match[:k_type]
198
+ v_type = Regexp.last_match[:v_type]
199
+ {}.tap do |hash|
200
+ value.each do |k, v|
201
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
202
+ end
203
+ end
204
+ else
205
+ # model
206
+ # models (e.g. Pet) or oneOf
207
+ klass = DevmeSdk.const_get(type)
208
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
209
+ end
210
+ end
211
+
212
+ # Returns the string representation of the object
213
+ # @return [String] String presentation of the object
214
+ def to_s
215
+ to_hash.to_s
216
+ end
217
+
218
+ # to_body is an alias to to_hash (backward compatibility)
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_body
221
+ to_hash
222
+ end
223
+
224
+ # Returns the object in the form of hash
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_hash
227
+ hash = {}
228
+ self.class.attribute_map.each_pair do |attr, param|
229
+ value = self.send(attr)
230
+ if value.nil?
231
+ is_nullable = self.class.openapi_nullable.include?(attr)
232
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
233
+ end
234
+
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ # Outputs non-array value in the form of hash
241
+ # For object, use to_hash. Otherwise, just return the value
242
+ # @param [Object] value Any valid value
243
+ # @return [Hash] Returns the value in the form of hash
244
+ def _to_hash(value)
245
+ if value.is_a?(Array)
246
+ value.compact.map { |v| _to_hash(v) }
247
+ elsif value.is_a?(Hash)
248
+ {}.tap do |hash|
249
+ value.each { |k, v| hash[k] = _to_hash(v) }
250
+ end
251
+ elsif value.respond_to? :to_hash
252
+ value.to_hash
253
+ else
254
+ value
255
+ end
256
+ end
257
+
258
+ end
259
+
260
+ end