ultracart_api 3.6.38 → 3.8.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,250 @@
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
+ if !@description.nil? && @description.to_s.length > 50
97
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 50.')
98
+ end
99
+
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ return false if !@description.nil? && @description.to_s.length > 50
107
+ true
108
+ end
109
+
110
+ # Custom attribute writer method with validation
111
+ # @param [Object] description Value to be assigned
112
+ def description=(description)
113
+ if !description.nil? && description.to_s.length > 50
114
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 50.'
115
+ end
116
+
117
+ @description = description
118
+ end
119
+
120
+ # Checks equality by comparing each attribute.
121
+ # @param [Object] Object to be compared
122
+ def ==(o)
123
+ return true if self.equal?(o)
124
+ self.class == o.class &&
125
+ amount == o.amount &&
126
+ description == o.description &&
127
+ entry_dts == o.entry_dts &&
128
+ gift_certificate_ledger_oid == o.gift_certificate_ledger_oid &&
129
+ gift_certificate_oid == o.gift_certificate_oid &&
130
+ reference_order_id == o.reference_order_id
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Fixnum] Hash code
141
+ def hash
142
+ [amount, description, entry_dts, gift_certificate_ledger_oid, gift_certificate_oid, reference_order_id].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def build_from_hash(attributes)
149
+ return nil unless attributes.is_a?(Hash)
150
+ self.class.swagger_types.each_pair do |key, type|
151
+ if type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the attribute
153
+ # is documented as an array but the input is not
154
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
155
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
156
+ end
157
+ elsif !attributes[self.class.attribute_map[key]].nil?
158
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
159
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
160
+ end
161
+
162
+ self
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def _deserialize(type, value)
170
+ case type.to_sym
171
+ when :DateTime
172
+ DateTime.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :BOOLEAN
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ temp_model = UltracartClient.const_get(type).new
203
+ temp_model.build_from_hash(value)
204
+ end
205
+ end
206
+
207
+ # Returns the string representation of the object
208
+ # @return [String] String presentation of the object
209
+ def to_s
210
+ to_hash.to_s
211
+ end
212
+
213
+ # to_body is an alias to to_hash (backward compatibility)
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_body
216
+ to_hash
217
+ end
218
+
219
+ # Returns the object in the form of hash
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_hash
222
+ hash = {}
223
+ self.class.attribute_map.each_pair do |attr, param|
224
+ value = self.send(attr)
225
+ next if value.nil?
226
+ hash[param] = _to_hash(value)
227
+ end
228
+ hash
229
+ end
230
+
231
+ # Outputs non-array value in the form of hash
232
+ # For object, use to_hash. Otherwise, just return the value
233
+ # @param [Object] value Any valid value
234
+ # @return [Hash] Returns the value in the form of hash
235
+ def _to_hash(value)
236
+ if value.is_a?(Array)
237
+ value.compact.map { |v| _to_hash(v) }
238
+ elsif value.is_a?(Hash)
239
+ {}.tap do |hash|
240
+ value.each { |k, v| hash[k] = _to_hash(v) }
241
+ end
242
+ elsif value.respond_to? :to_hash
243
+ value.to_hash
244
+ else
245
+ value
246
+ end
247
+ end
248
+
249
+ end
250
+ 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