boxx_client 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/README.md +109 -0
- data/Rakefile +8 -0
- data/boxx_client.gemspec +46 -0
- data/dist/boxx_client-1.4.0.gem +0 -0
- data/dist/examples/upload_customer.rb +76 -0
- data/dist/examples/upload_product.rb +54 -0
- data/dist/examples/upload_transaction.rb +56 -0
- data/docs/DeleteAll.md +10 -0
- data/docs/DeleteAllApi.md +56 -0
- data/docs/DeleteSpecific.md +11 -0
- data/docs/DeleteSpecificApi.md +56 -0
- data/docs/InlineResponse200.md +9 -0
- data/docs/InlineResponse2001.md +9 -0
- data/docs/InlineResponse2001Response.md +9 -0
- data/docs/InlineResponse200Response.md +11 -0
- data/docs/InlineResponse400.md +9 -0
- data/docs/InlineResponse4001.md +9 -0
- data/docs/UploadCustomer.md +14 -0
- data/docs/UploadCustomerDeviceTokens.md +11 -0
- data/docs/UploadCustomerMobileTokens.md +10 -0
- data/docs/UploadCustomerRequest.md +11 -0
- data/docs/UploadDataApi.md +149 -0
- data/docs/UploadOkResponse.md +9 -0
- data/docs/UploadOkResponseResult.md +11 -0
- data/docs/UploadProduct.md +13 -0
- data/docs/UploadProductRequest.md +11 -0
- data/docs/UploadTransaction.md +16 -0
- data/docs/UploadTransactionRequest.md +11 -0
- data/git_push.sh +55 -0
- data/lib/boxx_client.rb +60 -0
- data/lib/boxx_client/api/delete_all_api.rb +78 -0
- data/lib/boxx_client/api/delete_specific_api.rb +78 -0
- data/lib/boxx_client/api/upload_data_api.rb +188 -0
- data/lib/boxx_client/api_client.rb +388 -0
- data/lib/boxx_client/api_error.rb +38 -0
- data/lib/boxx_client/configuration.rb +202 -0
- data/lib/boxx_client/models/delete_all.rb +224 -0
- data/lib/boxx_client/models/delete_specific.rb +241 -0
- data/lib/boxx_client/models/inline_response_200.rb +197 -0
- data/lib/boxx_client/models/inline_response_200_1.rb +197 -0
- data/lib/boxx_client/models/inline_response_200_1_response.rb +199 -0
- data/lib/boxx_client/models/inline_response_200_response.rb +217 -0
- data/lib/boxx_client/models/inline_response_400.rb +197 -0
- data/lib/boxx_client/models/inline_response_400_1.rb +197 -0
- data/lib/boxx_client/models/upload_customer.rb +255 -0
- data/lib/boxx_client/models/upload_customer_device_tokens.rb +215 -0
- data/lib/boxx_client/models/upload_customer_mobile_tokens.rb +206 -0
- data/lib/boxx_client/models/upload_customer_request.rb +236 -0
- data/lib/boxx_client/models/upload_ok_response.rb +197 -0
- data/lib/boxx_client/models/upload_ok_response_result.rb +217 -0
- data/lib/boxx_client/models/upload_product.rb +244 -0
- data/lib/boxx_client/models/upload_product_request.rb +236 -0
- data/lib/boxx_client/models/upload_transaction.rb +279 -0
- data/lib/boxx_client/models/upload_transaction_request.rb +236 -0
- data/lib/boxx_client/version.rb +15 -0
- data/spec/api/delete_all_api_spec.rb +47 -0
- data/spec/api/delete_specific_api_spec.rb +47 -0
- data/spec/api/upload_data_api_spec.rb +71 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/delete_all_spec.rb +54 -0
- data/spec/models/delete_specific_spec.rb +60 -0
- data/spec/models/inline_response_200_1_response_spec.rb +48 -0
- data/spec/models/inline_response_200_1_spec.rb +48 -0
- data/spec/models/inline_response_200_response_spec.rb +60 -0
- data/spec/models/inline_response_200_spec.rb +48 -0
- data/spec/models/inline_response_400_1_spec.rb +48 -0
- data/spec/models/inline_response_400_spec.rb +48 -0
- data/spec/models/upload_customer_device_tokens_spec.rb +60 -0
- data/spec/models/upload_customer_mobile_tokens_spec.rb +54 -0
- data/spec/models/upload_customer_request_spec.rb +60 -0
- data/spec/models/upload_customer_spec.rb +78 -0
- data/spec/models/upload_ok_response_result_spec.rb +60 -0
- data/spec/models/upload_ok_response_spec.rb +48 -0
- data/spec/models/upload_product_request_spec.rb +60 -0
- data/spec/models/upload_product_spec.rb +72 -0
- data/spec/models/upload_transaction_request_spec.rb +60 -0
- data/spec/models/upload_transaction_spec.rb +90 -0
- data/spec/spec_helper.rb +111 -0
- metadata +327 -0
@@ -0,0 +1,197 @@
|
|
1
|
+
=begin
|
2
|
+
#Upload and Delete Data API
|
3
|
+
|
4
|
+
#Boxx.ai's customer, product and interaction data ingestion sdk
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.4.1
|
7
|
+
Contact: aida@boxx.ai
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module BoxxClient
|
16
|
+
# upload ok response
|
17
|
+
class UploadOkResponse
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
attr_accessor :result
|
21
|
+
|
22
|
+
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
24
|
+
def self.attribute_map
|
25
|
+
{
|
26
|
+
:'status' => :'status',
|
27
|
+
:'result' => :'result'
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Attribute type mapping.
|
32
|
+
def self.swagger_types
|
33
|
+
{
|
34
|
+
:'status' => :'Integer',
|
35
|
+
:'result' => :'UploadOkResponseResult'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Initializes the object
|
40
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
41
|
+
def initialize(attributes = {})
|
42
|
+
return unless attributes.is_a?(Hash)
|
43
|
+
|
44
|
+
# convert string to symbol for hash key
|
45
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
46
|
+
|
47
|
+
if attributes.has_key?(:'status')
|
48
|
+
self.status = attributes[:'status']
|
49
|
+
end
|
50
|
+
|
51
|
+
if attributes.has_key?(:'result')
|
52
|
+
self.result = attributes[:'result']
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
58
|
+
# @return Array for valid properties with the reasons
|
59
|
+
def list_invalid_properties
|
60
|
+
invalid_properties = Array.new
|
61
|
+
return invalid_properties
|
62
|
+
end
|
63
|
+
|
64
|
+
# Check to see if the all the properties in the model are valid
|
65
|
+
# @return true if the model is valid
|
66
|
+
def valid?
|
67
|
+
return true
|
68
|
+
end
|
69
|
+
|
70
|
+
# Checks equality by comparing each attribute.
|
71
|
+
# @param [Object] Object to be compared
|
72
|
+
def ==(o)
|
73
|
+
return true if self.equal?(o)
|
74
|
+
self.class == o.class &&
|
75
|
+
status == o.status &&
|
76
|
+
result == o.result
|
77
|
+
end
|
78
|
+
|
79
|
+
# @see the `==` method
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def eql?(o)
|
82
|
+
self == o
|
83
|
+
end
|
84
|
+
|
85
|
+
# Calculates hash code according to all attributes.
|
86
|
+
# @return [Fixnum] Hash code
|
87
|
+
def hash
|
88
|
+
[status, result].hash
|
89
|
+
end
|
90
|
+
|
91
|
+
# Builds the object from hash
|
92
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
93
|
+
# @return [Object] Returns the model itself
|
94
|
+
def build_from_hash(attributes)
|
95
|
+
return nil unless attributes.is_a?(Hash)
|
96
|
+
self.class.swagger_types.each_pair do |key, type|
|
97
|
+
if type =~ /\AArray<(.*)>/i
|
98
|
+
# check to ensure the input is an array given that the the attribute
|
99
|
+
# is documented as an array but the input is not
|
100
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
101
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
102
|
+
end
|
103
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
104
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
105
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
106
|
+
end
|
107
|
+
|
108
|
+
self
|
109
|
+
end
|
110
|
+
|
111
|
+
# Deserializes the data based on type
|
112
|
+
# @param string type Data type
|
113
|
+
# @param string value Value to be deserialized
|
114
|
+
# @return [Object] Deserialized data
|
115
|
+
def _deserialize(type, value)
|
116
|
+
case type.to_sym
|
117
|
+
when :DateTime
|
118
|
+
DateTime.parse(value)
|
119
|
+
when :Date
|
120
|
+
Date.parse(value)
|
121
|
+
when :String
|
122
|
+
value.to_s
|
123
|
+
when :Integer
|
124
|
+
value.to_i
|
125
|
+
when :Float
|
126
|
+
value.to_f
|
127
|
+
when :BOOLEAN
|
128
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
129
|
+
true
|
130
|
+
else
|
131
|
+
false
|
132
|
+
end
|
133
|
+
when :Object
|
134
|
+
# generic object (usually a Hash), return directly
|
135
|
+
value
|
136
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
137
|
+
inner_type = Regexp.last_match[:inner_type]
|
138
|
+
value.map { |v| _deserialize(inner_type, v) }
|
139
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
140
|
+
k_type = Regexp.last_match[:k_type]
|
141
|
+
v_type = Regexp.last_match[:v_type]
|
142
|
+
{}.tap do |hash|
|
143
|
+
value.each do |k, v|
|
144
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
else # model
|
148
|
+
temp_model = BoxxClient.const_get(type).new
|
149
|
+
temp_model.build_from_hash(value)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Returns the string representation of the object
|
154
|
+
# @return [String] String presentation of the object
|
155
|
+
def to_s
|
156
|
+
to_hash.to_s
|
157
|
+
end
|
158
|
+
|
159
|
+
# to_body is an alias to to_hash (backward compatibility)
|
160
|
+
# @return [Hash] Returns the object in the form of hash
|
161
|
+
def to_body
|
162
|
+
to_hash
|
163
|
+
end
|
164
|
+
|
165
|
+
# Returns the object in the form of hash
|
166
|
+
# @return [Hash] Returns the object in the form of hash
|
167
|
+
def to_hash
|
168
|
+
hash = {}
|
169
|
+
self.class.attribute_map.each_pair do |attr, param|
|
170
|
+
value = self.send(attr)
|
171
|
+
next if value.nil?
|
172
|
+
hash[param] = _to_hash(value)
|
173
|
+
end
|
174
|
+
hash
|
175
|
+
end
|
176
|
+
|
177
|
+
# Outputs non-array value in the form of hash
|
178
|
+
# For object, use to_hash. Otherwise, just return the value
|
179
|
+
# @param [Object] value Any valid value
|
180
|
+
# @return [Hash] Returns the value in the form of hash
|
181
|
+
def _to_hash(value)
|
182
|
+
if value.is_a?(Array)
|
183
|
+
value.compact.map{ |v| _to_hash(v) }
|
184
|
+
elsif value.is_a?(Hash)
|
185
|
+
{}.tap do |hash|
|
186
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
187
|
+
end
|
188
|
+
elsif value.respond_to? :to_hash
|
189
|
+
value.to_hash
|
190
|
+
else
|
191
|
+
value
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
@@ -0,0 +1,217 @@
|
|
1
|
+
=begin
|
2
|
+
#Upload and Delete Data API
|
3
|
+
|
4
|
+
#Boxx.ai's customer, product and interaction data ingestion sdk
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.4.1
|
7
|
+
Contact: aida@boxx.ai
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module BoxxClient
|
16
|
+
|
17
|
+
class UploadOkResponseResult
|
18
|
+
attr_accessor :total
|
19
|
+
|
20
|
+
attr_accessor :failed
|
21
|
+
|
22
|
+
attr_accessor :inserted
|
23
|
+
|
24
|
+
attr_accessor :updated
|
25
|
+
|
26
|
+
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
+
def self.attribute_map
|
29
|
+
{
|
30
|
+
:'total' => :'total',
|
31
|
+
:'failed' => :'failed',
|
32
|
+
:'inserted' => :'inserted',
|
33
|
+
:'updated' => :'updated'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.swagger_types
|
39
|
+
{
|
40
|
+
:'total' => :'Integer',
|
41
|
+
:'failed' => :'Array<String>',
|
42
|
+
:'inserted' => :'Integer',
|
43
|
+
:'updated' => :'Integer'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# Initializes the object
|
48
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
49
|
+
def initialize(attributes = {})
|
50
|
+
return unless attributes.is_a?(Hash)
|
51
|
+
|
52
|
+
# convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
54
|
+
|
55
|
+
if attributes.has_key?(:'total')
|
56
|
+
self.total = attributes[:'total']
|
57
|
+
end
|
58
|
+
|
59
|
+
if attributes.has_key?(:'failed')
|
60
|
+
if (value = attributes[:'failed']).is_a?(Array)
|
61
|
+
self.failed = value
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.has_key?(:'inserted')
|
66
|
+
self.inserted = attributes[:'inserted']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.has_key?(:'updated')
|
70
|
+
self.updated = attributes[:'updated']
|
71
|
+
end
|
72
|
+
|
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
|
+
return 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
|
+
return 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
|
+
total == o.total &&
|
94
|
+
failed == o.failed &&
|
95
|
+
inserted == o.inserted &&
|
96
|
+
updated == o.updated
|
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
|
+
[total, failed, inserted, updated].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 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 = BoxxClient.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
|
+
|
217
|
+
end
|
@@ -0,0 +1,244 @@
|
|
1
|
+
=begin
|
2
|
+
#Upload and Delete Data API
|
3
|
+
|
4
|
+
#Boxx.ai's customer, product and interaction data ingestion sdk
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.4.1
|
7
|
+
Contact: aida@boxx.ai
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module BoxxClient
|
16
|
+
# Upload data product schema
|
17
|
+
class UploadProduct
|
18
|
+
attr_accessor :productid
|
19
|
+
|
20
|
+
attr_accessor :active
|
21
|
+
|
22
|
+
attr_accessor :start_date
|
23
|
+
|
24
|
+
attr_accessor :end_date
|
25
|
+
|
26
|
+
attr_accessor :location
|
27
|
+
|
28
|
+
attr_accessor :properties
|
29
|
+
|
30
|
+
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
+
def self.attribute_map
|
33
|
+
{
|
34
|
+
:'productid' => :'productid',
|
35
|
+
:'active' => :'active',
|
36
|
+
:'start_date' => :'start_date',
|
37
|
+
:'end_date' => :'end_date',
|
38
|
+
:'location' => :'location',
|
39
|
+
:'properties' => :'properties'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# Attribute type mapping.
|
44
|
+
def self.swagger_types
|
45
|
+
{
|
46
|
+
:'productid' => :'String',
|
47
|
+
:'active' => :'BOOLEAN',
|
48
|
+
:'start_date' => :'String',
|
49
|
+
:'end_date' => :'String',
|
50
|
+
:'location' => :'Array<String>',
|
51
|
+
:'properties' => :'Hash<String, Object>'
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
# Initializes the object
|
56
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
57
|
+
def initialize(attributes = {})
|
58
|
+
return unless attributes.is_a?(Hash)
|
59
|
+
|
60
|
+
# convert string to symbol for hash key
|
61
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
62
|
+
|
63
|
+
if attributes.has_key?(:'productid')
|
64
|
+
self.productid = attributes[:'productid']
|
65
|
+
end
|
66
|
+
|
67
|
+
if attributes.has_key?(:'active')
|
68
|
+
self.active = attributes[:'active']
|
69
|
+
else
|
70
|
+
self.active = false
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.has_key?(:'start_date')
|
74
|
+
self.start_date = attributes[:'start_date']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.has_key?(:'end_date')
|
78
|
+
self.end_date = attributes[:'end_date']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.has_key?(:'location')
|
82
|
+
if (value = attributes[:'location']).is_a?(Array)
|
83
|
+
self.location = value
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.has_key?(:'properties')
|
88
|
+
if (value = attributes[:'properties']).is_a?(Hash)
|
89
|
+
self.properties = value
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
96
|
+
# @return Array for valid properties with the reasons
|
97
|
+
def list_invalid_properties
|
98
|
+
invalid_properties = Array.new
|
99
|
+
if @productid.nil?
|
100
|
+
invalid_properties.push("invalid value for 'productid', productid cannot be nil.")
|
101
|
+
end
|
102
|
+
|
103
|
+
return invalid_properties
|
104
|
+
end
|
105
|
+
|
106
|
+
# Check to see if the all the properties in the model are valid
|
107
|
+
# @return true if the model is valid
|
108
|
+
def valid?
|
109
|
+
return false if @productid.nil?
|
110
|
+
return true
|
111
|
+
end
|
112
|
+
|
113
|
+
# Checks equality by comparing each attribute.
|
114
|
+
# @param [Object] Object to be compared
|
115
|
+
def ==(o)
|
116
|
+
return true if self.equal?(o)
|
117
|
+
self.class == o.class &&
|
118
|
+
productid == o.productid &&
|
119
|
+
active == o.active &&
|
120
|
+
start_date == o.start_date &&
|
121
|
+
end_date == o.end_date &&
|
122
|
+
location == o.location &&
|
123
|
+
properties == o.properties
|
124
|
+
end
|
125
|
+
|
126
|
+
# @see the `==` method
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def eql?(o)
|
129
|
+
self == o
|
130
|
+
end
|
131
|
+
|
132
|
+
# Calculates hash code according to all attributes.
|
133
|
+
# @return [Fixnum] Hash code
|
134
|
+
def hash
|
135
|
+
[productid, active, start_date, end_date, location, properties].hash
|
136
|
+
end
|
137
|
+
|
138
|
+
# Builds the object from hash
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
140
|
+
# @return [Object] Returns the model itself
|
141
|
+
def build_from_hash(attributes)
|
142
|
+
return nil unless attributes.is_a?(Hash)
|
143
|
+
self.class.swagger_types.each_pair do |key, type|
|
144
|
+
if type =~ /\AArray<(.*)>/i
|
145
|
+
# check to ensure the input is an array given that the the attribute
|
146
|
+
# is documented as an array but the input is not
|
147
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
148
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
149
|
+
end
|
150
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
151
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
152
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
153
|
+
end
|
154
|
+
|
155
|
+
self
|
156
|
+
end
|
157
|
+
|
158
|
+
# Deserializes the data based on type
|
159
|
+
# @param string type Data type
|
160
|
+
# @param string value Value to be deserialized
|
161
|
+
# @return [Object] Deserialized data
|
162
|
+
def _deserialize(type, value)
|
163
|
+
case type.to_sym
|
164
|
+
when :DateTime
|
165
|
+
DateTime.parse(value)
|
166
|
+
when :Date
|
167
|
+
Date.parse(value)
|
168
|
+
when :String
|
169
|
+
value.to_s
|
170
|
+
when :Integer
|
171
|
+
value.to_i
|
172
|
+
when :Float
|
173
|
+
value.to_f
|
174
|
+
when :BOOLEAN
|
175
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
176
|
+
true
|
177
|
+
else
|
178
|
+
false
|
179
|
+
end
|
180
|
+
when :Object
|
181
|
+
# generic object (usually a Hash), return directly
|
182
|
+
value
|
183
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
184
|
+
inner_type = Regexp.last_match[:inner_type]
|
185
|
+
value.map { |v| _deserialize(inner_type, v) }
|
186
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
187
|
+
k_type = Regexp.last_match[:k_type]
|
188
|
+
v_type = Regexp.last_match[:v_type]
|
189
|
+
{}.tap do |hash|
|
190
|
+
value.each do |k, v|
|
191
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
else # model
|
195
|
+
temp_model = BoxxClient.const_get(type).new
|
196
|
+
temp_model.build_from_hash(value)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
# Returns the string representation of the object
|
201
|
+
# @return [String] String presentation of the object
|
202
|
+
def to_s
|
203
|
+
to_hash.to_s
|
204
|
+
end
|
205
|
+
|
206
|
+
# to_body is an alias to to_hash (backward compatibility)
|
207
|
+
# @return [Hash] Returns the object in the form of hash
|
208
|
+
def to_body
|
209
|
+
to_hash
|
210
|
+
end
|
211
|
+
|
212
|
+
# Returns the object in the form of hash
|
213
|
+
# @return [Hash] Returns the object in the form of hash
|
214
|
+
def to_hash
|
215
|
+
hash = {}
|
216
|
+
self.class.attribute_map.each_pair do |attr, param|
|
217
|
+
value = self.send(attr)
|
218
|
+
next if value.nil?
|
219
|
+
hash[param] = _to_hash(value)
|
220
|
+
end
|
221
|
+
hash
|
222
|
+
end
|
223
|
+
|
224
|
+
# Outputs non-array value in the form of hash
|
225
|
+
# For object, use to_hash. Otherwise, just return the value
|
226
|
+
# @param [Object] value Any valid value
|
227
|
+
# @return [Hash] Returns the value in the form of hash
|
228
|
+
def _to_hash(value)
|
229
|
+
if value.is_a?(Array)
|
230
|
+
value.compact.map{ |v| _to_hash(v) }
|
231
|
+
elsif value.is_a?(Hash)
|
232
|
+
{}.tap do |hash|
|
233
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
234
|
+
end
|
235
|
+
elsif value.respond_to? :to_hash
|
236
|
+
value.to_hash
|
237
|
+
else
|
238
|
+
value
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|