boxx_client 1.4.1

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