ultracart_api 3.7.38 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,235 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class GiftCertificateLedgerEntry
17
+ # The amount of the activity.
18
+ attr_accessor :amount
19
+
20
+ # Description of what this ledger entry is used.
21
+ attr_accessor :description
22
+
23
+ # Date time of this ledger activity.
24
+ attr_accessor :entry_dts
25
+
26
+ # Gift certificate ledger oid is a primary key for this object, used internally.
27
+ attr_accessor :gift_certificate_ledger_oid
28
+
29
+ # Gift certificate oid.
30
+ attr_accessor :gift_certificate_oid
31
+
32
+ # The order id if this gift certificate was used as part of the payment.
33
+ attr_accessor :reference_order_id
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'amount' => :'amount',
39
+ :'description' => :'description',
40
+ :'entry_dts' => :'entry_dts',
41
+ :'gift_certificate_ledger_oid' => :'gift_certificate_ledger_oid',
42
+ :'gift_certificate_oid' => :'gift_certificate_oid',
43
+ :'reference_order_id' => :'reference_order_id'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ :'amount' => :'Float',
51
+ :'description' => :'String',
52
+ :'entry_dts' => :'String',
53
+ :'gift_certificate_ledger_oid' => :'Integer',
54
+ :'gift_certificate_oid' => :'Integer',
55
+ :'reference_order_id' => :'String'
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?(:'amount')
68
+ self.amount = attributes[:'amount']
69
+ end
70
+
71
+ if attributes.has_key?(:'description')
72
+ self.description = attributes[:'description']
73
+ end
74
+
75
+ if attributes.has_key?(:'entry_dts')
76
+ self.entry_dts = attributes[:'entry_dts']
77
+ end
78
+
79
+ if attributes.has_key?(:'gift_certificate_ledger_oid')
80
+ self.gift_certificate_ledger_oid = attributes[:'gift_certificate_ledger_oid']
81
+ end
82
+
83
+ if attributes.has_key?(:'gift_certificate_oid')
84
+ self.gift_certificate_oid = attributes[:'gift_certificate_oid']
85
+ end
86
+
87
+ if attributes.has_key?(:'reference_order_id')
88
+ self.reference_order_id = attributes[:'reference_order_id']
89
+ end
90
+ end
91
+
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properties with the reasons
94
+ def list_invalid_properties
95
+ invalid_properties = Array.new
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ amount == o.amount &&
111
+ description == o.description &&
112
+ entry_dts == o.entry_dts &&
113
+ gift_certificate_ledger_oid == o.gift_certificate_ledger_oid &&
114
+ gift_certificate_oid == o.gift_certificate_oid &&
115
+ reference_order_id == o.reference_order_id
116
+ end
117
+
118
+ # @see the `==` method
119
+ # @param [Object] Object to be compared
120
+ def eql?(o)
121
+ self == o
122
+ end
123
+
124
+ # Calculates hash code according to all attributes.
125
+ # @return [Fixnum] Hash code
126
+ def hash
127
+ [amount, description, entry_dts, gift_certificate_ledger_oid, gift_certificate_oid, reference_order_id].hash
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ self.class.swagger_types.each_pair do |key, type|
136
+ if type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
140
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
141
+ end
142
+ elsif !attributes[self.class.attribute_map[key]].nil?
143
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
145
+ end
146
+
147
+ self
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def _deserialize(type, value)
155
+ case type.to_sym
156
+ when :DateTime
157
+ DateTime.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :BOOLEAN
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ temp_model = UltracartClient.const_get(type).new
188
+ temp_model.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ next if value.nil?
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+
234
+ end
235
+ end
@@ -0,0 +1,265 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class GiftCertificateQuery
17
+ # Gift certificate code
18
+ attr_accessor :code
19
+
20
+ # Email address of this gift certificate
21
+ attr_accessor :email
22
+
23
+ # Expiration date end
24
+ attr_accessor :expiration_dts_end
25
+
26
+ # Expiration date start
27
+ attr_accessor :expiration_dts_start
28
+
29
+ # Original balance end
30
+ attr_accessor :original_balance_end
31
+
32
+ # Original balance start
33
+ attr_accessor :original_balance_start
34
+
35
+ # Gift certificate reference order id
36
+ attr_accessor :reference_order_id
37
+
38
+ # Remaining balance end
39
+ attr_accessor :remaining_balance_end
40
+
41
+ # Remaining balance start
42
+ attr_accessor :remaining_balance_start
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'code' => :'code',
48
+ :'email' => :'email',
49
+ :'expiration_dts_end' => :'expiration_dts_end',
50
+ :'expiration_dts_start' => :'expiration_dts_start',
51
+ :'original_balance_end' => :'original_balance_end',
52
+ :'original_balance_start' => :'original_balance_start',
53
+ :'reference_order_id' => :'reference_order_id',
54
+ :'remaining_balance_end' => :'remaining_balance_end',
55
+ :'remaining_balance_start' => :'remaining_balance_start'
56
+ }
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.swagger_types
61
+ {
62
+ :'code' => :'String',
63
+ :'email' => :'String',
64
+ :'expiration_dts_end' => :'String',
65
+ :'expiration_dts_start' => :'String',
66
+ :'original_balance_end' => :'Float',
67
+ :'original_balance_start' => :'Float',
68
+ :'reference_order_id' => :'String',
69
+ :'remaining_balance_end' => :'Float',
70
+ :'remaining_balance_start' => :'Float'
71
+ }
72
+ end
73
+
74
+ # Initializes the object
75
+ # @param [Hash] attributes Model attributes in the form of hash
76
+ def initialize(attributes = {})
77
+ return unless attributes.is_a?(Hash)
78
+
79
+ # convert string to symbol for hash key
80
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
81
+
82
+ if attributes.has_key?(:'code')
83
+ self.code = attributes[:'code']
84
+ end
85
+
86
+ if attributes.has_key?(:'email')
87
+ self.email = attributes[:'email']
88
+ end
89
+
90
+ if attributes.has_key?(:'expiration_dts_end')
91
+ self.expiration_dts_end = attributes[:'expiration_dts_end']
92
+ end
93
+
94
+ if attributes.has_key?(:'expiration_dts_start')
95
+ self.expiration_dts_start = attributes[:'expiration_dts_start']
96
+ end
97
+
98
+ if attributes.has_key?(:'original_balance_end')
99
+ self.original_balance_end = attributes[:'original_balance_end']
100
+ end
101
+
102
+ if attributes.has_key?(:'original_balance_start')
103
+ self.original_balance_start = attributes[:'original_balance_start']
104
+ end
105
+
106
+ if attributes.has_key?(:'reference_order_id')
107
+ self.reference_order_id = attributes[:'reference_order_id']
108
+ end
109
+
110
+ if attributes.has_key?(:'remaining_balance_end')
111
+ self.remaining_balance_end = attributes[:'remaining_balance_end']
112
+ end
113
+
114
+ if attributes.has_key?(:'remaining_balance_start')
115
+ self.remaining_balance_start = attributes[:'remaining_balance_start']
116
+ end
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properties with the reasons
121
+ def list_invalid_properties
122
+ invalid_properties = Array.new
123
+ invalid_properties
124
+ end
125
+
126
+ # Check to see if the all the properties in the model are valid
127
+ # @return true if the model is valid
128
+ def valid?
129
+ true
130
+ end
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] Object to be compared
134
+ def ==(o)
135
+ return true if self.equal?(o)
136
+ self.class == o.class &&
137
+ code == o.code &&
138
+ email == o.email &&
139
+ expiration_dts_end == o.expiration_dts_end &&
140
+ expiration_dts_start == o.expiration_dts_start &&
141
+ original_balance_end == o.original_balance_end &&
142
+ original_balance_start == o.original_balance_start &&
143
+ reference_order_id == o.reference_order_id &&
144
+ remaining_balance_end == o.remaining_balance_end &&
145
+ remaining_balance_start == o.remaining_balance_start
146
+ end
147
+
148
+ # @see the `==` method
149
+ # @param [Object] Object to be compared
150
+ def eql?(o)
151
+ self == o
152
+ end
153
+
154
+ # Calculates hash code according to all attributes.
155
+ # @return [Fixnum] Hash code
156
+ def hash
157
+ [code, email, expiration_dts_end, expiration_dts_start, original_balance_end, original_balance_start, reference_order_id, remaining_balance_end, remaining_balance_start].hash
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ self.class.swagger_types.each_pair do |key, type|
166
+ if type =~ /\AArray<(.*)>/i
167
+ # check to ensure the input is an array given that the attribute
168
+ # is documented as an array but the input is not
169
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
170
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
171
+ end
172
+ elsif !attributes[self.class.attribute_map[key]].nil?
173
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
174
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
175
+ end
176
+
177
+ self
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param string type Data type
182
+ # @param string value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def _deserialize(type, value)
185
+ case type.to_sym
186
+ when :DateTime
187
+ DateTime.parse(value)
188
+ when :Date
189
+ Date.parse(value)
190
+ when :String
191
+ value.to_s
192
+ when :Integer
193
+ value.to_i
194
+ when :Float
195
+ value.to_f
196
+ when :BOOLEAN
197
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
198
+ true
199
+ else
200
+ false
201
+ end
202
+ when :Object
203
+ # generic object (usually a Hash), return directly
204
+ value
205
+ when /\AArray<(?<inner_type>.+)>\z/
206
+ inner_type = Regexp.last_match[:inner_type]
207
+ value.map { |v| _deserialize(inner_type, v) }
208
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
209
+ k_type = Regexp.last_match[:k_type]
210
+ v_type = Regexp.last_match[:v_type]
211
+ {}.tap do |hash|
212
+ value.each do |k, v|
213
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
214
+ end
215
+ end
216
+ else # model
217
+ temp_model = UltracartClient.const_get(type).new
218
+ temp_model.build_from_hash(value)
219
+ end
220
+ end
221
+
222
+ # Returns the string representation of the object
223
+ # @return [String] String presentation of the object
224
+ def to_s
225
+ to_hash.to_s
226
+ end
227
+
228
+ # to_body is an alias to to_hash (backward compatibility)
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_body
231
+ to_hash
232
+ end
233
+
234
+ # Returns the object in the form of hash
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_hash
237
+ hash = {}
238
+ self.class.attribute_map.each_pair do |attr, param|
239
+ value = self.send(attr)
240
+ next if value.nil?
241
+ hash[param] = _to_hash(value)
242
+ end
243
+ hash
244
+ end
245
+
246
+ # Outputs non-array value in the form of hash
247
+ # For object, use to_hash. Otherwise, just return the value
248
+ # @param [Object] value Any valid value
249
+ # @return [Hash] Returns the value in the form of hash
250
+ def _to_hash(value)
251
+ if value.is_a?(Array)
252
+ value.compact.map { |v| _to_hash(v) }
253
+ elsif value.is_a?(Hash)
254
+ {}.tap do |hash|
255
+ value.each { |k, v| hash[k] = _to_hash(v) }
256
+ end
257
+ elsif value.respond_to? :to_hash
258
+ value.to_hash
259
+ else
260
+ value
261
+ end
262
+ end
263
+
264
+ end
265
+ end