ultracart_api 4.1.134 → 4.1.136

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,250 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class AdjustLoyaltyPointsRequest
18
+ # Description of this adjustment, 200 characters max
19
+ attr_accessor :description
20
+
21
+ # The number of loyalty points to add to the ledger. Use a negative number to debit points. Required and may not be zero.
22
+ attr_accessor :loyalty_points
23
+
24
+ # Optional order id if this adjustment is related to a particular order
25
+ attr_accessor :order_id
26
+
27
+ # Optional days required for this adjustment to vest. Leave null to use the merchant configured default. Use zero for immediate vesting.
28
+ attr_accessor :vesting_days
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'description' => :'description',
34
+ :'loyalty_points' => :'loyalty_points',
35
+ :'order_id' => :'order_id',
36
+ :'vesting_days' => :'vesting_days'
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'description' => :'String',
49
+ :'loyalty_points' => :'Integer',
50
+ :'order_id' => :'String',
51
+ :'vesting_days' => :'Integer'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::AdjustLoyaltyPointsRequest` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::AdjustLoyaltyPointsRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'description')
77
+ self.description = attributes[:'description']
78
+ end
79
+
80
+ if attributes.key?(:'loyalty_points')
81
+ self.loyalty_points = attributes[:'loyalty_points']
82
+ end
83
+
84
+ if attributes.key?(:'order_id')
85
+ self.order_id = attributes[:'order_id']
86
+ end
87
+
88
+ if attributes.key?(:'vesting_days')
89
+ self.vesting_days = attributes[:'vesting_days']
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = Array.new
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ description == o.description &&
112
+ loyalty_points == o.loyalty_points &&
113
+ order_id == o.order_id &&
114
+ vesting_days == o.vesting_days
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Integer] Hash code
125
+ def hash
126
+ [description, loyalty_points, order_id, vesting_days].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def self.build_from_hash(attributes)
133
+ new.build_from_hash(attributes)
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ attributes = attributes.transform_keys(&:to_sym)
142
+ self.class.openapi_types.each_pair do |key, type|
143
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
144
+ self.send("#{key}=", nil)
145
+ elsif type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
149
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
150
+ end
151
+ elsif !attributes[self.class.attribute_map[key]].nil?
152
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
153
+ end
154
+ end
155
+
156
+ self
157
+ end
158
+
159
+ # Deserializes the data based on type
160
+ # @param string type Data type
161
+ # @param string value Value to be deserialized
162
+ # @return [Object] Deserialized data
163
+ def _deserialize(type, value)
164
+ case type.to_sym
165
+ when :Time
166
+ Time.parse(value)
167
+ when :Date
168
+ Date.parse(value)
169
+ when :String
170
+ value.to_s
171
+ when :Integer
172
+ value.to_i
173
+ when :Float
174
+ value.to_f
175
+ when :Boolean
176
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
177
+ true
178
+ else
179
+ false
180
+ end
181
+ when :Object
182
+ # generic object (usually a Hash), return directly
183
+ value
184
+ when /\AArray<(?<inner_type>.+)>\z/
185
+ inner_type = Regexp.last_match[:inner_type]
186
+ value.map { |v| _deserialize(inner_type, v) }
187
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
188
+ k_type = Regexp.last_match[:k_type]
189
+ v_type = Regexp.last_match[:v_type]
190
+ {}.tap do |hash|
191
+ value.each do |k, v|
192
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
193
+ end
194
+ end
195
+ else # model
196
+ # models (e.g. Pet) or oneOf
197
+ klass = UltracartClient.const_get(type)
198
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ if value.nil?
221
+ is_nullable = self.class.openapi_nullable.include?(attr)
222
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
+ end
224
+
225
+ hash[param] = _to_hash(value)
226
+ end
227
+ hash
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map { |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+
248
+ end
249
+
250
+ end
@@ -0,0 +1,277 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class AdjustLoyaltyPointsResponse
18
+ # The current (vested) points balance after the adjustment was made
19
+ attr_accessor :current_points
20
+
21
+ attr_accessor :error
22
+
23
+ # The loyalty points adjustment that was written to the ledger
24
+ attr_accessor :loyalty_points
25
+
26
+ attr_accessor :metadata
27
+
28
+ # The pending (unvested) points balance after the adjustment was made
29
+ attr_accessor :pending_points
30
+
31
+ # Indicates if API call was successful
32
+ attr_accessor :success
33
+
34
+ attr_accessor :warning
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'current_points' => :'current_points',
40
+ :'error' => :'error',
41
+ :'loyalty_points' => :'loyalty_points',
42
+ :'metadata' => :'metadata',
43
+ :'pending_points' => :'pending_points',
44
+ :'success' => :'success',
45
+ :'warning' => :'warning'
46
+ }
47
+ end
48
+
49
+ # Returns all the JSON keys this model knows about
50
+ def self.acceptable_attributes
51
+ attribute_map.values
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'current_points' => :'Integer',
58
+ :'error' => :'Error',
59
+ :'loyalty_points' => :'Integer',
60
+ :'metadata' => :'ResponseMetadata',
61
+ :'pending_points' => :'Integer',
62
+ :'success' => :'Boolean',
63
+ :'warning' => :'Warning'
64
+ }
65
+ end
66
+
67
+ # List of attributes with nullable: true
68
+ def self.openapi_nullable
69
+ Set.new([
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::AdjustLoyaltyPointsResponse` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!self.class.attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::AdjustLoyaltyPointsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'current_points')
89
+ self.current_points = attributes[:'current_points']
90
+ end
91
+
92
+ if attributes.key?(:'error')
93
+ self.error = attributes[:'error']
94
+ end
95
+
96
+ if attributes.key?(:'loyalty_points')
97
+ self.loyalty_points = attributes[:'loyalty_points']
98
+ end
99
+
100
+ if attributes.key?(:'metadata')
101
+ self.metadata = attributes[:'metadata']
102
+ end
103
+
104
+ if attributes.key?(:'pending_points')
105
+ self.pending_points = attributes[:'pending_points']
106
+ end
107
+
108
+ if attributes.key?(:'success')
109
+ self.success = attributes[:'success']
110
+ end
111
+
112
+ if attributes.key?(:'warning')
113
+ self.warning = attributes[:'warning']
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ invalid_properties = Array.new
121
+ invalid_properties
122
+ end
123
+
124
+ # Check to see if the all the properties in the model are valid
125
+ # @return true if the model is valid
126
+ def valid?
127
+ true
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ current_points == o.current_points &&
136
+ error == o.error &&
137
+ loyalty_points == o.loyalty_points &&
138
+ metadata == o.metadata &&
139
+ pending_points == o.pending_points &&
140
+ success == o.success &&
141
+ warning == o.warning
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 [Integer] Hash code
152
+ def hash
153
+ [current_points, error, loyalty_points, metadata, pending_points, success, warning].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 self.build_from_hash(attributes)
160
+ new.build_from_hash(attributes)
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def build_from_hash(attributes)
167
+ return nil unless attributes.is_a?(Hash)
168
+ attributes = attributes.transform_keys(&:to_sym)
169
+ self.class.openapi_types.each_pair do |key, type|
170
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
171
+ self.send("#{key}=", nil)
172
+ elsif type =~ /\AArray<(.*)>/i
173
+ # check to ensure the input is an array given that the attribute
174
+ # is documented as an array but the input is not
175
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
176
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
177
+ end
178
+ elsif !attributes[self.class.attribute_map[key]].nil?
179
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
180
+ end
181
+ end
182
+
183
+ self
184
+ end
185
+
186
+ # Deserializes the data based on type
187
+ # @param string type Data type
188
+ # @param string value Value to be deserialized
189
+ # @return [Object] Deserialized data
190
+ def _deserialize(type, value)
191
+ case type.to_sym
192
+ when :Time
193
+ Time.parse(value)
194
+ when :Date
195
+ Date.parse(value)
196
+ when :String
197
+ value.to_s
198
+ when :Integer
199
+ value.to_i
200
+ when :Float
201
+ value.to_f
202
+ when :Boolean
203
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
204
+ true
205
+ else
206
+ false
207
+ end
208
+ when :Object
209
+ # generic object (usually a Hash), return directly
210
+ value
211
+ when /\AArray<(?<inner_type>.+)>\z/
212
+ inner_type = Regexp.last_match[:inner_type]
213
+ value.map { |v| _deserialize(inner_type, v) }
214
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
215
+ k_type = Regexp.last_match[:k_type]
216
+ v_type = Regexp.last_match[:v_type]
217
+ {}.tap do |hash|
218
+ value.each do |k, v|
219
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
220
+ end
221
+ end
222
+ else # model
223
+ # models (e.g. Pet) or oneOf
224
+ klass = UltracartClient.const_get(type)
225
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
226
+ end
227
+ end
228
+
229
+ # Returns the string representation of the object
230
+ # @return [String] String presentation of the object
231
+ def to_s
232
+ to_hash.to_s
233
+ end
234
+
235
+ # to_body is an alias to to_hash (backward compatibility)
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_body
238
+ to_hash
239
+ end
240
+
241
+ # Returns the object in the form of hash
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_hash
244
+ hash = {}
245
+ self.class.attribute_map.each_pair do |attr, param|
246
+ value = self.send(attr)
247
+ if value.nil?
248
+ is_nullable = self.class.openapi_nullable.include?(attr)
249
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
250
+ end
251
+
252
+ hash[param] = _to_hash(value)
253
+ end
254
+ hash
255
+ end
256
+
257
+ # Outputs non-array value in the form of hash
258
+ # For object, use to_hash. Otherwise, just return the value
259
+ # @param [Object] value Any valid value
260
+ # @return [Hash] Returns the value in the form of hash
261
+ def _to_hash(value)
262
+ if value.is_a?(Array)
263
+ value.compact.map { |v| _to_hash(v) }
264
+ elsif value.is_a?(Hash)
265
+ {}.tap do |hash|
266
+ value.each { |k, v| hash[k] = _to_hash(v) }
267
+ end
268
+ elsif value.respond_to? :to_hash
269
+ value.to_hash
270
+ else
271
+ value
272
+ end
273
+ end
274
+
275
+ end
276
+
277
+ end
@@ -24,6 +24,9 @@ module UltracartClient
24
24
  # Digits
25
25
  attr_accessor :digits
26
26
 
27
+ # Optional phone number to send the text message from. Must be a phone number configured on this merchant account and SMS enabled. Defaults to the number the caller dialed. Only used when the action is 'send text'.
28
+ attr_accessor :sms_from_number
29
+
27
30
  # Speech
28
31
  attr_accessor :speech
29
32
 
@@ -58,6 +61,7 @@ module UltracartClient
58
61
  :'action' => :'action',
59
62
  :'action_target' => :'action_target',
60
63
  :'digits' => :'digits',
64
+ :'sms_from_number' => :'sms_from_number',
61
65
  :'speech' => :'speech',
62
66
  :'text_message' => :'text_message'
63
67
  }
@@ -74,6 +78,7 @@ module UltracartClient
74
78
  :'action' => :'String',
75
79
  :'action_target' => :'String',
76
80
  :'digits' => :'Integer',
81
+ :'sms_from_number' => :'String',
77
82
  :'speech' => :'String',
78
83
  :'text_message' => :'String'
79
84
  }
@@ -112,6 +117,10 @@ module UltracartClient
112
117
  self.digits = attributes[:'digits']
113
118
  end
114
119
 
120
+ if attributes.key?(:'sms_from_number')
121
+ self.sms_from_number = attributes[:'sms_from_number']
122
+ end
123
+
115
124
  if attributes.key?(:'speech')
116
125
  self.speech = attributes[:'speech']
117
126
  end
@@ -133,6 +142,10 @@ module UltracartClient
133
142
  invalid_properties.push('invalid value for "action_target", the character length must be smaller than or equal to 50.')
134
143
  end
135
144
 
145
+ if !@sms_from_number.nil? && @sms_from_number.to_s.length > 25
146
+ invalid_properties.push('invalid value for "sms_from_number", the character length must be smaller than or equal to 25.')
147
+ end
148
+
136
149
  if !@text_message.nil? && @text_message.to_s.length > 1600
137
150
  invalid_properties.push('invalid value for "text_message", the character length must be smaller than or equal to 1600.')
138
151
  end
@@ -147,6 +160,7 @@ module UltracartClient
147
160
  return false unless action_validator.valid?(@action)
148
161
  return false if !@action.nil? && @action.to_s.length > 30
149
162
  return false if !@action_target.nil? && @action_target.to_s.length > 50
163
+ return false if !@sms_from_number.nil? && @sms_from_number.to_s.length > 25
150
164
  return false if !@text_message.nil? && @text_message.to_s.length > 1600
151
165
  true
152
166
  end
@@ -171,6 +185,16 @@ module UltracartClient
171
185
  @action_target = action_target
172
186
  end
173
187
 
188
+ # Custom attribute writer method with validation
189
+ # @param [Object] sms_from_number Value to be assigned
190
+ def sms_from_number=(sms_from_number)
191
+ if !sms_from_number.nil? && sms_from_number.to_s.length > 25
192
+ fail ArgumentError, 'invalid value for "sms_from_number", the character length must be smaller than or equal to 25.'
193
+ end
194
+
195
+ @sms_from_number = sms_from_number
196
+ end
197
+
174
198
  # Custom attribute writer method with validation
175
199
  # @param [Object] text_message Value to be assigned
176
200
  def text_message=(text_message)
@@ -189,6 +213,7 @@ module UltracartClient
189
213
  action == o.action &&
190
214
  action_target == o.action_target &&
191
215
  digits == o.digits &&
216
+ sms_from_number == o.sms_from_number &&
192
217
  speech == o.speech &&
193
218
  text_message == o.text_message
194
219
  end
@@ -202,7 +227,7 @@ module UltracartClient
202
227
  # Calculates hash code according to all attributes.
203
228
  # @return [Integer] Hash code
204
229
  def hash
205
- [action, action_target, digits, speech, text_message].hash
230
+ [action, action_target, digits, sms_from_number, speech, text_message].hash
206
231
  end
207
232
 
208
233
  # Builds the object from hash