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