klaviyo-api-sdk 17.0.0 → 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/README.md +932 -414
- data/klaviyo-api-sdk.gemspec +1 -1
- data/lib/klaviyo-api-sdk/api/accounts_api.rb +12 -12
- data/lib/klaviyo-api-sdk/api/campaigns_api.rb +215 -155
- data/lib/klaviyo-api-sdk/api/catalogs_api.rb +585 -381
- data/lib/klaviyo-api-sdk/api/client_api.rb +100 -0
- data/lib/klaviyo-api-sdk/api/conversations_api.rb +3 -3
- data/lib/klaviyo-api-sdk/api/coupons_api.rb +187 -108
- data/lib/klaviyo-api-sdk/api/custom_objects_api.rb +2755 -83
- data/lib/klaviyo-api-sdk/api/data_privacy_api.rb +3 -3
- data/lib/klaviyo-api-sdk/api/events_api.rb +72 -58
- data/lib/klaviyo-api-sdk/api/flows_api.rb +238 -152
- data/lib/klaviyo-api-sdk/api/forms_api.rb +81 -60
- data/lib/klaviyo-api-sdk/api/images_api.rb +48 -27
- data/lib/klaviyo-api-sdk/api/lists_api.rb +113 -88
- data/lib/klaviyo-api-sdk/api/metrics_api.rb +184 -156
- data/lib/klaviyo-api-sdk/api/profiles_api.rb +445 -226
- data/lib/klaviyo-api-sdk/api/reporting_api.rb +76 -27
- data/lib/klaviyo-api-sdk/api/reviews_api.rb +38 -31
- data/lib/klaviyo-api-sdk/api/segments_api.rb +107 -82
- data/lib/klaviyo-api-sdk/api/tags_api.rb +164 -128
- data/lib/klaviyo-api-sdk/api/templates_api.rb +113 -60
- data/lib/klaviyo-api-sdk/api/tracking_settings_api.rb +24 -17
- data/lib/klaviyo-api-sdk/api/web_feeds_api.rb +41 -27
- data/lib/klaviyo-api-sdk/api/webhooks_api.rb +73 -31
- data/lib/klaviyo-api-sdk/api_client.rb +1 -1
- data/lib/klaviyo-api-sdk/models/action_output_condition.rb +1 -1
- data/lib/klaviyo-api-sdk/models/action_output_condition_filter.rb +78 -195
- data/lib/klaviyo-api-sdk/models/action_output_split_action_data.rb +2 -6
- data/lib/klaviyo-api-sdk/models/{flow_push_notification_additional_filters.rb → action_output_split_action_data_action_output_filter.rb} +4 -4
- data/lib/klaviyo-api-sdk/models/{action_output_condition_condition_group.rb → action_output_split_action_data_action_output_filter_condition_groups_inner.rb} +3 -3
- data/lib/klaviyo-api-sdk/models/age_gate_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/api_schema_property.rb +301 -0
- data/lib/klaviyo-api-sdk/models/back_in_stock_email_consent_checkbox_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/base_event_create_query_bulk_entry_resource_object_attributes.rb +15 -2
- data/lib/klaviyo-api-sdk/models/base_style_properties.rb +15 -5
- data/lib/klaviyo-api-sdk/models/button_action.rb +1 -0
- data/lib/klaviyo-api-sdk/models/button_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/button_styles.rb +25 -3
- data/lib/klaviyo-api-sdk/models/{action_output_condition_filter2.rb → button_styles_height.rb} +3 -7
- data/lib/klaviyo-api-sdk/models/cart_content.rb +277 -0
- data/lib/klaviyo-api-sdk/models/cart_content_properties.rb +236 -0
- data/lib/klaviyo-api-sdk/models/checkboxes_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/conditional_branch_action_data_profile_filter_condition_groups_inner_conditions_inner.rb +5 -0
- data/lib/klaviyo-api-sdk/models/constant_property_mapping.rb +287 -0
- data/lib/klaviyo-api-sdk/models/{price_drop_condition_filter2.rb → constant_property_mapping_value.rb} +6 -16
- data/lib/klaviyo-api-sdk/models/content_experiment_action.rb +1 -1
- data/lib/klaviyo-api-sdk/models/{send_push_notification_action_content_experiment_action_data.rb → content_experiment_action_data.rb} +6 -5
- data/lib/klaviyo-api-sdk/models/{send_push_notification_action_current_experiment.rb → content_experiment_action_data_current_experiment.rb} +6 -6
- data/lib/klaviyo-api-sdk/models/{low_inventory_condition_filter2.rb → content_experiment_action_data_main_action.rb} +3 -16
- data/lib/klaviyo-api-sdk/models/countdown_timer_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/coupon_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/custom_css.rb +231 -0
- data/lib/klaviyo-api-sdk/models/custom_html.rb +292 -0
- data/lib/klaviyo-api-sdk/models/custom_html_properties.rb +263 -0
- data/lib/klaviyo-api-sdk/models/custom_object_date_trigger.rb +450 -0
- data/lib/klaviyo-api-sdk/models/custom_object_property_condition.rb +1 -1
- data/lib/klaviyo-api-sdk/models/custom_object_relationship_source.rb +328 -0
- data/lib/klaviyo-api-sdk/models/date_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/display_options.rb +24 -4
- data/lib/klaviyo-api-sdk/models/dropdown_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/email_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/email_subscription_parameters.rb +13 -9
- data/lib/klaviyo-api-sdk/models/email_unsubscription_parameters.rb +13 -9
- data/lib/klaviyo-api-sdk/models/embedded_object_schema_resource_object.rb +237 -0
- data/lib/klaviyo-api-sdk/models/embedded_object_schema_resource_object_attributes.rb +292 -0
- data/lib/klaviyo-api-sdk/models/embedded_object_schema_resource_object_attributes_source_mapping.rb +224 -0
- data/lib/klaviyo-api-sdk/models/event_create_query_v2_resource_object_attributes.rb +15 -2
- data/lib/klaviyo-api-sdk/models/events_bulk_create_query_resource_object_attributes.rb +14 -1
- data/lib/klaviyo-api-sdk/models/flow_definition_profile_filter_condition_groups_inner_conditions_inner.rb +5 -0
- data/lib/klaviyo-api-sdk/models/flow_definition_triggers_inner.rb +1 -0
- data/lib/klaviyo-api-sdk/models/flow_email.rb +1 -1
- data/lib/klaviyo-api-sdk/models/flow_push_notification.rb +14 -4
- data/lib/klaviyo-api-sdk/models/flow_sms.rb +15 -2
- data/lib/klaviyo-api-sdk/models/form_create_query_resource_object_attributes.rb +2 -2
- data/lib/klaviyo-api-sdk/models/html_text_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/iaf_deeplink_to_screen.rb +305 -0
- data/lib/klaviyo-api-sdk/models/iaf_deeplink_to_screen_properties.rb +220 -0
- data/lib/klaviyo-api-sdk/models/image_action.rb +1 -0
- data/lib/klaviyo-api-sdk/models/image_block_cropping_properties.rb +0 -35
- data/lib/klaviyo-api-sdk/models/image_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/low_inventory_condition.rb +1 -1
- data/lib/klaviyo-api-sdk/models/low_inventory_trigger.rb +2 -6
- data/lib/klaviyo-api-sdk/models/{low_inventory_condition_filter.rb → low_inventory_trigger_trigger_filter.rb} +4 -4
- data/lib/klaviyo-api-sdk/models/{low_inventory_condition_condition_group.rb → low_inventory_trigger_trigger_filter_condition_groups_inner.rb} +3 -3
- data/lib/klaviyo-api-sdk/models/metric_aggregate_query_resource_object_attributes.rb +2 -2
- data/lib/klaviyo-api-sdk/models/metric_property_condition.rb +1 -1
- data/lib/klaviyo-api-sdk/models/metric_property_condition_filter.rb +87 -195
- data/lib/klaviyo-api-sdk/models/metric_trigger.rb +2 -1
- data/lib/klaviyo-api-sdk/models/{flow_email_additional_filters.rb → metric_trigger_trigger_filter.rb} +4 -4
- data/lib/klaviyo-api-sdk/models/{flow_email_additional_filters_condition_groups_inner.rb → metric_trigger_trigger_filter_condition_groups_inner.rb} +4 -4
- data/lib/klaviyo-api-sdk/models/mobile_push_content_create.rb +18 -5
- data/lib/klaviyo-api-sdk/models/mobile_push_content_update.rb +18 -5
- data/lib/klaviyo-api-sdk/models/mobile_push_options_on_open.rb +2 -1
- data/lib/klaviyo-api-sdk/models/multi_branch_split_branch_branch_filter_condition_groups_inner_conditions_inner.rb +5 -0
- data/lib/klaviyo-api-sdk/models/object_record_bulk_delete_job_enum.rb +35 -0
- data/lib/klaviyo-api-sdk/models/object_record_delete_job_create_query.rb +223 -0
- data/lib/klaviyo-api-sdk/models/object_record_delete_job_create_query_resource_object.rb +237 -0
- data/lib/klaviyo-api-sdk/models/{flow_push_notification_additional_filters_condition_groups_inner.rb → object_record_delete_job_create_query_resource_object_relationships.rb} +13 -15
- data/lib/klaviyo-api-sdk/models/object_record_delete_job_create_query_resource_object_relationships_object_records.rb +220 -0
- data/lib/klaviyo-api-sdk/models/object_record_delete_job_rels_records_data_inner.rb +238 -0
- data/lib/klaviyo-api-sdk/models/object_record_enum.rb +35 -0
- data/lib/klaviyo-api-sdk/models/object_schema_create_query.rb +223 -0
- data/lib/klaviyo-api-sdk/models/object_schema_create_query_resource_object.rb +246 -0
- data/lib/klaviyo-api-sdk/models/object_schema_create_query_resource_object_attributes.rb +322 -0
- data/lib/klaviyo-api-sdk/models/object_schema_create_query_resource_object_relationships.rb +218 -0
- data/lib/klaviyo-api-sdk/models/object_schema_create_query_resource_object_relationships_object_type.rb +218 -0
- data/lib/klaviyo-api-sdk/models/object_schema_create_query_resource_object_relationships_object_type_data.rb +238 -0
- data/lib/klaviyo-api-sdk/models/object_schema_enum.rb +35 -0
- data/lib/klaviyo-api-sdk/models/object_schema_partial_update_query.rb +223 -0
- data/lib/klaviyo-api-sdk/models/object_schema_partial_update_query_resource_object.rb +252 -0
- data/lib/klaviyo-api-sdk/models/object_schema_partial_update_query_resource_object_attributes.rb +302 -0
- data/lib/klaviyo-api-sdk/models/object_schema_relationship_create_meta.rb +237 -0
- data/lib/klaviyo-api-sdk/models/{metric_property_condition_condition_group.rb → object_schema_relationship_create_query.rb} +14 -14
- data/lib/klaviyo-api-sdk/models/{flow_sms_additional_filters_condition_groups_inner.rb → object_schema_relationship_create_query_data_inner.rb} +37 -15
- data/lib/klaviyo-api-sdk/models/object_schema_relationship_delete_meta.rb +224 -0
- data/lib/klaviyo-api-sdk/models/object_schema_relationship_delete_query.rb +225 -0
- data/lib/klaviyo-api-sdk/models/object_schema_relationship_delete_query_data_inner.rb +247 -0
- data/lib/klaviyo-api-sdk/models/object_schema_relationship_partial_update_query.rb +223 -0
- data/lib/klaviyo-api-sdk/models/object_schema_relationship_partial_update_query_data.rb +247 -0
- data/lib/klaviyo-api-sdk/models/object_schema_relationship_update_meta.rb +246 -0
- data/lib/klaviyo-api-sdk/models/object_type_create_query.rb +223 -0
- data/lib/klaviyo-api-sdk/models/object_type_create_query_resource_object.rb +237 -0
- data/lib/klaviyo-api-sdk/models/object_type_create_query_resource_object_attributes.rb +307 -0
- data/lib/klaviyo-api-sdk/models/object_type_create_query_resource_object_attributes_object_schema.rb +224 -0
- data/lib/klaviyo-api-sdk/models/object_type_enum.rb +35 -0
- data/lib/klaviyo-api-sdk/models/onsite_profile_meta.rb +13 -4
- data/lib/klaviyo-api-sdk/models/open_tracking_subscription_parameters.rb +258 -0
- data/lib/klaviyo-api-sdk/models/open_tracking_unsubscription_parameters.rb +258 -0
- data/lib/klaviyo-api-sdk/models/opt_in_code_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/patch_identifiers.rb +227 -0
- data/lib/klaviyo-api-sdk/models/phone_number_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/price_drop_condition.rb +1 -1
- data/lib/klaviyo-api-sdk/models/price_drop_trigger.rb +2 -6
- data/lib/klaviyo-api-sdk/models/{flow_sms_additional_filters.rb → price_drop_trigger_trigger_filter.rb} +4 -4
- data/lib/klaviyo-api-sdk/models/{price_drop_condition_condition_group.rb → price_drop_trigger_trigger_filter_condition_groups_inner.rb} +3 -3
- data/lib/klaviyo-api-sdk/models/profile_event_tracked_properties.rb +19 -9
- data/lib/klaviyo-api-sdk/models/profile_has_not_received_email_message_condition.rb +1 -1
- data/lib/klaviyo-api-sdk/models/{profile_has_not_received_push_message_condition_timeframe_filter.rb → profile_has_not_received_email_message_condition_timeframe_filter.rb} +1 -1
- data/lib/klaviyo-api-sdk/models/profile_has_not_received_push_message_condition.rb +1 -1
- data/lib/klaviyo-api-sdk/models/profile_has_not_received_sms_message_condition.rb +1 -1
- data/lib/klaviyo-api-sdk/models/profile_meta.rb +13 -4
- data/lib/klaviyo-api-sdk/models/profile_not_in_flow_condition.rb +1 -1
- data/lib/klaviyo-api-sdk/models/profile_object_schema_enum.rb +35 -0
- data/lib/klaviyo-api-sdk/models/profile_object_schema_relationship_create_query.rb +225 -0
- data/lib/klaviyo-api-sdk/models/profile_object_schema_relationship_create_query_data_inner.rb +247 -0
- data/lib/klaviyo-api-sdk/models/profile_object_schema_relationship_delete_query.rb +225 -0
- data/lib/klaviyo-api-sdk/models/profile_object_schema_relationship_delete_query_data_inner.rb +247 -0
- data/lib/klaviyo-api-sdk/models/profile_object_schema_relationship_partial_update_query.rb +223 -0
- data/lib/klaviyo-api-sdk/models/profile_object_schema_relationship_partial_update_query_data.rb +247 -0
- data/lib/klaviyo-api-sdk/models/profile_predictive_analytics_channel_affinity_priority_condition.rb +2 -2
- data/lib/klaviyo-api-sdk/models/profile_predictive_analytics_channel_affinity_rank_condition.rb +2 -2
- data/lib/klaviyo-api-sdk/models/profile_relationship_source.rb +330 -0
- data/lib/klaviyo-api-sdk/models/property_filter.rb +237 -0
- data/lib/klaviyo-api-sdk/models/property_source.rb +254 -0
- data/lib/klaviyo-api-sdk/models/push_action_button.rb +1 -5
- data/lib/klaviyo-api-sdk/models/push_action_button_definition.rb +261 -0
- data/lib/klaviyo-api-sdk/models/push_on_open_web_url.rb +268 -0
- data/lib/klaviyo-api-sdk/models/quote_style.rb +21 -1
- data/lib/klaviyo-api-sdk/models/radio_buttons_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/redirect_properties.rb +2 -5
- data/lib/klaviyo-api-sdk/models/related_id_path.rb +273 -0
- data/lib/klaviyo-api-sdk/models/review_block_styles.rb +13 -13
- data/lib/klaviyo-api-sdk/models/review_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/reviewer_name_style.rb +21 -1
- data/lib/klaviyo-api-sdk/models/row_v0_blocks_inner.rb +1 -0
- data/lib/klaviyo-api-sdk/models/signup_counter_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/simple_property_mapping.rb +287 -0
- data/lib/klaviyo-api-sdk/models/simple_relationship_mapping.rb +287 -0
- data/lib/klaviyo-api-sdk/models/simple_relationship_mapping_source.rb +105 -0
- data/lib/klaviyo-api-sdk/models/sms_consent_checkbox_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/sms_disclosure_link_text_style.rb +319 -0
- data/lib/klaviyo-api-sdk/models/sms_disclosure_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/sms_disclosure_styles.rb +1 -1
- data/lib/klaviyo-api-sdk/models/source_mapping_create_query_resource_object.rb +237 -0
- data/lib/klaviyo-api-sdk/models/source_mapping_create_query_resource_object_attributes.rb +235 -0
- data/lib/klaviyo-api-sdk/models/source_mapping_create_query_resource_object_attributes_property_mappings_inner.rb +104 -0
- data/lib/klaviyo-api-sdk/models/source_mapping_enum.rb +35 -0
- data/lib/klaviyo-api-sdk/models/source_mapping_partial_update_query.rb +223 -0
- data/lib/klaviyo-api-sdk/models/source_mapping_partial_update_query_resource_object.rb +252 -0
- data/lib/klaviyo-api-sdk/models/spin_to_win_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/string_phone_operator_string_array_filter.rb +1 -1
- data/lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb +0 -13
- data/lib/klaviyo-api-sdk/models/table_image_sub_block.rb +0 -13
- data/lib/klaviyo-api-sdk/models/template_definition.rb +1 -0
- data/lib/klaviyo-api-sdk/models/text_properties.rb +11 -1
- data/lib/klaviyo-api-sdk/models/version.rb +39 -4
- data/lib/klaviyo-api-sdk/models/version_properties.rb +14 -4
- data/lib/klaviyo-api-sdk/models/version_styles.rb +15 -6
- data/lib/klaviyo-api-sdk/models/version_triggers_inner.rb +1 -0
- data/lib/klaviyo-api-sdk.rb +86 -23
- data/lib/klaviyo-api-sdk.rb.bak +87 -24
- metadata +88 -25
- data/lib/klaviyo-api-sdk/models/custom_object_property_condition_filter.rb +0 -117
- data/lib/klaviyo-api-sdk/models/flow_email_additional_filters_condition_groups_inner_conditions_inner.rb +0 -116
- data/lib/klaviyo-api-sdk/models/flow_push_notification_additional_filters_condition_groups_inner_conditions_inner.rb +0 -116
- data/lib/klaviyo-api-sdk/models/flow_sms_additional_filters_condition_groups_inner_conditions_inner.rb +0 -116
- data/lib/klaviyo-api-sdk/models/metric_property_condition_filter2.rb +0 -117
- data/lib/klaviyo-api-sdk/models/price_drop_condition_filter.rb +0 -225
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Klaviyo API
|
|
3
|
+
|
|
4
|
+
#The Klaviyo REST API. Please visit https://developers.klaviyo.com for more details.
|
|
5
|
+
|
|
6
|
+
Contact: developers@klaviyo.com
|
|
7
|
+
Generated by: https://openapi-generator.tech
|
|
8
|
+
OpenAPI Generator version: 6.2.1
|
|
9
|
+
|
|
10
|
+
=end
|
|
11
|
+
|
|
12
|
+
require 'date'
|
|
13
|
+
require 'time'
|
|
14
|
+
|
|
15
|
+
module KlaviyoAPI
|
|
16
|
+
class PushOnOpenWebUrl
|
|
17
|
+
attr_accessor :type
|
|
18
|
+
|
|
19
|
+
# External url to open when push notification is triggered
|
|
20
|
+
attr_accessor :web_url
|
|
21
|
+
|
|
22
|
+
class EnumAttributeValidator
|
|
23
|
+
attr_reader :datatype
|
|
24
|
+
attr_reader :allowable_values
|
|
25
|
+
|
|
26
|
+
def initialize(datatype, allowable_values)
|
|
27
|
+
@allowable_values = allowable_values.map do |value|
|
|
28
|
+
case datatype.to_s
|
|
29
|
+
when /Integer/i
|
|
30
|
+
value.to_i
|
|
31
|
+
when /Float/i
|
|
32
|
+
value.to_f
|
|
33
|
+
else
|
|
34
|
+
value
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def valid?(value)
|
|
40
|
+
!value || allowable_values.include?(value)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
45
|
+
def self.attribute_map
|
|
46
|
+
{
|
|
47
|
+
:'type' => :'type',
|
|
48
|
+
:'web_url' => :'web_url'
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Returns all the JSON keys this model knows about
|
|
53
|
+
def self.acceptable_attributes
|
|
54
|
+
attribute_map.values
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Attribute type mapping.
|
|
58
|
+
def self.openapi_types
|
|
59
|
+
{
|
|
60
|
+
:'type' => :'String',
|
|
61
|
+
:'web_url' => :'String'
|
|
62
|
+
}
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# List of attributes with nullable: true
|
|
66
|
+
def self.openapi_nullable
|
|
67
|
+
Set.new([
|
|
68
|
+
:'web_url'
|
|
69
|
+
])
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Initializes the object
|
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
74
|
+
def initialize(attributes = {})
|
|
75
|
+
if (!attributes.is_a?(Hash))
|
|
76
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `KlaviyoAPI::PushOnOpenWebUrl` initialize method"
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
80
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
81
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
82
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `KlaviyoAPI::PushOnOpenWebUrl`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
83
|
+
end
|
|
84
|
+
h[k.to_sym] = v
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if attributes.key?(:'type')
|
|
88
|
+
self.type = attributes[:'type']
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
if attributes.key?(:'web_url')
|
|
92
|
+
self.web_url = attributes[:'web_url']
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
97
|
+
# @return Array for valid properties with the reasons
|
|
98
|
+
def list_invalid_properties
|
|
99
|
+
invalid_properties = Array.new
|
|
100
|
+
if @type.nil?
|
|
101
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
invalid_properties
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Check to see if the all the properties in the model are valid
|
|
108
|
+
# @return true if the model is valid
|
|
109
|
+
def valid?
|
|
110
|
+
return false if @type.nil?
|
|
111
|
+
type_validator = EnumAttributeValidator.new('String', ["open_web_url"])
|
|
112
|
+
return false unless type_validator.valid?(@type)
|
|
113
|
+
true
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
117
|
+
# @param [Object] type Object to be assigned
|
|
118
|
+
def type=(type)
|
|
119
|
+
validator = EnumAttributeValidator.new('String', ["open_web_url"])
|
|
120
|
+
unless validator.valid?(type)
|
|
121
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
122
|
+
end
|
|
123
|
+
@type = type
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Checks equality by comparing each attribute.
|
|
127
|
+
# @param [Object] Object to be compared
|
|
128
|
+
def ==(o)
|
|
129
|
+
return true if self.equal?(o)
|
|
130
|
+
self.class == o.class &&
|
|
131
|
+
type == o.type &&
|
|
132
|
+
web_url == o.web_url
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# @see the `==` method
|
|
136
|
+
# @param [Object] Object to be compared
|
|
137
|
+
def eql?(o)
|
|
138
|
+
self == o
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Calculates hash code according to all attributes.
|
|
142
|
+
# @return [Integer] Hash code
|
|
143
|
+
def hash
|
|
144
|
+
[type, web_url].hash
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Builds the object from hash
|
|
148
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
149
|
+
# @return [Object] Returns the model itself
|
|
150
|
+
def self.build_from_hash(attributes)
|
|
151
|
+
new.build_from_hash(attributes)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Builds the object from hash
|
|
155
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
156
|
+
# @return [Object] Returns the model itself
|
|
157
|
+
def build_from_hash(attributes)
|
|
158
|
+
return nil unless attributes.is_a?(Hash)
|
|
159
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
160
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
161
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
162
|
+
self.send("#{key}=", nil)
|
|
163
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
164
|
+
# check to ensure the input is an array given that the attribute
|
|
165
|
+
# is documented as an array but the input is not
|
|
166
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
167
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
168
|
+
end
|
|
169
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
170
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
self
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Deserializes the data based on type
|
|
178
|
+
# @param string type Data type
|
|
179
|
+
# @param string value Value to be deserialized
|
|
180
|
+
# @return [Object] Deserialized data
|
|
181
|
+
def _deserialize(type, value)
|
|
182
|
+
case type.to_sym
|
|
183
|
+
when :Time
|
|
184
|
+
Time.parse(value)
|
|
185
|
+
when :Date
|
|
186
|
+
Date.parse(value)
|
|
187
|
+
when :String
|
|
188
|
+
value.to_s
|
|
189
|
+
when :Integer
|
|
190
|
+
value.to_i
|
|
191
|
+
when :Float
|
|
192
|
+
value.to_f
|
|
193
|
+
when :Boolean
|
|
194
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
195
|
+
true
|
|
196
|
+
else
|
|
197
|
+
false
|
|
198
|
+
end
|
|
199
|
+
when :Object
|
|
200
|
+
# generic object (usually a Hash), return directly
|
|
201
|
+
value
|
|
202
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
203
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
204
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
205
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
206
|
+
k_type = Regexp.last_match[:k_type]
|
|
207
|
+
v_type = Regexp.last_match[:v_type]
|
|
208
|
+
{}.tap do |hash|
|
|
209
|
+
value.each do |k, v|
|
|
210
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
else # model
|
|
214
|
+
# models (e.g. Pet) or oneOf
|
|
215
|
+
klass = KlaviyoAPI.const_get(type)
|
|
216
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# Returns the string representation of the object
|
|
221
|
+
# @return [String] String presentation of the object
|
|
222
|
+
def to_s
|
|
223
|
+
to_hash.to_s
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
227
|
+
# @return [Hash] Returns the object in the form of hash
|
|
228
|
+
def to_body
|
|
229
|
+
to_hash
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
# Returns the object in the form of hash
|
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
|
234
|
+
def to_hash
|
|
235
|
+
hash = {}
|
|
236
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
237
|
+
value = self.send(attr)
|
|
238
|
+
if value.nil?
|
|
239
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
240
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
hash[param] = _to_hash(value)
|
|
244
|
+
end
|
|
245
|
+
hash
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
# Outputs non-array value in the form of hash
|
|
249
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
250
|
+
# @param [Object] value Any valid value
|
|
251
|
+
# @return [Hash] Returns the value in the form of hash
|
|
252
|
+
def _to_hash(value)
|
|
253
|
+
if value.is_a?(Array)
|
|
254
|
+
value.compact.map { |v| _to_hash(v) }
|
|
255
|
+
elsif value.is_a?(Hash)
|
|
256
|
+
{}.tap do |hash|
|
|
257
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
258
|
+
end
|
|
259
|
+
elsif value.respond_to? :to_hash
|
|
260
|
+
value.to_hash
|
|
261
|
+
else
|
|
262
|
+
value
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
end
|
|
@@ -24,6 +24,10 @@ module KlaviyoAPI
|
|
|
24
24
|
|
|
25
25
|
attr_accessor :font_weight
|
|
26
26
|
|
|
27
|
+
attr_accessor :font_style
|
|
28
|
+
|
|
29
|
+
attr_accessor :text_decoration
|
|
30
|
+
|
|
27
31
|
# Horizontal alignment enumeration.
|
|
28
32
|
attr_accessor :alignment
|
|
29
33
|
|
|
@@ -59,6 +63,8 @@ module KlaviyoAPI
|
|
|
59
63
|
:'text_color' => :'text_color',
|
|
60
64
|
:'character_spacing' => :'character_spacing',
|
|
61
65
|
:'font_weight' => :'font_weight',
|
|
66
|
+
:'font_style' => :'font_style',
|
|
67
|
+
:'text_decoration' => :'text_decoration',
|
|
62
68
|
:'alignment' => :'alignment',
|
|
63
69
|
:'line_height' => :'line_height'
|
|
64
70
|
}
|
|
@@ -77,6 +83,8 @@ module KlaviyoAPI
|
|
|
77
83
|
:'text_color' => :'String',
|
|
78
84
|
:'character_spacing' => :'Integer',
|
|
79
85
|
:'font_weight' => :'Integer',
|
|
86
|
+
:'font_style' => :'String',
|
|
87
|
+
:'text_decoration' => :'String',
|
|
80
88
|
:'alignment' => :'String',
|
|
81
89
|
:'line_height' => :'Float'
|
|
82
90
|
}
|
|
@@ -85,6 +93,8 @@ module KlaviyoAPI
|
|
|
85
93
|
# List of attributes with nullable: true
|
|
86
94
|
def self.openapi_nullable
|
|
87
95
|
Set.new([
|
|
96
|
+
:'font_style',
|
|
97
|
+
:'text_decoration',
|
|
88
98
|
])
|
|
89
99
|
end
|
|
90
100
|
|
|
@@ -133,6 +143,14 @@ module KlaviyoAPI
|
|
|
133
143
|
self.font_weight = 400
|
|
134
144
|
end
|
|
135
145
|
|
|
146
|
+
if attributes.key?(:'font_style')
|
|
147
|
+
self.font_style = attributes[:'font_style']
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
if attributes.key?(:'text_decoration')
|
|
151
|
+
self.text_decoration = attributes[:'text_decoration']
|
|
152
|
+
end
|
|
153
|
+
|
|
136
154
|
if attributes.key?(:'alignment')
|
|
137
155
|
self.alignment = attributes[:'alignment']
|
|
138
156
|
else
|
|
@@ -181,6 +199,8 @@ module KlaviyoAPI
|
|
|
181
199
|
text_color == o.text_color &&
|
|
182
200
|
character_spacing == o.character_spacing &&
|
|
183
201
|
font_weight == o.font_weight &&
|
|
202
|
+
font_style == o.font_style &&
|
|
203
|
+
text_decoration == o.text_decoration &&
|
|
184
204
|
alignment == o.alignment &&
|
|
185
205
|
line_height == o.line_height
|
|
186
206
|
end
|
|
@@ -194,7 +214,7 @@ module KlaviyoAPI
|
|
|
194
214
|
# Calculates hash code according to all attributes.
|
|
195
215
|
# @return [Integer] Hash code
|
|
196
216
|
def hash
|
|
197
|
-
[font_family, font_size, text_color, character_spacing, font_weight, alignment, line_height].hash
|
|
217
|
+
[font_family, font_size, text_color, character_spacing, font_weight, font_style, text_decoration, alignment, line_height].hash
|
|
198
218
|
end
|
|
199
219
|
|
|
200
220
|
# Builds the object from hash
|
|
@@ -16,6 +16,8 @@ module KlaviyoAPI
|
|
|
16
16
|
class RadioButtonsProperties
|
|
17
17
|
attr_accessor :display_device
|
|
18
18
|
|
|
19
|
+
attr_accessor :classname
|
|
20
|
+
|
|
19
21
|
attr_accessor :property_name
|
|
20
22
|
|
|
21
23
|
attr_accessor :label
|
|
@@ -56,6 +58,7 @@ module KlaviyoAPI
|
|
|
56
58
|
def self.attribute_map
|
|
57
59
|
{
|
|
58
60
|
:'display_device' => :'display_device',
|
|
61
|
+
:'classname' => :'classname',
|
|
59
62
|
:'property_name' => :'property_name',
|
|
60
63
|
:'label' => :'label',
|
|
61
64
|
:'show_label' => :'show_label',
|
|
@@ -75,6 +78,7 @@ module KlaviyoAPI
|
|
|
75
78
|
def self.openapi_types
|
|
76
79
|
{
|
|
77
80
|
:'display_device' => :'Array<String>',
|
|
81
|
+
:'classname' => :'String',
|
|
78
82
|
:'property_name' => :'String',
|
|
79
83
|
:'label' => :'String',
|
|
80
84
|
:'show_label' => :'Boolean',
|
|
@@ -88,6 +92,7 @@ module KlaviyoAPI
|
|
|
88
92
|
# List of attributes with nullable: true
|
|
89
93
|
def self.openapi_nullable
|
|
90
94
|
Set.new([
|
|
95
|
+
:'classname',
|
|
91
96
|
:'label',
|
|
92
97
|
:'required',
|
|
93
98
|
:'placeholder'
|
|
@@ -115,6 +120,10 @@ module KlaviyoAPI
|
|
|
115
120
|
end
|
|
116
121
|
end
|
|
117
122
|
|
|
123
|
+
if attributes.key?(:'classname')
|
|
124
|
+
self.classname = attributes[:'classname']
|
|
125
|
+
end
|
|
126
|
+
|
|
118
127
|
if attributes.key?(:'property_name')
|
|
119
128
|
self.property_name = attributes[:'property_name']
|
|
120
129
|
end
|
|
@@ -179,6 +188,7 @@ module KlaviyoAPI
|
|
|
179
188
|
return true if self.equal?(o)
|
|
180
189
|
self.class == o.class &&
|
|
181
190
|
display_device == o.display_device &&
|
|
191
|
+
classname == o.classname &&
|
|
182
192
|
property_name == o.property_name &&
|
|
183
193
|
label == o.label &&
|
|
184
194
|
show_label == o.show_label &&
|
|
@@ -197,7 +207,7 @@ module KlaviyoAPI
|
|
|
197
207
|
# Calculates hash code according to all attributes.
|
|
198
208
|
# @return [Integer] Hash code
|
|
199
209
|
def hash
|
|
200
|
-
[display_device, property_name, label, show_label, required, error_messages, options, placeholder].hash
|
|
210
|
+
[display_device, classname, property_name, label, show_label, required, error_messages, options, placeholder].hash
|
|
201
211
|
end
|
|
202
212
|
|
|
203
213
|
# Builds the object from hash
|
|
@@ -71,6 +71,8 @@ module KlaviyoAPI
|
|
|
71
71
|
|
|
72
72
|
if attributes.key?(:'url')
|
|
73
73
|
self.url = attributes[:'url']
|
|
74
|
+
else
|
|
75
|
+
self.url = ''
|
|
74
76
|
end
|
|
75
77
|
|
|
76
78
|
if attributes.key?(:'new_window')
|
|
@@ -84,17 +86,12 @@ module KlaviyoAPI
|
|
|
84
86
|
# @return Array for valid properties with the reasons
|
|
85
87
|
def list_invalid_properties
|
|
86
88
|
invalid_properties = Array.new
|
|
87
|
-
if @url.nil?
|
|
88
|
-
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
|
89
|
-
end
|
|
90
|
-
|
|
91
89
|
invalid_properties
|
|
92
90
|
end
|
|
93
91
|
|
|
94
92
|
# Check to see if the all the properties in the model are valid
|
|
95
93
|
# @return true if the model is valid
|
|
96
94
|
def valid?
|
|
97
|
-
return false if @url.nil?
|
|
98
95
|
true
|
|
99
96
|
end
|
|
100
97
|
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Klaviyo API
|
|
3
|
+
|
|
4
|
+
#The Klaviyo REST API. Please visit https://developers.klaviyo.com for more details.
|
|
5
|
+
|
|
6
|
+
Contact: developers@klaviyo.com
|
|
7
|
+
Generated by: https://openapi-generator.tech
|
|
8
|
+
OpenAPI Generator version: 6.2.1
|
|
9
|
+
|
|
10
|
+
=end
|
|
11
|
+
|
|
12
|
+
require 'date'
|
|
13
|
+
require 'time'
|
|
14
|
+
|
|
15
|
+
module KlaviyoAPI
|
|
16
|
+
class RelatedIdPath
|
|
17
|
+
# Profile identifier type
|
|
18
|
+
attr_accessor :identifier_type
|
|
19
|
+
|
|
20
|
+
# JSONPath data selector to related ID
|
|
21
|
+
attr_accessor :path
|
|
22
|
+
|
|
23
|
+
class EnumAttributeValidator
|
|
24
|
+
attr_reader :datatype
|
|
25
|
+
attr_reader :allowable_values
|
|
26
|
+
|
|
27
|
+
def initialize(datatype, allowable_values)
|
|
28
|
+
@allowable_values = allowable_values.map do |value|
|
|
29
|
+
case datatype.to_s
|
|
30
|
+
when /Integer/i
|
|
31
|
+
value.to_i
|
|
32
|
+
when /Float/i
|
|
33
|
+
value.to_f
|
|
34
|
+
else
|
|
35
|
+
value
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def valid?(value)
|
|
41
|
+
!value || allowable_values.include?(value)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
46
|
+
def self.attribute_map
|
|
47
|
+
{
|
|
48
|
+
:'identifier_type' => :'identifier_type',
|
|
49
|
+
:'path' => :'path'
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Returns all the JSON keys this model knows about
|
|
54
|
+
def self.acceptable_attributes
|
|
55
|
+
attribute_map.values
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Attribute type mapping.
|
|
59
|
+
def self.openapi_types
|
|
60
|
+
{
|
|
61
|
+
:'identifier_type' => :'String',
|
|
62
|
+
:'path' => :'String'
|
|
63
|
+
}
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# List of attributes with nullable: true
|
|
67
|
+
def self.openapi_nullable
|
|
68
|
+
Set.new([
|
|
69
|
+
])
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Initializes the object
|
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
74
|
+
def initialize(attributes = {})
|
|
75
|
+
if (!attributes.is_a?(Hash))
|
|
76
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `KlaviyoAPI::RelatedIdPath` initialize method"
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
80
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
81
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
82
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `KlaviyoAPI::RelatedIdPath`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
83
|
+
end
|
|
84
|
+
h[k.to_sym] = v
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if attributes.key?(:'identifier_type')
|
|
88
|
+
self.identifier_type = attributes[:'identifier_type']
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
if attributes.key?(:'path')
|
|
92
|
+
self.path = attributes[:'path']
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
97
|
+
# @return Array for valid properties with the reasons
|
|
98
|
+
def list_invalid_properties
|
|
99
|
+
invalid_properties = Array.new
|
|
100
|
+
if @identifier_type.nil?
|
|
101
|
+
invalid_properties.push('invalid value for "identifier_type", identifier_type cannot be nil.')
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if @path.nil?
|
|
105
|
+
invalid_properties.push('invalid value for "path", path cannot be nil.')
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
invalid_properties
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Check to see if the all the properties in the model are valid
|
|
112
|
+
# @return true if the model is valid
|
|
113
|
+
def valid?
|
|
114
|
+
return false if @identifier_type.nil?
|
|
115
|
+
identifier_type_validator = EnumAttributeValidator.new('String', ["anonymous", "email", "external-id", "klaviyo-id", "phone"])
|
|
116
|
+
return false unless identifier_type_validator.valid?(@identifier_type)
|
|
117
|
+
return false if @path.nil?
|
|
118
|
+
true
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
122
|
+
# @param [Object] identifier_type Object to be assigned
|
|
123
|
+
def identifier_type=(identifier_type)
|
|
124
|
+
validator = EnumAttributeValidator.new('String', ["anonymous", "email", "external-id", "klaviyo-id", "phone"])
|
|
125
|
+
unless validator.valid?(identifier_type)
|
|
126
|
+
fail ArgumentError, "invalid value for \"identifier_type\", must be one of #{validator.allowable_values}."
|
|
127
|
+
end
|
|
128
|
+
@identifier_type = identifier_type
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Checks equality by comparing each attribute.
|
|
132
|
+
# @param [Object] Object to be compared
|
|
133
|
+
def ==(o)
|
|
134
|
+
return true if self.equal?(o)
|
|
135
|
+
self.class == o.class &&
|
|
136
|
+
identifier_type == o.identifier_type &&
|
|
137
|
+
path == o.path
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# @see the `==` method
|
|
141
|
+
# @param [Object] Object to be compared
|
|
142
|
+
def eql?(o)
|
|
143
|
+
self == o
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Calculates hash code according to all attributes.
|
|
147
|
+
# @return [Integer] Hash code
|
|
148
|
+
def hash
|
|
149
|
+
[identifier_type, path].hash
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Builds the object from hash
|
|
153
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
154
|
+
# @return [Object] Returns the model itself
|
|
155
|
+
def self.build_from_hash(attributes)
|
|
156
|
+
new.build_from_hash(attributes)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Builds the object from hash
|
|
160
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
161
|
+
# @return [Object] Returns the model itself
|
|
162
|
+
def build_from_hash(attributes)
|
|
163
|
+
return nil unless attributes.is_a?(Hash)
|
|
164
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
165
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
166
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
167
|
+
self.send("#{key}=", nil)
|
|
168
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
169
|
+
# check to ensure the input is an array given that the attribute
|
|
170
|
+
# is documented as an array but the input is not
|
|
171
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
172
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
173
|
+
end
|
|
174
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
175
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
self
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Deserializes the data based on type
|
|
183
|
+
# @param string type Data type
|
|
184
|
+
# @param string value Value to be deserialized
|
|
185
|
+
# @return [Object] Deserialized data
|
|
186
|
+
def _deserialize(type, value)
|
|
187
|
+
case type.to_sym
|
|
188
|
+
when :Time
|
|
189
|
+
Time.parse(value)
|
|
190
|
+
when :Date
|
|
191
|
+
Date.parse(value)
|
|
192
|
+
when :String
|
|
193
|
+
value.to_s
|
|
194
|
+
when :Integer
|
|
195
|
+
value.to_i
|
|
196
|
+
when :Float
|
|
197
|
+
value.to_f
|
|
198
|
+
when :Boolean
|
|
199
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
200
|
+
true
|
|
201
|
+
else
|
|
202
|
+
false
|
|
203
|
+
end
|
|
204
|
+
when :Object
|
|
205
|
+
# generic object (usually a Hash), return directly
|
|
206
|
+
value
|
|
207
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
208
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
209
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
210
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
211
|
+
k_type = Regexp.last_match[:k_type]
|
|
212
|
+
v_type = Regexp.last_match[:v_type]
|
|
213
|
+
{}.tap do |hash|
|
|
214
|
+
value.each do |k, v|
|
|
215
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
else # model
|
|
219
|
+
# models (e.g. Pet) or oneOf
|
|
220
|
+
klass = KlaviyoAPI.const_get(type)
|
|
221
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# Returns the string representation of the object
|
|
226
|
+
# @return [String] String presentation of the object
|
|
227
|
+
def to_s
|
|
228
|
+
to_hash.to_s
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
232
|
+
# @return [Hash] Returns the object in the form of hash
|
|
233
|
+
def to_body
|
|
234
|
+
to_hash
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Returns the object in the form of hash
|
|
238
|
+
# @return [Hash] Returns the object in the form of hash
|
|
239
|
+
def to_hash
|
|
240
|
+
hash = {}
|
|
241
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
242
|
+
value = self.send(attr)
|
|
243
|
+
if value.nil?
|
|
244
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
245
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
hash[param] = _to_hash(value)
|
|
249
|
+
end
|
|
250
|
+
hash
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
# Outputs non-array value in the form of hash
|
|
254
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
255
|
+
# @param [Object] value Any valid value
|
|
256
|
+
# @return [Hash] Returns the value in the form of hash
|
|
257
|
+
def _to_hash(value)
|
|
258
|
+
if value.is_a?(Array)
|
|
259
|
+
value.compact.map { |v| _to_hash(v) }
|
|
260
|
+
elsif value.is_a?(Hash)
|
|
261
|
+
{}.tap do |hash|
|
|
262
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
263
|
+
end
|
|
264
|
+
elsif value.respond_to? :to_hash
|
|
265
|
+
value.to_hash
|
|
266
|
+
else
|
|
267
|
+
value
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
end
|