talon_one 2.3.0 → 2.4.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 +31 -5
- data/docs/ApplicationCampaignStats.md +27 -0
- data/docs/ApplicationReferee.md +27 -0
- data/docs/AwardGiveawayEffectProps.md +25 -0
- data/docs/Campaign.md +2 -0
- data/docs/Coupon.md +1 -1
- data/docs/CustomEffect.md +41 -0
- data/docs/CustomEffectProps.md +19 -0
- data/docs/CustomerInventory.md +4 -2
- data/docs/CustomerProfileIntegrationRequestV2.md +1 -1
- data/docs/Environment.md +10 -0
- data/docs/Giveaway.md +33 -0
- data/docs/GiveawaysPool.md +33 -0
- data/docs/ImportEntity.md +17 -0
- data/docs/InlineResponse20010.md +3 -3
- data/docs/InlineResponse20011.md +4 -2
- data/docs/InlineResponse20012.md +2 -4
- data/docs/InlineResponse20013.md +3 -3
- data/docs/InlineResponse20014.md +2 -2
- data/docs/InlineResponse20015.md +2 -2
- data/docs/InlineResponse20016.md +3 -3
- data/docs/InlineResponse20017.md +2 -2
- data/docs/InlineResponse20018.md +3 -3
- data/docs/InlineResponse20019.md +5 -3
- data/docs/InlineResponse20020.md +2 -2
- data/docs/InlineResponse20021.md +1 -1
- data/docs/InlineResponse20022.md +1 -1
- data/docs/InlineResponse20023.md +1 -1
- data/docs/InlineResponse20024.md +1 -1
- data/docs/InlineResponse20025.md +1 -1
- data/docs/InlineResponse20026.md +1 -1
- data/docs/InlineResponse20027.md +4 -2
- data/docs/InlineResponse20028.md +2 -4
- data/docs/InlineResponse20029.md +1 -1
- data/docs/InlineResponse2006.md +2 -2
- data/docs/InlineResponse2007.md +3 -3
- data/docs/InlineResponse2008.md +1 -1
- data/docs/InlineResponse2009.md +2 -2
- data/docs/{InlineResponse20030.md → InlineResponse201.md} +3 -3
- data/docs/IntegrationApi.md +77 -11
- data/docs/IntegrationRequest.md +1 -1
- data/docs/IntegrationStateV2.md +3 -1
- data/docs/InventoryCoupon.md +53 -0
- data/docs/LoyaltyProgram.md +3 -1
- data/docs/LoyaltyProgramEntity.md +17 -0
- data/docs/LoyaltyTier.md +25 -0
- data/docs/ManagementApi.md +370 -69
- data/docs/NewCustomEffect.md +29 -0
- data/docs/NewGiveawaysPool.md +21 -0
- data/docs/NewLoyaltyTier.md +19 -0
- data/docs/NewReferral.md +10 -6
- data/docs/NewReferralsForMultipleAdvocates.md +31 -0
- data/docs/NewRole.md +1 -1
- data/docs/Referral.md +13 -7
- data/docs/ReferralConstraints.md +21 -0
- data/docs/Role.md +8 -4
- data/docs/UpdateCustomEffect.md +29 -0
- data/docs/UpdateLoyaltyTier.md +19 -0
- data/docs/UpdateReferral.md +25 -0
- data/docs/UpdateRole.md +1 -1
- data/docs/WillAwardGiveawayEffectProps.md +21 -0
- data/lib/talon_one.rb +21 -1
- data/lib/talon_one/api/integration_api.rb +80 -10
- data/lib/talon_one/api/management_api.rb +460 -97
- data/lib/talon_one/models/application_campaign_stats.rb +288 -0
- data/lib/talon_one/models/application_referee.rb +288 -0
- data/lib/talon_one/models/attribute.rb +2 -2
- data/lib/talon_one/models/award_giveaway_effect_props.rb +273 -0
- data/lib/talon_one/models/campaign.rb +11 -1
- data/lib/talon_one/models/coupon.rb +1 -1
- data/lib/talon_one/models/custom_effect.rb +377 -0
- data/lib/talon_one/models/custom_effect_props.rb +228 -0
- data/lib/talon_one/models/customer_inventory.rb +15 -4
- data/lib/talon_one/models/customer_profile_integration_request_v2.rb +1 -1
- data/lib/talon_one/models/environment.rb +61 -1
- data/lib/talon_one/models/export.rb +2 -2
- data/lib/talon_one/models/giveaway.rb +308 -0
- data/lib/talon_one/models/giveaways_pool.rb +315 -0
- data/lib/talon_one/models/import_entity.rb +207 -0
- data/lib/talon_one/models/inline_response20010.rb +11 -11
- data/lib/talon_one/models/inline_response20011.rb +11 -7
- data/lib/talon_one/models/inline_response20012.rb +6 -10
- data/lib/talon_one/models/inline_response20013.rb +11 -11
- data/lib/talon_one/models/inline_response20014.rb +10 -10
- data/lib/talon_one/models/inline_response20015.rb +1 -6
- data/lib/talon_one/models/inline_response20016.rb +13 -8
- data/lib/talon_one/models/inline_response20017.rb +10 -10
- data/lib/talon_one/models/inline_response20018.rb +11 -11
- data/lib/talon_one/models/inline_response20019.rb +11 -7
- data/lib/talon_one/models/inline_response20020.rb +6 -1
- data/lib/talon_one/models/inline_response20021.rb +1 -1
- data/lib/talon_one/models/inline_response20022.rb +1 -1
- data/lib/talon_one/models/inline_response20023.rb +1 -1
- data/lib/talon_one/models/inline_response20024.rb +1 -1
- data/lib/talon_one/models/inline_response20025.rb +1 -1
- data/lib/talon_one/models/inline_response20026.rb +1 -1
- data/lib/talon_one/models/inline_response20027.rb +11 -7
- data/lib/talon_one/models/inline_response20028.rb +7 -11
- data/lib/talon_one/models/inline_response20029.rb +1 -1
- data/lib/talon_one/models/inline_response2006.rb +10 -10
- data/lib/talon_one/models/inline_response2007.rb +11 -11
- data/lib/talon_one/models/inline_response2008.rb +1 -1
- data/lib/talon_one/models/inline_response2009.rb +10 -10
- data/lib/talon_one/models/{inline_response20030.rb → inline_response201.rb} +4 -4
- data/lib/talon_one/models/integration_request.rb +1 -1
- data/lib/talon_one/models/integration_state_v2.rb +15 -4
- data/lib/talon_one/models/inventory_coupon.rb +499 -0
- data/lib/talon_one/models/loyalty_program.rb +16 -4
- data/lib/talon_one/models/loyalty_program_entity.rb +212 -0
- data/lib/talon_one/models/loyalty_tier.rb +301 -0
- data/lib/talon_one/models/new_attribute.rb +2 -2
- data/lib/talon_one/models/new_custom_effect.rb +291 -0
- data/lib/talon_one/models/new_giveaways_pool.rb +234 -0
- data/lib/talon_one/models/new_loyalty_tier.rb +256 -0
- data/lib/talon_one/models/new_referral.rb +64 -19
- data/lib/talon_one/models/new_referrals_for_multiple_advocates.rb +349 -0
- data/lib/talon_one/models/new_role.rb +1 -1
- data/lib/talon_one/models/referral.rb +86 -47
- data/lib/talon_one/models/referral_constraints.rb +251 -0
- data/lib/talon_one/models/role.rb +44 -4
- data/lib/talon_one/models/update_custom_effect.rb +292 -0
- data/lib/talon_one/models/update_loyalty_tier.rb +256 -0
- data/lib/talon_one/models/update_referral.rb +271 -0
- data/lib/talon_one/models/update_role.rb +1 -1
- data/lib/talon_one/models/will_award_giveaway_effect_props.rb +243 -0
- data/lib/talon_one/version.rb +1 -1
- data/spec/api/integration_api_spec.rb +19 -5
- data/spec/api/management_api_spec.rb +102 -33
- data/spec/models/application_campaign_stats_spec.rb +71 -0
- data/spec/models/application_referee_spec.rb +71 -0
- data/spec/models/attribute_spec.rb +1 -1
- data/spec/models/award_giveaway_effect_props_spec.rb +65 -0
- data/spec/models/campaign_spec.rb +7 -1
- data/spec/models/custom_effect_props_spec.rb +47 -0
- data/spec/models/custom_effect_spec.rb +113 -0
- data/spec/models/customer_inventory_spec.rb +6 -0
- data/spec/models/customer_profile_integration_request_v2_spec.rb +1 -1
- data/spec/models/environment_spec.rb +30 -0
- data/spec/models/export_spec.rb +1 -1
- data/spec/models/giveaway_spec.rb +89 -0
- data/spec/models/giveaways_pool_spec.rb +89 -0
- data/spec/models/import_entity_spec.rb +41 -0
- data/spec/models/inline_response20010_spec.rb +1 -1
- data/spec/models/inline_response20011_spec.rb +6 -0
- data/spec/models/inline_response20012_spec.rb +0 -6
- data/spec/models/inline_response20013_spec.rb +1 -1
- data/spec/models/inline_response20014_spec.rb +1 -1
- data/spec/models/inline_response20016_spec.rb +1 -1
- data/spec/models/inline_response20017_spec.rb +1 -1
- data/spec/models/inline_response20018_spec.rb +1 -1
- data/spec/models/inline_response20019_spec.rb +6 -0
- data/spec/models/inline_response20027_spec.rb +6 -0
- data/spec/models/inline_response20028_spec.rb +0 -6
- data/spec/models/inline_response2006_spec.rb +1 -1
- data/spec/models/inline_response2007_spec.rb +1 -1
- data/spec/models/inline_response2009_spec.rb +1 -1
- data/spec/models/{inline_response20030_spec.rb → inline_response201_spec.rb} +6 -6
- data/spec/models/integration_request_spec.rb +1 -1
- data/spec/models/integration_state_v2_spec.rb +6 -0
- data/spec/models/inventory_coupon_spec.rb +149 -0
- data/spec/models/loyalty_program_entity_spec.rb +41 -0
- data/spec/models/loyalty_program_spec.rb +6 -0
- data/spec/models/loyalty_tier_spec.rb +65 -0
- data/spec/models/new_attribute_spec.rb +1 -1
- data/spec/models/new_campaign_spec.rb +1 -1
- data/spec/models/new_custom_effect_spec.rb +77 -0
- data/spec/models/new_giveaways_pool_spec.rb +53 -0
- data/spec/models/new_loyalty_tier_spec.rb +47 -0
- data/spec/models/new_referral_spec.rb +17 -5
- data/spec/models/new_referrals_for_multiple_advocates_spec.rb +83 -0
- data/spec/models/referral_constraints_spec.rb +53 -0
- data/spec/models/referral_spec.rb +21 -3
- data/spec/models/role_spec.rb +12 -0
- data/spec/models/update_campaign_spec.rb +1 -1
- data/spec/models/update_custom_effect_spec.rb +77 -0
- data/spec/models/update_loyalty_tier_spec.rb +47 -0
- data/spec/models/update_referral_spec.rb +65 -0
- data/spec/models/will_award_giveaway_effect_props_spec.rb +53 -0
- metadata +86 -6
@@ -14,14 +14,14 @@ require 'date'
|
|
14
14
|
|
15
15
|
module TalonOne
|
16
16
|
class InlineResponse2006
|
17
|
-
attr_accessor :
|
17
|
+
attr_accessor :has_more
|
18
18
|
|
19
19
|
attr_accessor :data
|
20
20
|
|
21
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
22
22
|
def self.attribute_map
|
23
23
|
{
|
24
|
-
:'
|
24
|
+
:'has_more' => :'hasMore',
|
25
25
|
:'data' => :'data'
|
26
26
|
}
|
27
27
|
end
|
@@ -29,7 +29,7 @@ module TalonOne
|
|
29
29
|
# Attribute type mapping.
|
30
30
|
def self.openapi_types
|
31
31
|
{
|
32
|
-
:'
|
32
|
+
:'has_more' => :'Boolean',
|
33
33
|
:'data' => :'Array<Referral>'
|
34
34
|
}
|
35
35
|
end
|
@@ -55,8 +55,8 @@ module TalonOne
|
|
55
55
|
h[k.to_sym] = v
|
56
56
|
}
|
57
57
|
|
58
|
-
if attributes.key?(:'
|
59
|
-
self.
|
58
|
+
if attributes.key?(:'has_more')
|
59
|
+
self.has_more = attributes[:'has_more']
|
60
60
|
end
|
61
61
|
|
62
62
|
if attributes.key?(:'data')
|
@@ -70,8 +70,8 @@ module TalonOne
|
|
70
70
|
# @return Array for valid properties with the reasons
|
71
71
|
def list_invalid_properties
|
72
72
|
invalid_properties = Array.new
|
73
|
-
if @
|
74
|
-
invalid_properties.push('invalid value for "
|
73
|
+
if @has_more.nil?
|
74
|
+
invalid_properties.push('invalid value for "has_more", has_more cannot be nil.')
|
75
75
|
end
|
76
76
|
|
77
77
|
if @data.nil?
|
@@ -84,7 +84,7 @@ module TalonOne
|
|
84
84
|
# Check to see if the all the properties in the model are valid
|
85
85
|
# @return true if the model is valid
|
86
86
|
def valid?
|
87
|
-
return false if @
|
87
|
+
return false if @has_more.nil?
|
88
88
|
return false if @data.nil?
|
89
89
|
true
|
90
90
|
end
|
@@ -94,7 +94,7 @@ module TalonOne
|
|
94
94
|
def ==(o)
|
95
95
|
return true if self.equal?(o)
|
96
96
|
self.class == o.class &&
|
97
|
-
|
97
|
+
has_more == o.has_more &&
|
98
98
|
data == o.data
|
99
99
|
end
|
100
100
|
|
@@ -107,7 +107,7 @@ module TalonOne
|
|
107
107
|
# Calculates hash code according to all attributes.
|
108
108
|
# @return [Integer] Hash code
|
109
109
|
def hash
|
110
|
-
[
|
110
|
+
[has_more, data].hash
|
111
111
|
end
|
112
112
|
|
113
113
|
# Builds the object from hash
|
@@ -14,14 +14,14 @@ require 'date'
|
|
14
14
|
|
15
15
|
module TalonOne
|
16
16
|
class InlineResponse2007
|
17
|
-
attr_accessor :
|
17
|
+
attr_accessor :total_result_size
|
18
18
|
|
19
19
|
attr_accessor :data
|
20
20
|
|
21
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
22
22
|
def self.attribute_map
|
23
23
|
{
|
24
|
-
:'
|
24
|
+
:'total_result_size' => :'totalResultSize',
|
25
25
|
:'data' => :'data'
|
26
26
|
}
|
27
27
|
end
|
@@ -29,8 +29,8 @@ module TalonOne
|
|
29
29
|
# Attribute type mapping.
|
30
30
|
def self.openapi_types
|
31
31
|
{
|
32
|
-
:'
|
33
|
-
:'data' => :'Array<
|
32
|
+
:'total_result_size' => :'Integer',
|
33
|
+
:'data' => :'Array<LoyaltyProgram>'
|
34
34
|
}
|
35
35
|
end
|
36
36
|
|
@@ -55,8 +55,8 @@ module TalonOne
|
|
55
55
|
h[k.to_sym] = v
|
56
56
|
}
|
57
57
|
|
58
|
-
if attributes.key?(:'
|
59
|
-
self.
|
58
|
+
if attributes.key?(:'total_result_size')
|
59
|
+
self.total_result_size = attributes[:'total_result_size']
|
60
60
|
end
|
61
61
|
|
62
62
|
if attributes.key?(:'data')
|
@@ -70,8 +70,8 @@ module TalonOne
|
|
70
70
|
# @return Array for valid properties with the reasons
|
71
71
|
def list_invalid_properties
|
72
72
|
invalid_properties = Array.new
|
73
|
-
if @
|
74
|
-
invalid_properties.push('invalid value for "
|
73
|
+
if @total_result_size.nil?
|
74
|
+
invalid_properties.push('invalid value for "total_result_size", total_result_size cannot be nil.')
|
75
75
|
end
|
76
76
|
|
77
77
|
if @data.nil?
|
@@ -84,7 +84,7 @@ module TalonOne
|
|
84
84
|
# Check to see if the all the properties in the model are valid
|
85
85
|
# @return true if the model is valid
|
86
86
|
def valid?
|
87
|
-
return false if @
|
87
|
+
return false if @total_result_size.nil?
|
88
88
|
return false if @data.nil?
|
89
89
|
true
|
90
90
|
end
|
@@ -94,7 +94,7 @@ module TalonOne
|
|
94
94
|
def ==(o)
|
95
95
|
return true if self.equal?(o)
|
96
96
|
self.class == o.class &&
|
97
|
-
|
97
|
+
total_result_size == o.total_result_size &&
|
98
98
|
data == o.data
|
99
99
|
end
|
100
100
|
|
@@ -107,7 +107,7 @@ module TalonOne
|
|
107
107
|
# Calculates hash code according to all attributes.
|
108
108
|
# @return [Integer] Hash code
|
109
109
|
def hash
|
110
|
-
[
|
110
|
+
[total_result_size, data].hash
|
111
111
|
end
|
112
112
|
|
113
113
|
# Builds the object from hash
|
@@ -14,14 +14,14 @@ require 'date'
|
|
14
14
|
|
15
15
|
module TalonOne
|
16
16
|
class InlineResponse2009
|
17
|
-
attr_accessor :
|
17
|
+
attr_accessor :has_more
|
18
18
|
|
19
19
|
attr_accessor :data
|
20
20
|
|
21
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
22
22
|
def self.attribute_map
|
23
23
|
{
|
24
|
-
:'
|
24
|
+
:'has_more' => :'hasMore',
|
25
25
|
:'data' => :'data'
|
26
26
|
}
|
27
27
|
end
|
@@ -29,7 +29,7 @@ module TalonOne
|
|
29
29
|
# Attribute type mapping.
|
30
30
|
def self.openapi_types
|
31
31
|
{
|
32
|
-
:'
|
32
|
+
:'has_more' => :'Boolean',
|
33
33
|
:'data' => :'Array<AccessLogEntry>'
|
34
34
|
}
|
35
35
|
end
|
@@ -55,8 +55,8 @@ module TalonOne
|
|
55
55
|
h[k.to_sym] = v
|
56
56
|
}
|
57
57
|
|
58
|
-
if attributes.key?(:'
|
59
|
-
self.
|
58
|
+
if attributes.key?(:'has_more')
|
59
|
+
self.has_more = attributes[:'has_more']
|
60
60
|
end
|
61
61
|
|
62
62
|
if attributes.key?(:'data')
|
@@ -70,8 +70,8 @@ module TalonOne
|
|
70
70
|
# @return Array for valid properties with the reasons
|
71
71
|
def list_invalid_properties
|
72
72
|
invalid_properties = Array.new
|
73
|
-
if @
|
74
|
-
invalid_properties.push('invalid value for "
|
73
|
+
if @has_more.nil?
|
74
|
+
invalid_properties.push('invalid value for "has_more", has_more cannot be nil.')
|
75
75
|
end
|
76
76
|
|
77
77
|
if @data.nil?
|
@@ -84,7 +84,7 @@ module TalonOne
|
|
84
84
|
# Check to see if the all the properties in the model are valid
|
85
85
|
# @return true if the model is valid
|
86
86
|
def valid?
|
87
|
-
return false if @
|
87
|
+
return false if @has_more.nil?
|
88
88
|
return false if @data.nil?
|
89
89
|
true
|
90
90
|
end
|
@@ -94,7 +94,7 @@ module TalonOne
|
|
94
94
|
def ==(o)
|
95
95
|
return true if self.equal?(o)
|
96
96
|
self.class == o.class &&
|
97
|
-
|
97
|
+
has_more == o.has_more &&
|
98
98
|
data == o.data
|
99
99
|
end
|
100
100
|
|
@@ -107,7 +107,7 @@ module TalonOne
|
|
107
107
|
# Calculates hash code according to all attributes.
|
108
108
|
# @return [Integer] Hash code
|
109
109
|
def hash
|
110
|
-
[
|
110
|
+
[has_more, data].hash
|
111
111
|
end
|
112
112
|
|
113
113
|
# Builds the object from hash
|
@@ -13,7 +13,7 @@ OpenAPI Generator version: 4.3.1
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module TalonOne
|
16
|
-
class
|
16
|
+
class InlineResponse201
|
17
17
|
attr_accessor :total_result_size
|
18
18
|
|
19
19
|
attr_accessor :data
|
@@ -30,7 +30,7 @@ module TalonOne
|
|
30
30
|
def self.openapi_types
|
31
31
|
{
|
32
32
|
:'total_result_size' => :'Integer',
|
33
|
-
:'data' => :'Array<
|
33
|
+
:'data' => :'Array<Referral>'
|
34
34
|
}
|
35
35
|
end
|
36
36
|
|
@@ -44,13 +44,13 @@ module TalonOne
|
|
44
44
|
# @param [Hash] attributes Model attributes in the form of hash
|
45
45
|
def initialize(attributes = {})
|
46
46
|
if (!attributes.is_a?(Hash))
|
47
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::
|
47
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::InlineResponse201` initialize method"
|
48
48
|
end
|
49
49
|
|
50
50
|
# check to see if the attribute exists and convert string to symbol for hash key
|
51
51
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
52
52
|
if (!self.class.attribute_map.key?(k.to_sym))
|
53
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::
|
53
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::InlineResponse201`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
54
54
|
end
|
55
55
|
h[k.to_sym] = v
|
56
56
|
}
|
@@ -17,7 +17,7 @@ module TalonOne
|
|
17
17
|
class IntegrationRequest
|
18
18
|
attr_accessor :customer_session
|
19
19
|
|
20
|
-
# Optional list of requested information to be present on the response related to the customer session update. Currently supported: \"customerSession\", \"customerProfile\", \"coupons\", \"triggeredCampaigns\", \"referral\", \"loyalty\", \"event\" and \"ruleFailureReasons\".
|
20
|
+
# Optional list of requested information to be present on the response related to the customer session update. Currently supported: \"customerSession\", \"customerProfile\", \"coupons\", \"triggeredCampaigns\", \"referral\", \"loyalty\", \"event\", \"awardedGiveaways\" and \"ruleFailureReasons\".
|
21
21
|
attr_accessor :response_content
|
22
22
|
|
23
23
|
class EnumAttributeValidator
|
@@ -37,6 +37,8 @@ module TalonOne
|
|
37
37
|
|
38
38
|
attr_accessor :created_referrals
|
39
39
|
|
40
|
+
attr_accessor :awarded_giveaways
|
41
|
+
|
40
42
|
# Attribute mapping from ruby-style variable name to JSON key.
|
41
43
|
def self.attribute_map
|
42
44
|
{
|
@@ -50,7 +52,8 @@ module TalonOne
|
|
50
52
|
:'effects' => :'effects',
|
51
53
|
:'rule_failure_reasons' => :'ruleFailureReasons',
|
52
54
|
:'created_coupons' => :'createdCoupons',
|
53
|
-
:'created_referrals' => :'createdReferrals'
|
55
|
+
:'created_referrals' => :'createdReferrals',
|
56
|
+
:'awarded_giveaways' => :'awardedGiveaways'
|
54
57
|
}
|
55
58
|
end
|
56
59
|
|
@@ -67,7 +70,8 @@ module TalonOne
|
|
67
70
|
:'effects' => :'Array<Effect>',
|
68
71
|
:'rule_failure_reasons' => :'Array<RuleFailureReason>',
|
69
72
|
:'created_coupons' => :'Array<Coupon>',
|
70
|
-
:'created_referrals' => :'Array<Referral>'
|
73
|
+
:'created_referrals' => :'Array<Referral>',
|
74
|
+
:'awarded_giveaways' => :'Array<Giveaway>'
|
71
75
|
}
|
72
76
|
end
|
73
77
|
|
@@ -147,6 +151,12 @@ module TalonOne
|
|
147
151
|
self.created_referrals = value
|
148
152
|
end
|
149
153
|
end
|
154
|
+
|
155
|
+
if attributes.key?(:'awarded_giveaways')
|
156
|
+
if (value = attributes[:'awarded_giveaways']).is_a?(Array)
|
157
|
+
self.awarded_giveaways = value
|
158
|
+
end
|
159
|
+
end
|
150
160
|
end
|
151
161
|
|
152
162
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -192,7 +202,8 @@ module TalonOne
|
|
192
202
|
effects == o.effects &&
|
193
203
|
rule_failure_reasons == o.rule_failure_reasons &&
|
194
204
|
created_coupons == o.created_coupons &&
|
195
|
-
created_referrals == o.created_referrals
|
205
|
+
created_referrals == o.created_referrals &&
|
206
|
+
awarded_giveaways == o.awarded_giveaways
|
196
207
|
end
|
197
208
|
|
198
209
|
# @see the `==` method
|
@@ -204,7 +215,7 @@ module TalonOne
|
|
204
215
|
# Calculates hash code according to all attributes.
|
205
216
|
# @return [Integer] Hash code
|
206
217
|
def hash
|
207
|
-
[customer_session, customer_profile, event, loyalty, referral, coupons, triggered_campaigns, effects, rule_failure_reasons, created_coupons, created_referrals].hash
|
218
|
+
[customer_session, customer_profile, event, loyalty, referral, coupons, triggered_campaigns, effects, rule_failure_reasons, created_coupons, created_referrals, awarded_giveaways].hash
|
208
219
|
end
|
209
220
|
|
210
221
|
# Builds the object from hash
|
@@ -0,0 +1,499 @@
|
|
1
|
+
=begin
|
2
|
+
#Talon.One API
|
3
|
+
|
4
|
+
#The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. ### Where is the API? The API is available at the same hostname as these docs. For example, if you are reading this page at `https://mycompany.talon.one/docs/api/`, the URL for the [updateCustomerProfile][] operation is `https://mycompany.talon.one/v1/customer_profiles/id` [updateCustomerProfile]: #operation--v1-customer_profiles--integrationId--put
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
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 InventoryCoupon
|
18
|
+
# Unique ID for this entity.
|
19
|
+
attr_accessor :id
|
20
|
+
|
21
|
+
# The exact moment this entity was created.
|
22
|
+
attr_accessor :created
|
23
|
+
|
24
|
+
# The ID of the campaign that owns this entity.
|
25
|
+
attr_accessor :campaign_id
|
26
|
+
|
27
|
+
# The actual coupon code.
|
28
|
+
attr_accessor :value
|
29
|
+
|
30
|
+
# The number of times a coupon code can be redeemed. This can be set to 0 for no limit, but any campaign usage limits will still apply.
|
31
|
+
attr_accessor :usage_limit
|
32
|
+
|
33
|
+
# The amount of discounts that can be given with this coupon code.
|
34
|
+
attr_accessor :discount_limit
|
35
|
+
|
36
|
+
# Timestamp at which point the coupon becomes valid.
|
37
|
+
attr_accessor :start_date
|
38
|
+
|
39
|
+
# Expiry date of the coupon. Coupon never expires if this is omitted, zero, or negative.
|
40
|
+
attr_accessor :expiry_date
|
41
|
+
|
42
|
+
# The number of times this coupon has been successfully used.
|
43
|
+
attr_accessor :usage_counter
|
44
|
+
|
45
|
+
# The amount of discounts given on rules redeeming this coupon. Only usable if a coupon discount budget was set for this coupon.
|
46
|
+
attr_accessor :discount_counter
|
47
|
+
|
48
|
+
# The remaining discount this coupon can give.
|
49
|
+
attr_accessor :discount_remainder
|
50
|
+
|
51
|
+
# Arbitrary properties associated with this item
|
52
|
+
attr_accessor :attributes
|
53
|
+
|
54
|
+
# The integration ID of the referring customer (if any) for whom this coupon was created as an effect.
|
55
|
+
attr_accessor :referral_id
|
56
|
+
|
57
|
+
# The Integration ID of the customer that is allowed to redeem this coupon.
|
58
|
+
attr_accessor :recipient_integration_id
|
59
|
+
|
60
|
+
# The ID of the Import which created this coupon.
|
61
|
+
attr_accessor :import_id
|
62
|
+
|
63
|
+
# This value controls what reservations mean to a coupon. If set to true the coupon reservation is used to mark it as a favorite, if set to false the coupon reservation is used as a requirement of usage. This value defaults to true if not specified.
|
64
|
+
attr_accessor :reservation
|
65
|
+
|
66
|
+
# The id of the batch the coupon belongs to.
|
67
|
+
attr_accessor :batch_id
|
68
|
+
|
69
|
+
# The number of times the coupon was redeemed by the profile.
|
70
|
+
attr_accessor :profile_redemption_count
|
71
|
+
|
72
|
+
# Can be either active, used, expired, or pending. active: reserved coupons that are neither pending nor used nor expired, and have a non-exhausted limit counter. used: coupons that are not pending, and have reached their redemption limit or were redeemed by the profile before expiration. expired: all non-pending, non-active, non-used coupons that were not redeemed by the profile. pending: coupons that have a start date in the future.
|
73
|
+
attr_accessor :state
|
74
|
+
|
75
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
76
|
+
def self.attribute_map
|
77
|
+
{
|
78
|
+
:'id' => :'id',
|
79
|
+
:'created' => :'created',
|
80
|
+
:'campaign_id' => :'campaignId',
|
81
|
+
:'value' => :'value',
|
82
|
+
:'usage_limit' => :'usageLimit',
|
83
|
+
:'discount_limit' => :'discountLimit',
|
84
|
+
:'start_date' => :'startDate',
|
85
|
+
:'expiry_date' => :'expiryDate',
|
86
|
+
:'usage_counter' => :'usageCounter',
|
87
|
+
:'discount_counter' => :'discountCounter',
|
88
|
+
:'discount_remainder' => :'discountRemainder',
|
89
|
+
:'attributes' => :'attributes',
|
90
|
+
:'referral_id' => :'referralId',
|
91
|
+
:'recipient_integration_id' => :'recipientIntegrationId',
|
92
|
+
:'import_id' => :'importId',
|
93
|
+
:'reservation' => :'reservation',
|
94
|
+
:'batch_id' => :'batchId',
|
95
|
+
:'profile_redemption_count' => :'profileRedemptionCount',
|
96
|
+
:'state' => :'state'
|
97
|
+
}
|
98
|
+
end
|
99
|
+
|
100
|
+
# Attribute type mapping.
|
101
|
+
def self.openapi_types
|
102
|
+
{
|
103
|
+
:'id' => :'Integer',
|
104
|
+
:'created' => :'DateTime',
|
105
|
+
:'campaign_id' => :'Integer',
|
106
|
+
:'value' => :'String',
|
107
|
+
:'usage_limit' => :'Integer',
|
108
|
+
:'discount_limit' => :'Float',
|
109
|
+
:'start_date' => :'DateTime',
|
110
|
+
:'expiry_date' => :'DateTime',
|
111
|
+
:'usage_counter' => :'Integer',
|
112
|
+
:'discount_counter' => :'Float',
|
113
|
+
:'discount_remainder' => :'Float',
|
114
|
+
:'attributes' => :'Object',
|
115
|
+
:'referral_id' => :'Integer',
|
116
|
+
:'recipient_integration_id' => :'String',
|
117
|
+
:'import_id' => :'Integer',
|
118
|
+
:'reservation' => :'Boolean',
|
119
|
+
:'batch_id' => :'String',
|
120
|
+
:'profile_redemption_count' => :'Integer',
|
121
|
+
:'state' => :'String'
|
122
|
+
}
|
123
|
+
end
|
124
|
+
|
125
|
+
# List of attributes with nullable: true
|
126
|
+
def self.openapi_nullable
|
127
|
+
Set.new([
|
128
|
+
])
|
129
|
+
end
|
130
|
+
|
131
|
+
# Initializes the object
|
132
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
133
|
+
def initialize(attributes = {})
|
134
|
+
if (!attributes.is_a?(Hash))
|
135
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::InventoryCoupon` initialize method"
|
136
|
+
end
|
137
|
+
|
138
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
139
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
140
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
141
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::InventoryCoupon`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
142
|
+
end
|
143
|
+
h[k.to_sym] = v
|
144
|
+
}
|
145
|
+
|
146
|
+
if attributes.key?(:'id')
|
147
|
+
self.id = attributes[:'id']
|
148
|
+
end
|
149
|
+
|
150
|
+
if attributes.key?(:'created')
|
151
|
+
self.created = attributes[:'created']
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes.key?(:'campaign_id')
|
155
|
+
self.campaign_id = attributes[:'campaign_id']
|
156
|
+
end
|
157
|
+
|
158
|
+
if attributes.key?(:'value')
|
159
|
+
self.value = attributes[:'value']
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes.key?(:'usage_limit')
|
163
|
+
self.usage_limit = attributes[:'usage_limit']
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes.key?(:'discount_limit')
|
167
|
+
self.discount_limit = attributes[:'discount_limit']
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes.key?(:'start_date')
|
171
|
+
self.start_date = attributes[:'start_date']
|
172
|
+
end
|
173
|
+
|
174
|
+
if attributes.key?(:'expiry_date')
|
175
|
+
self.expiry_date = attributes[:'expiry_date']
|
176
|
+
end
|
177
|
+
|
178
|
+
if attributes.key?(:'usage_counter')
|
179
|
+
self.usage_counter = attributes[:'usage_counter']
|
180
|
+
end
|
181
|
+
|
182
|
+
if attributes.key?(:'discount_counter')
|
183
|
+
self.discount_counter = attributes[:'discount_counter']
|
184
|
+
end
|
185
|
+
|
186
|
+
if attributes.key?(:'discount_remainder')
|
187
|
+
self.discount_remainder = attributes[:'discount_remainder']
|
188
|
+
end
|
189
|
+
|
190
|
+
if attributes.key?(:'attributes')
|
191
|
+
self.attributes = attributes[:'attributes']
|
192
|
+
end
|
193
|
+
|
194
|
+
if attributes.key?(:'referral_id')
|
195
|
+
self.referral_id = attributes[:'referral_id']
|
196
|
+
end
|
197
|
+
|
198
|
+
if attributes.key?(:'recipient_integration_id')
|
199
|
+
self.recipient_integration_id = attributes[:'recipient_integration_id']
|
200
|
+
end
|
201
|
+
|
202
|
+
if attributes.key?(:'import_id')
|
203
|
+
self.import_id = attributes[:'import_id']
|
204
|
+
end
|
205
|
+
|
206
|
+
if attributes.key?(:'reservation')
|
207
|
+
self.reservation = attributes[:'reservation']
|
208
|
+
end
|
209
|
+
|
210
|
+
if attributes.key?(:'batch_id')
|
211
|
+
self.batch_id = attributes[:'batch_id']
|
212
|
+
end
|
213
|
+
|
214
|
+
if attributes.key?(:'profile_redemption_count')
|
215
|
+
self.profile_redemption_count = attributes[:'profile_redemption_count']
|
216
|
+
end
|
217
|
+
|
218
|
+
if attributes.key?(:'state')
|
219
|
+
self.state = attributes[:'state']
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
224
|
+
# @return Array for valid properties with the reasons
|
225
|
+
def list_invalid_properties
|
226
|
+
invalid_properties = Array.new
|
227
|
+
if @id.nil?
|
228
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
229
|
+
end
|
230
|
+
|
231
|
+
if @created.nil?
|
232
|
+
invalid_properties.push('invalid value for "created", created cannot be nil.')
|
233
|
+
end
|
234
|
+
|
235
|
+
if @campaign_id.nil?
|
236
|
+
invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.')
|
237
|
+
end
|
238
|
+
|
239
|
+
if @value.nil?
|
240
|
+
invalid_properties.push('invalid value for "value", value cannot be nil.')
|
241
|
+
end
|
242
|
+
|
243
|
+
if @value.to_s.length < 4
|
244
|
+
invalid_properties.push('invalid value for "value", the character length must be great than or equal to 4.')
|
245
|
+
end
|
246
|
+
|
247
|
+
if @usage_limit.nil?
|
248
|
+
invalid_properties.push('invalid value for "usage_limit", usage_limit cannot be nil.')
|
249
|
+
end
|
250
|
+
|
251
|
+
if @usage_limit > 999999
|
252
|
+
invalid_properties.push('invalid value for "usage_limit", must be smaller than or equal to 999999.')
|
253
|
+
end
|
254
|
+
|
255
|
+
if @usage_limit < 0
|
256
|
+
invalid_properties.push('invalid value for "usage_limit", must be greater than or equal to 0.')
|
257
|
+
end
|
258
|
+
|
259
|
+
if !@discount_limit.nil? && @discount_limit > 999999
|
260
|
+
invalid_properties.push('invalid value for "discount_limit", must be smaller than or equal to 999999.')
|
261
|
+
end
|
262
|
+
|
263
|
+
if !@discount_limit.nil? && @discount_limit < 0
|
264
|
+
invalid_properties.push('invalid value for "discount_limit", must be greater than or equal to 0.')
|
265
|
+
end
|
266
|
+
|
267
|
+
if @usage_counter.nil?
|
268
|
+
invalid_properties.push('invalid value for "usage_counter", usage_counter cannot be nil.')
|
269
|
+
end
|
270
|
+
|
271
|
+
if @profile_redemption_count.nil?
|
272
|
+
invalid_properties.push('invalid value for "profile_redemption_count", profile_redemption_count cannot be nil.')
|
273
|
+
end
|
274
|
+
|
275
|
+
if @state.nil?
|
276
|
+
invalid_properties.push('invalid value for "state", state cannot be nil.')
|
277
|
+
end
|
278
|
+
|
279
|
+
invalid_properties
|
280
|
+
end
|
281
|
+
|
282
|
+
# Check to see if the all the properties in the model are valid
|
283
|
+
# @return true if the model is valid
|
284
|
+
def valid?
|
285
|
+
return false if @id.nil?
|
286
|
+
return false if @created.nil?
|
287
|
+
return false if @campaign_id.nil?
|
288
|
+
return false if @value.nil?
|
289
|
+
return false if @value.to_s.length < 4
|
290
|
+
return false if @usage_limit.nil?
|
291
|
+
return false if @usage_limit > 999999
|
292
|
+
return false if @usage_limit < 0
|
293
|
+
return false if !@discount_limit.nil? && @discount_limit > 999999
|
294
|
+
return false if !@discount_limit.nil? && @discount_limit < 0
|
295
|
+
return false if @usage_counter.nil?
|
296
|
+
return false if @profile_redemption_count.nil?
|
297
|
+
return false if @state.nil?
|
298
|
+
true
|
299
|
+
end
|
300
|
+
|
301
|
+
# Custom attribute writer method with validation
|
302
|
+
# @param [Object] value Value to be assigned
|
303
|
+
def value=(value)
|
304
|
+
if value.nil?
|
305
|
+
fail ArgumentError, 'value cannot be nil'
|
306
|
+
end
|
307
|
+
|
308
|
+
if value.to_s.length < 4
|
309
|
+
fail ArgumentError, 'invalid value for "value", the character length must be great than or equal to 4.'
|
310
|
+
end
|
311
|
+
|
312
|
+
@value = value
|
313
|
+
end
|
314
|
+
|
315
|
+
# Custom attribute writer method with validation
|
316
|
+
# @param [Object] usage_limit Value to be assigned
|
317
|
+
def usage_limit=(usage_limit)
|
318
|
+
if usage_limit.nil?
|
319
|
+
fail ArgumentError, 'usage_limit cannot be nil'
|
320
|
+
end
|
321
|
+
|
322
|
+
if usage_limit > 999999
|
323
|
+
fail ArgumentError, 'invalid value for "usage_limit", must be smaller than or equal to 999999.'
|
324
|
+
end
|
325
|
+
|
326
|
+
if usage_limit < 0
|
327
|
+
fail ArgumentError, 'invalid value for "usage_limit", must be greater than or equal to 0.'
|
328
|
+
end
|
329
|
+
|
330
|
+
@usage_limit = usage_limit
|
331
|
+
end
|
332
|
+
|
333
|
+
# Custom attribute writer method with validation
|
334
|
+
# @param [Object] discount_limit Value to be assigned
|
335
|
+
def discount_limit=(discount_limit)
|
336
|
+
if !discount_limit.nil? && discount_limit > 999999
|
337
|
+
fail ArgumentError, 'invalid value for "discount_limit", must be smaller than or equal to 999999.'
|
338
|
+
end
|
339
|
+
|
340
|
+
if !discount_limit.nil? && discount_limit < 0
|
341
|
+
fail ArgumentError, 'invalid value for "discount_limit", must be greater than or equal to 0.'
|
342
|
+
end
|
343
|
+
|
344
|
+
@discount_limit = discount_limit
|
345
|
+
end
|
346
|
+
|
347
|
+
# Checks equality by comparing each attribute.
|
348
|
+
# @param [Object] Object to be compared
|
349
|
+
def ==(o)
|
350
|
+
return true if self.equal?(o)
|
351
|
+
self.class == o.class &&
|
352
|
+
id == o.id &&
|
353
|
+
created == o.created &&
|
354
|
+
campaign_id == o.campaign_id &&
|
355
|
+
value == o.value &&
|
356
|
+
usage_limit == o.usage_limit &&
|
357
|
+
discount_limit == o.discount_limit &&
|
358
|
+
start_date == o.start_date &&
|
359
|
+
expiry_date == o.expiry_date &&
|
360
|
+
usage_counter == o.usage_counter &&
|
361
|
+
discount_counter == o.discount_counter &&
|
362
|
+
discount_remainder == o.discount_remainder &&
|
363
|
+
attributes == o.attributes &&
|
364
|
+
referral_id == o.referral_id &&
|
365
|
+
recipient_integration_id == o.recipient_integration_id &&
|
366
|
+
import_id == o.import_id &&
|
367
|
+
reservation == o.reservation &&
|
368
|
+
batch_id == o.batch_id &&
|
369
|
+
profile_redemption_count == o.profile_redemption_count &&
|
370
|
+
state == o.state
|
371
|
+
end
|
372
|
+
|
373
|
+
# @see the `==` method
|
374
|
+
# @param [Object] Object to be compared
|
375
|
+
def eql?(o)
|
376
|
+
self == o
|
377
|
+
end
|
378
|
+
|
379
|
+
# Calculates hash code according to all attributes.
|
380
|
+
# @return [Integer] Hash code
|
381
|
+
def hash
|
382
|
+
[id, created, campaign_id, value, usage_limit, discount_limit, start_date, expiry_date, usage_counter, discount_counter, discount_remainder, attributes, referral_id, recipient_integration_id, import_id, reservation, batch_id, profile_redemption_count, state].hash
|
383
|
+
end
|
384
|
+
|
385
|
+
# Builds the object from hash
|
386
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
387
|
+
# @return [Object] Returns the model itself
|
388
|
+
def self.build_from_hash(attributes)
|
389
|
+
new.build_from_hash(attributes)
|
390
|
+
end
|
391
|
+
|
392
|
+
# Builds the object from hash
|
393
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
394
|
+
# @return [Object] Returns the model itself
|
395
|
+
def build_from_hash(attributes)
|
396
|
+
return nil unless attributes.is_a?(Hash)
|
397
|
+
self.class.openapi_types.each_pair do |key, type|
|
398
|
+
if type =~ /\AArray<(.*)>/i
|
399
|
+
# check to ensure the input is an array given that the attribute
|
400
|
+
# is documented as an array but the input is not
|
401
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
402
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
403
|
+
end
|
404
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
405
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
406
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
407
|
+
end
|
408
|
+
|
409
|
+
self
|
410
|
+
end
|
411
|
+
|
412
|
+
# Deserializes the data based on type
|
413
|
+
# @param string type Data type
|
414
|
+
# @param string value Value to be deserialized
|
415
|
+
# @return [Object] Deserialized data
|
416
|
+
def _deserialize(type, value)
|
417
|
+
case type.to_sym
|
418
|
+
when :DateTime
|
419
|
+
DateTime.parse(value)
|
420
|
+
when :Date
|
421
|
+
Date.parse(value)
|
422
|
+
when :String
|
423
|
+
value.to_s
|
424
|
+
when :Integer
|
425
|
+
value.to_i
|
426
|
+
when :Float
|
427
|
+
value.to_f
|
428
|
+
when :Boolean
|
429
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
430
|
+
true
|
431
|
+
else
|
432
|
+
false
|
433
|
+
end
|
434
|
+
when :Object
|
435
|
+
# generic object (usually a Hash), return directly
|
436
|
+
value
|
437
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
438
|
+
inner_type = Regexp.last_match[:inner_type]
|
439
|
+
value.map { |v| _deserialize(inner_type, v) }
|
440
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
441
|
+
k_type = Regexp.last_match[:k_type]
|
442
|
+
v_type = Regexp.last_match[:v_type]
|
443
|
+
{}.tap do |hash|
|
444
|
+
value.each do |k, v|
|
445
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
446
|
+
end
|
447
|
+
end
|
448
|
+
else # model
|
449
|
+
TalonOne.const_get(type).build_from_hash(value)
|
450
|
+
end
|
451
|
+
end
|
452
|
+
|
453
|
+
# Returns the string representation of the object
|
454
|
+
# @return [String] String presentation of the object
|
455
|
+
def to_s
|
456
|
+
to_hash.to_s
|
457
|
+
end
|
458
|
+
|
459
|
+
# to_body is an alias to to_hash (backward compatibility)
|
460
|
+
# @return [Hash] Returns the object in the form of hash
|
461
|
+
def to_body
|
462
|
+
to_hash
|
463
|
+
end
|
464
|
+
|
465
|
+
# Returns the object in the form of hash
|
466
|
+
# @return [Hash] Returns the object in the form of hash
|
467
|
+
def to_hash
|
468
|
+
hash = {}
|
469
|
+
self.class.attribute_map.each_pair do |attr, param|
|
470
|
+
value = self.send(attr)
|
471
|
+
if value.nil?
|
472
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
473
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
474
|
+
end
|
475
|
+
|
476
|
+
hash[param] = _to_hash(value)
|
477
|
+
end
|
478
|
+
hash
|
479
|
+
end
|
480
|
+
|
481
|
+
# Outputs non-array value in the form of hash
|
482
|
+
# For object, use to_hash. Otherwise, just return the value
|
483
|
+
# @param [Object] value Any valid value
|
484
|
+
# @return [Hash] Returns the value in the form of hash
|
485
|
+
def _to_hash(value)
|
486
|
+
if value.is_a?(Array)
|
487
|
+
value.compact.map { |v| _to_hash(v) }
|
488
|
+
elsif value.is_a?(Hash)
|
489
|
+
{}.tap do |hash|
|
490
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
491
|
+
end
|
492
|
+
elsif value.respond_to? :to_hash
|
493
|
+
value.to_hash
|
494
|
+
else
|
495
|
+
value
|
496
|
+
end
|
497
|
+
end
|
498
|
+
end
|
499
|
+
end
|