app_token_api 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -7
  3. data/app_token_api.gemspec +1 -1
  4. data/lib/admin_api/api/app_token_api.rb +2 -2
  5. data/lib/admin_api/api/auto_generate_app_token_api.rb +2 -2
  6. data/lib/admin_api/api/card_api.rb +371 -0
  7. data/lib/admin_api/api/client_api.rb +368 -0
  8. data/lib/admin_api/api_client.rb +2 -2
  9. data/lib/admin_api/api_error.rb +1 -1
  10. data/lib/admin_api/auth_configuration.rb +4 -4
  11. data/lib/admin_api/configuration.rb +2 -2
  12. data/lib/admin_api/models/app_token.rb +1 -1
  13. data/lib/admin_api/models/card.rb +499 -0
  14. data/lib/admin_api/models/card_address.rb +271 -0
  15. data/lib/admin_api/models/client.rb +557 -0
  16. data/lib/admin_api/models/client_address.rb +281 -0
  17. data/lib/admin_api/models/employment.rb +216 -0
  18. data/lib/admin_api/models/page_card.rb +261 -0
  19. data/lib/admin_api/models/page_client.rb +261 -0
  20. data/lib/admin_api/models/sort.rb +236 -0
  21. data/lib/admin_api/version.rb +2 -2
  22. data/lib/admin_api.rb +1 -1
  23. data/spec/api/app_token_api_spec.rb +1 -1
  24. data/spec/api/card_api_spec.rb +88 -0
  25. data/spec/api/client_api_spec.rb +20 -27
  26. data/spec/api_client_spec.rb +1 -1
  27. data/spec/configuration_spec.rb +4 -4
  28. data/spec/models/app_token_spec.rb +1 -1
  29. data/spec/models/card_address_spec.rb +77 -0
  30. data/spec/models/card_spec.rb +215 -0
  31. data/spec/models/client_address_spec.rb +83 -0
  32. data/spec/models/client_spec.rb +162 -6
  33. data/spec/models/employment_spec.rb +59 -0
  34. data/spec/models/page_card_spec.rb +89 -0
  35. data/spec/models/page_client_spec.rb +1 -1
  36. data/spec/models/sort_spec.rb +1 -1
  37. data/spec/spec_helper.rb +1 -1
  38. metadata +24 -2
@@ -0,0 +1,271 @@
1
+ =begin
2
+ #Hydrogen Admin API
3
+
4
+ #The Hydrogen Admin API
5
+
6
+ OpenAPI spec version: 1.0.2
7
+ Contact: info@hydrogenplatform.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module AdminApi
16
+ # CardAddress Object
17
+ class CardAddress
18
+ # addressLine1
19
+ attr_accessor :address_line1
20
+
21
+ # addressLine2
22
+ attr_accessor :address_line2
23
+
24
+ # city
25
+ attr_accessor :city
26
+
27
+ # country
28
+ attr_accessor :country
29
+
30
+ # postalcode
31
+ attr_accessor :postalcode
32
+
33
+ # state
34
+ attr_accessor :state
35
+
36
+ # type
37
+ attr_accessor :type
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'address_line1' => :'address_line1',
43
+ :'address_line2' => :'address_line2',
44
+ :'city' => :'city',
45
+ :'country' => :'country',
46
+ :'postalcode' => :'postalcode',
47
+ :'state' => :'state',
48
+ :'type' => :'type'
49
+ }
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.swagger_types
54
+ {
55
+ :'address_line1' => :'String',
56
+ :'address_line2' => :'String',
57
+ :'city' => :'String',
58
+ :'country' => :'String',
59
+ :'postalcode' => :'String',
60
+ :'state' => :'String',
61
+ :'type' => :'String'
62
+ }
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ return unless attributes.is_a?(Hash)
69
+
70
+ # convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
72
+
73
+ if attributes.has_key?(:'address_line1')
74
+ self.address_line1 = attributes[:'address_line1']
75
+ end
76
+
77
+ if attributes.has_key?(:'address_line2')
78
+ self.address_line2 = attributes[:'address_line2']
79
+ end
80
+
81
+ if attributes.has_key?(:'city')
82
+ self.city = attributes[:'city']
83
+ end
84
+
85
+ if attributes.has_key?(:'country')
86
+ self.country = attributes[:'country']
87
+ end
88
+
89
+ if attributes.has_key?(:'postalcode')
90
+ self.postalcode = attributes[:'postalcode']
91
+ end
92
+
93
+ if attributes.has_key?(:'state')
94
+ self.state = attributes[:'state']
95
+ end
96
+
97
+ if attributes.has_key?(:'type')
98
+ self.type = attributes[:'type']
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
+ if @address_line1.nil?
107
+ invalid_properties.push('invalid value for "address_line1", address_line1 cannot be nil.')
108
+ end
109
+
110
+ if @city.nil?
111
+ invalid_properties.push('invalid value for "city", city cannot be nil.')
112
+ end
113
+
114
+ if @country.nil?
115
+ invalid_properties.push('invalid value for "country", country cannot be nil.')
116
+ end
117
+
118
+ if @state.nil?
119
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
120
+ end
121
+
122
+ if @type.nil?
123
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
124
+ end
125
+
126
+ invalid_properties
127
+ end
128
+
129
+ # Check to see if the all the properties in the model are valid
130
+ # @return true if the model is valid
131
+ def valid?
132
+ return false if @address_line1.nil?
133
+ return false if @city.nil?
134
+ return false if @country.nil?
135
+ return false if @state.nil?
136
+ return false if @type.nil?
137
+ true
138
+ end
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] Object to be compared
142
+ def ==(o)
143
+ return true if self.equal?(o)
144
+ self.class == o.class &&
145
+ address_line1 == o.address_line1 &&
146
+ address_line2 == o.address_line2 &&
147
+ city == o.city &&
148
+ country == o.country &&
149
+ postalcode == o.postalcode &&
150
+ state == o.state &&
151
+ type == o.type
152
+ end
153
+
154
+ # @see the `==` method
155
+ # @param [Object] Object to be compared
156
+ def eql?(o)
157
+ self == o
158
+ end
159
+
160
+ # Calculates hash code according to all attributes.
161
+ # @return [Fixnum] Hash code
162
+ def hash
163
+ [address_line1, address_line2, city, country, postalcode, state, type].hash
164
+ end
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def build_from_hash(attributes)
170
+ return nil unless attributes.is_a?(Hash)
171
+ self.class.swagger_types.each_pair do |key, type|
172
+ if type =~ /\AArray<(.*)>/i
173
+ # check to ensure the input is an array given that the attribute
174
+ # is documented as an array but the input is not
175
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
176
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
177
+ end
178
+ elsif !attributes[self.class.attribute_map[key]].nil?
179
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
180
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
181
+ end
182
+
183
+ self
184
+ end
185
+
186
+ # Deserializes the data based on type
187
+ # @param string type Data type
188
+ # @param string value Value to be deserialized
189
+ # @return [Object] Deserialized data
190
+ def _deserialize(type, value)
191
+ case type.to_sym
192
+ when :DateTime
193
+ DateTime.parse(value)
194
+ when :Date
195
+ Date.parse(value)
196
+ when :String
197
+ value.to_s
198
+ when :Integer
199
+ value.to_i
200
+ when :Float
201
+ value.to_f
202
+ when :BOOLEAN
203
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
204
+ true
205
+ else
206
+ false
207
+ end
208
+ when :Object
209
+ # generic object (usually a Hash), return directly
210
+ value
211
+ when /\AArray<(?<inner_type>.+)>\z/
212
+ inner_type = Regexp.last_match[:inner_type]
213
+ value.map { |v| _deserialize(inner_type, v) }
214
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
215
+ k_type = Regexp.last_match[:k_type]
216
+ v_type = Regexp.last_match[:v_type]
217
+ {}.tap do |hash|
218
+ value.each do |k, v|
219
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
220
+ end
221
+ end
222
+ else # model
223
+ temp_model = AdminApi.const_get(type).new
224
+ temp_model.build_from_hash(value)
225
+ end
226
+ end
227
+
228
+ # Returns the string representation of the object
229
+ # @return [String] String presentation of the object
230
+ def to_s
231
+ to_hash.to_s
232
+ end
233
+
234
+ # to_body is an alias to to_hash (backward compatibility)
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_body
237
+ to_hash
238
+ end
239
+
240
+ # Returns the object in the form of hash
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_hash
243
+ hash = {}
244
+ self.class.attribute_map.each_pair do |attr, param|
245
+ value = self.send(attr)
246
+ next if value.nil?
247
+ hash[param] = _to_hash(value)
248
+ end
249
+ hash
250
+ end
251
+
252
+ # Outputs non-array value in the form of hash
253
+ # For object, use to_hash. Otherwise, just return the value
254
+ # @param [Object] value Any valid value
255
+ # @return [Hash] Returns the value in the form of hash
256
+ def _to_hash(value)
257
+ if value.is_a?(Array)
258
+ value.compact.map { |v| _to_hash(v) }
259
+ elsif value.is_a?(Hash)
260
+ {}.tap do |hash|
261
+ value.each { |k, v| hash[k] = _to_hash(v) }
262
+ end
263
+ elsif value.respond_to? :to_hash
264
+ value.to_hash
265
+ else
266
+ value
267
+ end
268
+ end
269
+
270
+ end
271
+ end