talon_one 4.0.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -6
- data/docs/ActivateUserRequest.md +17 -0
- data/docs/Coupon.md +2 -2
- data/docs/CustomerInventory.md +1 -1
- data/docs/InlineResponse20044.md +1 -1
- data/docs/IntegrationApi.md +11 -11
- data/docs/IntegrationCoupon.md +2 -2
- data/docs/InventoryCoupon.md +2 -2
- data/docs/LoyaltyCardBalances.md +21 -0
- data/docs/LoyaltyCardProfileRegistration.md +1 -1
- data/docs/ManagementApi.md +187 -69
- data/docs/MessageLogEntry.md +1 -3
- data/docs/NewCoupons.md +1 -1
- data/docs/NewExternalInvitation.md +21 -0
- data/docs/UpdateCoupon.md +1 -1
- data/docs/UpdateUser.md +1 -1
- data/lib/talon_one/api/integration_api.rb +18 -18
- data/lib/talon_one/api/management_api.rb +200 -76
- data/lib/talon_one/models/activate_user_request.rb +213 -0
- data/lib/talon_one/models/additional_campaign_properties.rb +2 -2
- data/lib/talon_one/models/campaign.rb +2 -2
- data/lib/talon_one/models/coupon.rb +2 -2
- data/lib/talon_one/models/customer_inventory.rb +1 -1
- data/lib/talon_one/models/inline_response20044.rb +1 -1
- data/lib/talon_one/models/integration_coupon.rb +2 -2
- data/lib/talon_one/models/inventory_coupon.rb +2 -2
- data/lib/talon_one/models/loyalty_card_balances.rb +231 -0
- data/lib/talon_one/models/loyalty_card_profile_registration.rb +1 -1
- data/lib/talon_one/models/message_log_entry.rb +4 -14
- data/lib/talon_one/models/new_coupons.rb +1 -1
- data/lib/talon_one/models/new_external_invitation.rb +235 -0
- data/lib/talon_one/models/update_coupon.rb +1 -1
- data/lib/talon_one/models/update_user.rb +1 -1
- data/lib/talon_one/version.rb +1 -1
- data/lib/talon_one.rb +3 -0
- data/spec/api/integration_api_spec.rb +7 -7
- data/spec/api/management_api_spec.rb +43 -19
- data/spec/models/activate_user_request_spec.rb +41 -0
- data/spec/models/additional_campaign_properties_spec.rb +1 -1
- data/spec/models/campaign_spec.rb +1 -1
- data/spec/models/loyalty_card_balances_spec.rb +53 -0
- data/spec/models/message_log_entry_spec.rb +1 -7
- data/spec/models/new_external_invitation_spec.rb +53 -0
- metadata +30 -18
@@ -0,0 +1,213 @@
|
|
1
|
+
=begin
|
2
|
+
#Talon.One API
|
3
|
+
|
4
|
+
#Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) are used to integrate with our platform - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`
|
5
|
+
|
6
|
+
The version of the OpenAPI document:
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module TalonOne
|
16
|
+
#
|
17
|
+
class ActivateUserRequest
|
18
|
+
# The email address associated with the user profile.
|
19
|
+
attr_accessor :email
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'email' => :'email'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.openapi_types
|
30
|
+
{
|
31
|
+
:'email' => :'String'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# List of attributes with nullable: true
|
36
|
+
def self.openapi_nullable
|
37
|
+
Set.new([
|
38
|
+
])
|
39
|
+
end
|
40
|
+
|
41
|
+
# Initializes the object
|
42
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
43
|
+
def initialize(attributes = {})
|
44
|
+
if (!attributes.is_a?(Hash))
|
45
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::ActivateUserRequest` initialize method"
|
46
|
+
end
|
47
|
+
|
48
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
49
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
50
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
51
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::ActivateUserRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
52
|
+
end
|
53
|
+
h[k.to_sym] = v
|
54
|
+
}
|
55
|
+
|
56
|
+
if attributes.key?(:'email')
|
57
|
+
self.email = attributes[:'email']
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
62
|
+
# @return Array for valid properties with the reasons
|
63
|
+
def list_invalid_properties
|
64
|
+
invalid_properties = Array.new
|
65
|
+
if @email.nil?
|
66
|
+
invalid_properties.push('invalid value for "email", email cannot be nil.')
|
67
|
+
end
|
68
|
+
|
69
|
+
invalid_properties
|
70
|
+
end
|
71
|
+
|
72
|
+
# Check to see if the all the properties in the model are valid
|
73
|
+
# @return true if the model is valid
|
74
|
+
def valid?
|
75
|
+
return false if @email.nil?
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Checks equality by comparing each attribute.
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def ==(o)
|
82
|
+
return true if self.equal?(o)
|
83
|
+
self.class == o.class &&
|
84
|
+
email == o.email
|
85
|
+
end
|
86
|
+
|
87
|
+
# @see the `==` method
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def eql?(o)
|
90
|
+
self == o
|
91
|
+
end
|
92
|
+
|
93
|
+
# Calculates hash code according to all attributes.
|
94
|
+
# @return [Integer] Hash code
|
95
|
+
def hash
|
96
|
+
[email].hash
|
97
|
+
end
|
98
|
+
|
99
|
+
# Builds the object from hash
|
100
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
101
|
+
# @return [Object] Returns the model itself
|
102
|
+
def self.build_from_hash(attributes)
|
103
|
+
new.build_from_hash(attributes)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Builds the object from hash
|
107
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
108
|
+
# @return [Object] Returns the model itself
|
109
|
+
def build_from_hash(attributes)
|
110
|
+
return nil unless attributes.is_a?(Hash)
|
111
|
+
self.class.openapi_types.each_pair do |key, type|
|
112
|
+
if type =~ /\AArray<(.*)>/i
|
113
|
+
# check to ensure the input is an array given that the attribute
|
114
|
+
# is documented as an array but the input is not
|
115
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
116
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
117
|
+
end
|
118
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
119
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
120
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
121
|
+
end
|
122
|
+
|
123
|
+
self
|
124
|
+
end
|
125
|
+
|
126
|
+
# Deserializes the data based on type
|
127
|
+
# @param string type Data type
|
128
|
+
# @param string value Value to be deserialized
|
129
|
+
# @return [Object] Deserialized data
|
130
|
+
def _deserialize(type, value)
|
131
|
+
case type.to_sym
|
132
|
+
when :DateTime
|
133
|
+
DateTime.parse(value)
|
134
|
+
when :Date
|
135
|
+
Date.parse(value)
|
136
|
+
when :String
|
137
|
+
value.to_s
|
138
|
+
when :Integer
|
139
|
+
value.to_i
|
140
|
+
when :Float
|
141
|
+
value.to_f
|
142
|
+
when :Boolean
|
143
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
144
|
+
true
|
145
|
+
else
|
146
|
+
false
|
147
|
+
end
|
148
|
+
when :Object
|
149
|
+
# generic object (usually a Hash), return directly
|
150
|
+
value
|
151
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
152
|
+
inner_type = Regexp.last_match[:inner_type]
|
153
|
+
value.map { |v| _deserialize(inner_type, v) }
|
154
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
155
|
+
k_type = Regexp.last_match[:k_type]
|
156
|
+
v_type = Regexp.last_match[:v_type]
|
157
|
+
{}.tap do |hash|
|
158
|
+
value.each do |k, v|
|
159
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
else # model
|
163
|
+
TalonOne.const_get(type).build_from_hash(value)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# Returns the string representation of the object
|
168
|
+
# @return [String] String presentation of the object
|
169
|
+
def to_s
|
170
|
+
to_hash.to_s
|
171
|
+
end
|
172
|
+
|
173
|
+
# to_body is an alias to to_hash (backward compatibility)
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
175
|
+
def to_body
|
176
|
+
to_hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Returns the object in the form of hash
|
180
|
+
# @return [Hash] Returns the object in the form of hash
|
181
|
+
def to_hash
|
182
|
+
hash = {}
|
183
|
+
self.class.attribute_map.each_pair do |attr, param|
|
184
|
+
value = self.send(attr)
|
185
|
+
if value.nil?
|
186
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
187
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
188
|
+
end
|
189
|
+
|
190
|
+
hash[param] = _to_hash(value)
|
191
|
+
end
|
192
|
+
hash
|
193
|
+
end
|
194
|
+
|
195
|
+
# Outputs non-array value in the form of hash
|
196
|
+
# For object, use to_hash. Otherwise, just return the value
|
197
|
+
# @param [Object] value Any valid value
|
198
|
+
# @return [Hash] Returns the value in the form of hash
|
199
|
+
def _to_hash(value)
|
200
|
+
if value.is_a?(Array)
|
201
|
+
value.compact.map { |v| _to_hash(v) }
|
202
|
+
elsif value.is_a?(Hash)
|
203
|
+
{}.tap do |hash|
|
204
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
205
|
+
end
|
206
|
+
elsif value.respond_to? :to_hash
|
207
|
+
value.to_hash
|
208
|
+
else
|
209
|
+
value
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
@@ -290,7 +290,7 @@ module TalonOne
|
|
290
290
|
def valid?
|
291
291
|
return false if @budgets.nil?
|
292
292
|
return false if @frontend_state.nil?
|
293
|
-
frontend_state_validator = EnumAttributeValidator.new('String', ["expired", "scheduled", "running", "draft"])
|
293
|
+
frontend_state_validator = EnumAttributeValidator.new('String', ["expired", "scheduled", "running", "draft", "disabled", "archived"])
|
294
294
|
return false unless frontend_state_validator.valid?(@frontend_state)
|
295
295
|
true
|
296
296
|
end
|
@@ -298,7 +298,7 @@ module TalonOne
|
|
298
298
|
# Custom attribute writer method checking allowed values (enum).
|
299
299
|
# @param [Object] frontend_state Object to be assigned
|
300
300
|
def frontend_state=(frontend_state)
|
301
|
-
validator = EnumAttributeValidator.new('String', ["expired", "scheduled", "running", "draft"])
|
301
|
+
validator = EnumAttributeValidator.new('String', ["expired", "scheduled", "running", "draft", "disabled", "archived"])
|
302
302
|
unless validator.valid?(frontend_state)
|
303
303
|
fail ArgumentError, "invalid value for \"frontend_state\", must be one of #{validator.allowable_values}."
|
304
304
|
end
|
@@ -538,7 +538,7 @@ module TalonOne
|
|
538
538
|
return false unless type_validator.valid?(@type)
|
539
539
|
return false if @budgets.nil?
|
540
540
|
return false if @frontend_state.nil?
|
541
|
-
frontend_state_validator = EnumAttributeValidator.new('String', ["expired", "scheduled", "running", "draft"])
|
541
|
+
frontend_state_validator = EnumAttributeValidator.new('String', ["expired", "scheduled", "running", "draft", "disabled", "archived"])
|
542
542
|
return false unless frontend_state_validator.valid?(@frontend_state)
|
543
543
|
true
|
544
544
|
end
|
@@ -580,7 +580,7 @@ module TalonOne
|
|
580
580
|
# Custom attribute writer method checking allowed values (enum).
|
581
581
|
# @param [Object] frontend_state Object to be assigned
|
582
582
|
def frontend_state=(frontend_state)
|
583
|
-
validator = EnumAttributeValidator.new('String', ["expired", "scheduled", "running", "draft"])
|
583
|
+
validator = EnumAttributeValidator.new('String', ["expired", "scheduled", "running", "draft", "disabled", "archived"])
|
584
584
|
unless validator.valid?(frontend_state)
|
585
585
|
fail ArgumentError, "invalid value for \"frontend_state\", must be one of #{validator.allowable_values}."
|
586
586
|
end
|
@@ -69,13 +69,13 @@ module TalonOne
|
|
69
69
|
# The ID of the Import which created this coupon.
|
70
70
|
attr_accessor :import_id
|
71
71
|
|
72
|
-
# Defines the type
|
72
|
+
# Defines the reservation type: - `true`: The coupon can be reserved for multiple customers. - `false`: The coupon can be reserved only for one customer. It is a personal code.
|
73
73
|
attr_accessor :reservation
|
74
74
|
|
75
75
|
# The id of the batch the coupon belongs to.
|
76
76
|
attr_accessor :batch_id
|
77
77
|
|
78
|
-
#
|
78
|
+
# An indication of whether the code can be redeemed only if it has been reserved first.
|
79
79
|
attr_accessor :is_reservation_mandatory
|
80
80
|
|
81
81
|
# An indication of whether the coupon is implicitly reserved for all customers.
|
@@ -20,7 +20,7 @@ module TalonOne
|
|
20
20
|
|
21
21
|
attr_accessor :referrals
|
22
22
|
|
23
|
-
# The coupons reserved by this profile. This array includes hard and soft reservations.
|
23
|
+
# The coupons reserved by this profile. This array includes hard and soft reservations.
|
24
24
|
attr_accessor :coupons
|
25
25
|
|
26
26
|
attr_accessor :giveaways
|
@@ -69,13 +69,13 @@ module TalonOne
|
|
69
69
|
# The ID of the Import which created this coupon.
|
70
70
|
attr_accessor :import_id
|
71
71
|
|
72
|
-
# Defines the type
|
72
|
+
# Defines the reservation type: - `true`: The coupon can be reserved for multiple customers. - `false`: The coupon can be reserved only for one customer. It is a personal code.
|
73
73
|
attr_accessor :reservation
|
74
74
|
|
75
75
|
# The id of the batch the coupon belongs to.
|
76
76
|
attr_accessor :batch_id
|
77
77
|
|
78
|
-
#
|
78
|
+
# An indication of whether the code can be redeemed only if it has been reserved first.
|
79
79
|
attr_accessor :is_reservation_mandatory
|
80
80
|
|
81
81
|
# An indication of whether the coupon is implicitly reserved for all customers.
|
@@ -69,13 +69,13 @@ module TalonOne
|
|
69
69
|
# The ID of the Import which created this coupon.
|
70
70
|
attr_accessor :import_id
|
71
71
|
|
72
|
-
# Defines the type
|
72
|
+
# Defines the reservation type: - `true`: The coupon can be reserved for multiple customers. - `false`: The coupon can be reserved only for one customer. It is a personal code.
|
73
73
|
attr_accessor :reservation
|
74
74
|
|
75
75
|
# The id of the batch the coupon belongs to.
|
76
76
|
attr_accessor :batch_id
|
77
77
|
|
78
|
-
#
|
78
|
+
# An indication of whether the code can be redeemed only if it has been reserved first.
|
79
79
|
attr_accessor :is_reservation_mandatory
|
80
80
|
|
81
81
|
# An indication of whether the coupon is implicitly reserved for all customers.
|
@@ -0,0 +1,231 @@
|
|
1
|
+
=begin
|
2
|
+
#Talon.One API
|
3
|
+
|
4
|
+
#Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) are used to integrate with our platform - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`
|
5
|
+
|
6
|
+
The version of the OpenAPI document:
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module TalonOne
|
16
|
+
#
|
17
|
+
class LoyaltyCardBalances
|
18
|
+
attr_accessor :balance
|
19
|
+
|
20
|
+
# Map of the loyalty balances of the subledgers of a ledger.
|
21
|
+
attr_accessor :subledger_balances
|
22
|
+
|
23
|
+
# Customer profiles linked to the loyalty card.
|
24
|
+
attr_accessor :profiles
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:'balance' => :'balance',
|
30
|
+
:'subledger_balances' => :'subledgerBalances',
|
31
|
+
:'profiles' => :'profiles'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.openapi_types
|
37
|
+
{
|
38
|
+
:'balance' => :'LoyaltyBalance',
|
39
|
+
:'subledger_balances' => :'Hash<String, LoyaltyBalance>',
|
40
|
+
:'profiles' => :'Array<LoyaltyCardProfileRegistration>'
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# List of attributes with nullable: true
|
45
|
+
def self.openapi_nullable
|
46
|
+
Set.new([
|
47
|
+
])
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
if (!attributes.is_a?(Hash))
|
54
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::LoyaltyCardBalances` initialize method"
|
55
|
+
end
|
56
|
+
|
57
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
58
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
59
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
60
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::LoyaltyCardBalances`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
61
|
+
end
|
62
|
+
h[k.to_sym] = v
|
63
|
+
}
|
64
|
+
|
65
|
+
if attributes.key?(:'balance')
|
66
|
+
self.balance = attributes[:'balance']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.key?(:'subledger_balances')
|
70
|
+
if (value = attributes[:'subledger_balances']).is_a?(Hash)
|
71
|
+
self.subledger_balances = value
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
if attributes.key?(:'profiles')
|
76
|
+
if (value = attributes[:'profiles']).is_a?(Array)
|
77
|
+
self.profiles = value
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
83
|
+
# @return Array for valid properties with the reasons
|
84
|
+
def list_invalid_properties
|
85
|
+
invalid_properties = Array.new
|
86
|
+
invalid_properties
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check to see if the all the properties in the model are valid
|
90
|
+
# @return true if the model is valid
|
91
|
+
def valid?
|
92
|
+
true
|
93
|
+
end
|
94
|
+
|
95
|
+
# Checks equality by comparing each attribute.
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def ==(o)
|
98
|
+
return true if self.equal?(o)
|
99
|
+
self.class == o.class &&
|
100
|
+
balance == o.balance &&
|
101
|
+
subledger_balances == o.subledger_balances &&
|
102
|
+
profiles == o.profiles
|
103
|
+
end
|
104
|
+
|
105
|
+
# @see the `==` method
|
106
|
+
# @param [Object] Object to be compared
|
107
|
+
def eql?(o)
|
108
|
+
self == o
|
109
|
+
end
|
110
|
+
|
111
|
+
# Calculates hash code according to all attributes.
|
112
|
+
# @return [Integer] Hash code
|
113
|
+
def hash
|
114
|
+
[balance, subledger_balances, profiles].hash
|
115
|
+
end
|
116
|
+
|
117
|
+
# Builds the object from hash
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
119
|
+
# @return [Object] Returns the model itself
|
120
|
+
def self.build_from_hash(attributes)
|
121
|
+
new.build_from_hash(attributes)
|
122
|
+
end
|
123
|
+
|
124
|
+
# Builds the object from hash
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
126
|
+
# @return [Object] Returns the model itself
|
127
|
+
def build_from_hash(attributes)
|
128
|
+
return nil unless attributes.is_a?(Hash)
|
129
|
+
self.class.openapi_types.each_pair do |key, type|
|
130
|
+
if type =~ /\AArray<(.*)>/i
|
131
|
+
# check to ensure the input is an array given that the attribute
|
132
|
+
# is documented as an array but the input is not
|
133
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
134
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
135
|
+
end
|
136
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
137
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
138
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
139
|
+
end
|
140
|
+
|
141
|
+
self
|
142
|
+
end
|
143
|
+
|
144
|
+
# Deserializes the data based on type
|
145
|
+
# @param string type Data type
|
146
|
+
# @param string value Value to be deserialized
|
147
|
+
# @return [Object] Deserialized data
|
148
|
+
def _deserialize(type, value)
|
149
|
+
case type.to_sym
|
150
|
+
when :DateTime
|
151
|
+
DateTime.parse(value)
|
152
|
+
when :Date
|
153
|
+
Date.parse(value)
|
154
|
+
when :String
|
155
|
+
value.to_s
|
156
|
+
when :Integer
|
157
|
+
value.to_i
|
158
|
+
when :Float
|
159
|
+
value.to_f
|
160
|
+
when :Boolean
|
161
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
162
|
+
true
|
163
|
+
else
|
164
|
+
false
|
165
|
+
end
|
166
|
+
when :Object
|
167
|
+
# generic object (usually a Hash), return directly
|
168
|
+
value
|
169
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
170
|
+
inner_type = Regexp.last_match[:inner_type]
|
171
|
+
value.map { |v| _deserialize(inner_type, v) }
|
172
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
173
|
+
k_type = Regexp.last_match[:k_type]
|
174
|
+
v_type = Regexp.last_match[:v_type]
|
175
|
+
{}.tap do |hash|
|
176
|
+
value.each do |k, v|
|
177
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
else # model
|
181
|
+
TalonOne.const_get(type).build_from_hash(value)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
# Returns the string representation of the object
|
186
|
+
# @return [String] String presentation of the object
|
187
|
+
def to_s
|
188
|
+
to_hash.to_s
|
189
|
+
end
|
190
|
+
|
191
|
+
# to_body is an alias to to_hash (backward compatibility)
|
192
|
+
# @return [Hash] Returns the object in the form of hash
|
193
|
+
def to_body
|
194
|
+
to_hash
|
195
|
+
end
|
196
|
+
|
197
|
+
# Returns the object in the form of hash
|
198
|
+
# @return [Hash] Returns the object in the form of hash
|
199
|
+
def to_hash
|
200
|
+
hash = {}
|
201
|
+
self.class.attribute_map.each_pair do |attr, param|
|
202
|
+
value = self.send(attr)
|
203
|
+
if value.nil?
|
204
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
205
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
206
|
+
end
|
207
|
+
|
208
|
+
hash[param] = _to_hash(value)
|
209
|
+
end
|
210
|
+
hash
|
211
|
+
end
|
212
|
+
|
213
|
+
# Outputs non-array value in the form of hash
|
214
|
+
# For object, use to_hash. Otherwise, just return the value
|
215
|
+
# @param [Object] value Any valid value
|
216
|
+
# @return [Hash] Returns the value in the form of hash
|
217
|
+
def _to_hash(value)
|
218
|
+
if value.is_a?(Array)
|
219
|
+
value.compact.map { |v| _to_hash(v) }
|
220
|
+
elsif value.is_a?(Hash)
|
221
|
+
{}.tap do |hash|
|
222
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
223
|
+
end
|
224
|
+
elsif value.respond_to? :to_hash
|
225
|
+
value.to_hash
|
226
|
+
else
|
227
|
+
value
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
@@ -17,7 +17,7 @@ module TalonOne
|
|
17
17
|
# Integration ID of the customer profile linked to the card.
|
18
18
|
attr_accessor :integration_id
|
19
19
|
|
20
|
-
# Timestamp
|
20
|
+
# Timestamp the customer profile was linked to the card.
|
21
21
|
attr_accessor :timestamp
|
22
22
|
|
23
23
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -37,12 +37,9 @@ module TalonOne
|
|
37
37
|
# Timestamp when the log entry was created.
|
38
38
|
attr_accessor :created_at
|
39
39
|
|
40
|
-
# The entity type the
|
40
|
+
# The entity type the notification is related to.
|
41
41
|
attr_accessor :entity_type
|
42
42
|
|
43
|
-
# The target URL of the request.
|
44
|
-
attr_accessor :url
|
45
|
-
|
46
43
|
# Identifier of the Application.
|
47
44
|
attr_accessor :application_id
|
48
45
|
|
@@ -83,7 +80,6 @@ module TalonOne
|
|
83
80
|
:'response' => :'response',
|
84
81
|
:'created_at' => :'createdAt',
|
85
82
|
:'entity_type' => :'entityType',
|
86
|
-
:'url' => :'url',
|
87
83
|
:'application_id' => :'applicationId',
|
88
84
|
:'loyalty_program_id' => :'loyaltyProgramId'
|
89
85
|
}
|
@@ -101,7 +97,6 @@ module TalonOne
|
|
101
97
|
:'response' => :'MessageLogResponse',
|
102
98
|
:'created_at' => :'DateTime',
|
103
99
|
:'entity_type' => :'String',
|
104
|
-
:'url' => :'String',
|
105
100
|
:'application_id' => :'Integer',
|
106
101
|
:'loyalty_program_id' => :'Integer'
|
107
102
|
}
|
@@ -164,10 +159,6 @@ module TalonOne
|
|
164
159
|
self.entity_type = attributes[:'entity_type']
|
165
160
|
end
|
166
161
|
|
167
|
-
if attributes.key?(:'url')
|
168
|
-
self.url = attributes[:'url']
|
169
|
-
end
|
170
|
-
|
171
162
|
if attributes.key?(:'application_id')
|
172
163
|
self.application_id = attributes[:'application_id']
|
173
164
|
end
|
@@ -210,7 +201,7 @@ module TalonOne
|
|
210
201
|
return false if @id.nil?
|
211
202
|
return false if @service.nil?
|
212
203
|
return false if @created_at.nil?
|
213
|
-
entity_type_validator = EnumAttributeValidator.new('String', ["application", "loyalty_program"
|
204
|
+
entity_type_validator = EnumAttributeValidator.new('String', ["application", "loyalty_program"])
|
214
205
|
return false unless entity_type_validator.valid?(@entity_type)
|
215
206
|
return false if !@application_id.nil? && @application_id < 1
|
216
207
|
return false if !@loyalty_program_id.nil? && @loyalty_program_id < 1
|
@@ -220,7 +211,7 @@ module TalonOne
|
|
220
211
|
# Custom attribute writer method checking allowed values (enum).
|
221
212
|
# @param [Object] entity_type Object to be assigned
|
222
213
|
def entity_type=(entity_type)
|
223
|
-
validator = EnumAttributeValidator.new('String', ["application", "loyalty_program"
|
214
|
+
validator = EnumAttributeValidator.new('String', ["application", "loyalty_program"])
|
224
215
|
unless validator.valid?(entity_type)
|
225
216
|
fail ArgumentError, "invalid value for \"entity_type\", must be one of #{validator.allowable_values}."
|
226
217
|
end
|
@@ -261,7 +252,6 @@ module TalonOne
|
|
261
252
|
response == o.response &&
|
262
253
|
created_at == o.created_at &&
|
263
254
|
entity_type == o.entity_type &&
|
264
|
-
url == o.url &&
|
265
255
|
application_id == o.application_id &&
|
266
256
|
loyalty_program_id == o.loyalty_program_id
|
267
257
|
end
|
@@ -275,7 +265,7 @@ module TalonOne
|
|
275
265
|
# Calculates hash code according to all attributes.
|
276
266
|
# @return [Integer] Hash code
|
277
267
|
def hash
|
278
|
-
[id, service, change_type, notification_id, notification_name, request, response, created_at, entity_type,
|
268
|
+
[id, service, change_type, notification_id, notification_name, request, response, created_at, entity_type, application_id, loyalty_program_id].hash
|
279
269
|
end
|
280
270
|
|
281
271
|
# Builds the object from hash
|
@@ -51,7 +51,7 @@ module TalonOne
|
|
51
51
|
# The pattern used to generate coupon codes. The character `#` is a placeholder and is replaced by a random character from the `validCharacters` set.
|
52
52
|
attr_accessor :coupon_pattern
|
53
53
|
|
54
|
-
#
|
54
|
+
# An indication of whether the code can be redeemed only if it has been reserved first.
|
55
55
|
attr_accessor :is_reservation_mandatory
|
56
56
|
|
57
57
|
# An indication of whether the coupon is implicitly reserved for all customers.
|