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,281 @@
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
+ # ClientAddress Object
17
+ class ClientAddress
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
+ # is_primary
31
+ attr_accessor :is_primary
32
+
33
+ # postalcode
34
+ attr_accessor :postalcode
35
+
36
+ # state
37
+ attr_accessor :state
38
+
39
+ # type
40
+ attr_accessor :type
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'address_line1' => :'address_line1',
46
+ :'address_line2' => :'address_line2',
47
+ :'city' => :'city',
48
+ :'country' => :'country',
49
+ :'is_primary' => :'is_primary',
50
+ :'postalcode' => :'postalcode',
51
+ :'state' => :'state',
52
+ :'type' => :'type'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'address_line1' => :'String',
60
+ :'address_line2' => :'String',
61
+ :'city' => :'String',
62
+ :'country' => :'String',
63
+ :'is_primary' => :'BOOLEAN',
64
+ :'postalcode' => :'String',
65
+ :'state' => :'String',
66
+ :'type' => :'String'
67
+ }
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ return unless attributes.is_a?(Hash)
74
+
75
+ # convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
77
+
78
+ if attributes.has_key?(:'address_line1')
79
+ self.address_line1 = attributes[:'address_line1']
80
+ end
81
+
82
+ if attributes.has_key?(:'address_line2')
83
+ self.address_line2 = attributes[:'address_line2']
84
+ end
85
+
86
+ if attributes.has_key?(:'city')
87
+ self.city = attributes[:'city']
88
+ end
89
+
90
+ if attributes.has_key?(:'country')
91
+ self.country = attributes[:'country']
92
+ end
93
+
94
+ if attributes.has_key?(:'is_primary')
95
+ self.is_primary = attributes[:'is_primary']
96
+ end
97
+
98
+ if attributes.has_key?(:'postalcode')
99
+ self.postalcode = attributes[:'postalcode']
100
+ end
101
+
102
+ if attributes.has_key?(:'state')
103
+ self.state = attributes[:'state']
104
+ end
105
+
106
+ if attributes.has_key?(:'type')
107
+ self.type = attributes[:'type']
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ invalid_properties = Array.new
115
+ if @address_line1.nil?
116
+ invalid_properties.push('invalid value for "address_line1", address_line1 cannot be nil.')
117
+ end
118
+
119
+ if @city.nil?
120
+ invalid_properties.push('invalid value for "city", city cannot be nil.')
121
+ end
122
+
123
+ if @country.nil?
124
+ invalid_properties.push('invalid value for "country", country cannot be nil.')
125
+ end
126
+
127
+ if @state.nil?
128
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
129
+ end
130
+
131
+ if @type.nil?
132
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
133
+ end
134
+
135
+ invalid_properties
136
+ end
137
+
138
+ # Check to see if the all the properties in the model are valid
139
+ # @return true if the model is valid
140
+ def valid?
141
+ return false if @address_line1.nil?
142
+ return false if @city.nil?
143
+ return false if @country.nil?
144
+ return false if @state.nil?
145
+ return false if @type.nil?
146
+ true
147
+ end
148
+
149
+ # Checks equality by comparing each attribute.
150
+ # @param [Object] Object to be compared
151
+ def ==(o)
152
+ return true if self.equal?(o)
153
+ self.class == o.class &&
154
+ address_line1 == o.address_line1 &&
155
+ address_line2 == o.address_line2 &&
156
+ city == o.city &&
157
+ country == o.country &&
158
+ is_primary == o.is_primary &&
159
+ postalcode == o.postalcode &&
160
+ state == o.state &&
161
+ type == o.type
162
+ end
163
+
164
+ # @see the `==` method
165
+ # @param [Object] Object to be compared
166
+ def eql?(o)
167
+ self == o
168
+ end
169
+
170
+ # Calculates hash code according to all attributes.
171
+ # @return [Fixnum] Hash code
172
+ def hash
173
+ [address_line1, address_line2, city, country, is_primary, postalcode, state, type].hash
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.swagger_types.each_pair do |key, type|
182
+ if type =~ /\AArray<(.*)>/i
183
+ # check to ensure the input is an array given that the attribute
184
+ # is documented as an array but the input is not
185
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
186
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
187
+ end
188
+ elsif !attributes[self.class.attribute_map[key]].nil?
189
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
190
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
191
+ end
192
+
193
+ self
194
+ end
195
+
196
+ # Deserializes the data based on type
197
+ # @param string type Data type
198
+ # @param string value Value to be deserialized
199
+ # @return [Object] Deserialized data
200
+ def _deserialize(type, value)
201
+ case type.to_sym
202
+ when :DateTime
203
+ DateTime.parse(value)
204
+ when :Date
205
+ Date.parse(value)
206
+ when :String
207
+ value.to_s
208
+ when :Integer
209
+ value.to_i
210
+ when :Float
211
+ value.to_f
212
+ when :BOOLEAN
213
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
214
+ true
215
+ else
216
+ false
217
+ end
218
+ when :Object
219
+ # generic object (usually a Hash), return directly
220
+ value
221
+ when /\AArray<(?<inner_type>.+)>\z/
222
+ inner_type = Regexp.last_match[:inner_type]
223
+ value.map { |v| _deserialize(inner_type, v) }
224
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
225
+ k_type = Regexp.last_match[:k_type]
226
+ v_type = Regexp.last_match[:v_type]
227
+ {}.tap do |hash|
228
+ value.each do |k, v|
229
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
230
+ end
231
+ end
232
+ else # model
233
+ temp_model = AdminApi.const_get(type).new
234
+ temp_model.build_from_hash(value)
235
+ end
236
+ end
237
+
238
+ # Returns the string representation of the object
239
+ # @return [String] String presentation of the object
240
+ def to_s
241
+ to_hash.to_s
242
+ end
243
+
244
+ # to_body is an alias to to_hash (backward compatibility)
245
+ # @return [Hash] Returns the object in the form of hash
246
+ def to_body
247
+ to_hash
248
+ end
249
+
250
+ # Returns the object in the form of hash
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_hash
253
+ hash = {}
254
+ self.class.attribute_map.each_pair do |attr, param|
255
+ value = self.send(attr)
256
+ next if value.nil?
257
+ hash[param] = _to_hash(value)
258
+ end
259
+ hash
260
+ end
261
+
262
+ # Outputs non-array value in the form of hash
263
+ # For object, use to_hash. Otherwise, just return the value
264
+ # @param [Object] value Any valid value
265
+ # @return [Hash] Returns the value in the form of hash
266
+ def _to_hash(value)
267
+ if value.is_a?(Array)
268
+ value.compact.map { |v| _to_hash(v) }
269
+ elsif value.is_a?(Hash)
270
+ {}.tap do |hash|
271
+ value.each { |k, v| hash[k] = _to_hash(v) }
272
+ end
273
+ elsif value.respond_to? :to_hash
274
+ value.to_hash
275
+ else
276
+ value
277
+ end
278
+ end
279
+
280
+ end
281
+ end
@@ -0,0 +1,216 @@
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
+ # Employment Object
17
+ class Employment
18
+ # employer
19
+ attr_accessor :employer
20
+
21
+ # employmentStatus
22
+ attr_accessor :employment_status
23
+
24
+ # jobTitle
25
+ attr_accessor :job_title
26
+
27
+ # occupation
28
+ attr_accessor :occupation
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'employer' => :'employer',
34
+ :'employment_status' => :'employment_status',
35
+ :'job_title' => :'job_title',
36
+ :'occupation' => :'occupation'
37
+ }
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.swagger_types
42
+ {
43
+ :'employer' => :'String',
44
+ :'employment_status' => :'String',
45
+ :'job_title' => :'String',
46
+ :'occupation' => :'String'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'employer')
59
+ self.employer = attributes[:'employer']
60
+ end
61
+
62
+ if attributes.has_key?(:'employment_status')
63
+ self.employment_status = attributes[:'employment_status']
64
+ end
65
+
66
+ if attributes.has_key?(:'job_title')
67
+ self.job_title = attributes[:'job_title']
68
+ end
69
+
70
+ if attributes.has_key?(:'occupation')
71
+ self.occupation = attributes[:'occupation']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ employer == o.employer &&
94
+ employment_status == o.employment_status &&
95
+ job_title == o.job_title &&
96
+ occupation == o.occupation
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Fixnum] Hash code
107
+ def hash
108
+ [employer, employment_status, job_title, occupation].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+ self.class.swagger_types.each_pair do |key, type|
117
+ if type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
121
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
122
+ end
123
+ elsif !attributes[self.class.attribute_map[key]].nil?
124
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
125
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
126
+ end
127
+
128
+ self
129
+ end
130
+
131
+ # Deserializes the data based on type
132
+ # @param string type Data type
133
+ # @param string value Value to be deserialized
134
+ # @return [Object] Deserialized data
135
+ def _deserialize(type, value)
136
+ case type.to_sym
137
+ when :DateTime
138
+ DateTime.parse(value)
139
+ when :Date
140
+ Date.parse(value)
141
+ when :String
142
+ value.to_s
143
+ when :Integer
144
+ value.to_i
145
+ when :Float
146
+ value.to_f
147
+ when :BOOLEAN
148
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
149
+ true
150
+ else
151
+ false
152
+ end
153
+ when :Object
154
+ # generic object (usually a Hash), return directly
155
+ value
156
+ when /\AArray<(?<inner_type>.+)>\z/
157
+ inner_type = Regexp.last_match[:inner_type]
158
+ value.map { |v| _deserialize(inner_type, v) }
159
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160
+ k_type = Regexp.last_match[:k_type]
161
+ v_type = Regexp.last_match[:v_type]
162
+ {}.tap do |hash|
163
+ value.each do |k, v|
164
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
+ end
166
+ end
167
+ else # model
168
+ temp_model = AdminApi.const_get(type).new
169
+ temp_model.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ next if value.nil?
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+ end