hubspot-api-client 16.2.0 → 16.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/Gemfile.lock +1 -1
- data/lib/hubspot/codegen/automation/actions/models/action_function.rb +1 -0
- data/lib/hubspot/codegen/automation/actions/models/action_function_identifier.rb +1 -0
- data/lib/hubspot/codegen/automation/actions/models/action_labels.rb +1 -0
- data/lib/hubspot/codegen/automation/actions/models/action_revision.rb +1 -0
- data/lib/hubspot/codegen/automation/actions/models/callback_completion_batch_request.rb +1 -0
- data/lib/hubspot/codegen/automation/actions/models/callback_completion_request.rb +1 -0
- data/lib/hubspot/codegen/automation/actions/models/extension_action_definition.rb +1 -0
- data/lib/hubspot/codegen/automation/actions/models/extension_action_definition_input.rb +1 -0
- data/lib/hubspot/codegen/automation/actions/models/extension_action_definition_patch.rb +1 -0
- data/lib/hubspot/codegen/automation/actions/models/extension_action_definition_patch_input_field_dependencies_inner.rb +1 -0
- data/lib/hubspot/codegen/automation/actions/models/field_type_definition.rb +1 -0
- data/lib/hubspot/codegen/automation/actions/models/input_field_definition.rb +1 -0
- data/lib/hubspot/codegen/automation/actions/models/object_request_options.rb +1 -0
- data/lib/hubspot/codegen/automation/actions/models/option.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/authors/models/attach_to_lang_primary_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/authors/models/batch_input_blog_author.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/authors/models/batch_input_json_node.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/authors/models/batch_input_string.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/authors/models/batch_response_blog_author.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/authors/models/batch_response_blog_author_with_errors.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/authors/models/blog_author.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/authors/models/blog_author_clone_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/authors/models/collection_response_with_total_blog_author_forward_paging.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/authors/models/detach_from_lang_group_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/authors/models/forward_paging.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/authors/models/next_page.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/authors/models/set_new_language_primary_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/authors/models/standard_error.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/authors/models/update_languages_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/attach_to_lang_primary_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/batch_input_blog_post.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/batch_input_json_node.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/batch_input_string.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/batch_response_blog_post.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/batch_response_blog_post_with_errors.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/blog_post.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/blog_post_language_clone_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/collection_response_with_total_blog_post_forward_paging.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/collection_response_with_total_version_blog_post.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/content_clone_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/content_schedule_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/detach_from_lang_group_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/forward_paging.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/next_page.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/paging.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/previous_page.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/rgba_color.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/set_new_language_primary_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/standard_error.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/update_languages_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/version_blog_post.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/blog-posts/models/version_user.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/tags/models/attach_to_lang_primary_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/tags/models/batch_input_json_node.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/tags/models/batch_input_string.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/tags/models/batch_input_tag.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/tags/models/batch_response_tag.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/tags/models/batch_response_tag_with_errors.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/tags/models/collection_response_with_total_tag_forward_paging.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/tags/models/detach_from_lang_group_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/tags/models/forward_paging.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/tags/models/next_page.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/tags/models/set_new_language_primary_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/tags/models/standard_error.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/tags/models/tag.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/tags/models/tag_clone_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/cms/blogs/tags/models/update_languages_request_v_next.rb +1 -0
- data/lib/hubspot/codegen/conversations/visitor-identification/models/identification_token_generation_request.rb +1 -0
- data/lib/hubspot/codegen/conversations/visitor-identification/models/identification_token_response.rb +1 -0
- data/lib/hubspot/codegen/crm/associations/api/batch_api.rb +30 -18
- data/lib/hubspot/codegen/crm/associations/api/types_api.rb +3 -3
- data/lib/hubspot/codegen/crm/associations/models/batch_response_public_association.rb +29 -38
- data/lib/hubspot/codegen/crm/associations/models/batch_response_public_association_multi.rb +29 -38
- data/lib/hubspot/codegen/crm/associations/models/batch_response_public_association_multi_with_errors.rb +346 -0
- data/lib/hubspot/codegen/crm/associations/models/batch_response_public_association_with_errors.rb +346 -0
- data/lib/hubspot/codegen/crm/associations/models/collection_response_public_association_definition_no_paging.rb +230 -0
- data/lib/hubspot/codegen/crm/associations/models/error_category.rb +20 -20
- data/lib/hubspot/codegen/crm/associations/models/paging.rb +13 -4
- data/lib/hubspot/codegen/crm/associations/models/previous_page.rb +237 -0
- data/lib/hubspot/codegen/crm/associations/models/public_association_definition.rb +242 -0
- data/lib/hubspot/codegen/crm/associations/models/public_association_multi.rb +13 -4
- data/lib/hubspot/codegen/crm/extensions/accounting/models/accounting_app_settings.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/accounting_app_urls.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/accounting_extension_customer.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/accounting_extension_invoice.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/accounting_extension_term.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/accounting_features.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/address.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/create_invoice_feature.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/create_invoice_sub_features.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/create_user_account_request_external.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/customer_search_response_external.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/exchange_rate_response.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/import_invoice_feature.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/invoice_pdf_response.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/invoice_read_response.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/invoice_search_response.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/invoice_update_request.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/invoices_response_external.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/product.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/product_search_response.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/result_id_accounting_response.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/sync_contacts_request.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/sync_products_request.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/tax.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/tax_search_response.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/tax_type.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/terms_response.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/unit_price.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/updated_contact.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/accounting/models/updated_product.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/calling/models/settings_patch_request.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/calling/models/settings_request.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/calling/models/settings_response.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/cards/models/card_actions.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/cards/models/card_create_request.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/cards/models/card_display_body.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/cards/models/card_display_property.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/cards/models/card_fetch_body.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/cards/models/card_fetch_body_patch.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/cards/models/card_list_response.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/cards/models/card_patch_request.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/cards/models/card_response.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/cards/models/display_option.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/cards/models/integrator_card_payload_response.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/cards/models/integrator_object_result_actions_inner.rb +1 -0
- data/lib/hubspot/codegen/crm/extensions/videoconferencing/models/external_settings.rb +1 -0
- data/lib/hubspot/codegen/files/files/models/collection_response_file.rb +1 -0
- data/lib/hubspot/codegen/files/files/models/file_update_input.rb +1 -0
- data/lib/hubspot/codegen/files/files/models/folder_input.rb +1 -0
- data/lib/hubspot/codegen/files/files/models/folder_update_input.rb +1 -0
- data/lib/hubspot/codegen/files/files/models/folder_update_task_locator.rb +1 -0
- data/lib/hubspot/codegen/files/files/models/hubspot_file.rb +1 -0
- data/lib/hubspot/codegen/files/files/models/import_from_url_task_locator.rb +1 -0
- data/lib/hubspot/codegen/marketing/events/api/marketing_events_external_api.rb +0 -60
- data/lib/hubspot/codegen/marketing/events/api/search_api.rb +90 -0
- data/lib/hubspot/codegen/marketing/events/models/batch_input_marketing_event_email_subscriber.rb +1 -0
- data/lib/hubspot/codegen/marketing/events/models/batch_input_marketing_event_subscriber.rb +1 -0
- data/lib/hubspot/codegen/marketing/events/models/property_value.rb +13 -4
- data/lib/hubspot/codegen/marketing/forms/models/collection_response_form_definition_base_forward_paging_results_inner.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/datepicker_field.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/dependent_field.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/dependent_field_dependent_field.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/dependent_field_filter.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/dropdown_field.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/email_field.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/email_field_validation.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/field_group.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/file_field.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/form_definition_base.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/form_definition_create_request_base.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/form_display_options.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/form_post_submit_action.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/form_style.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/hub_spot_form_definition_patch_request_legal_consent_options.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/mobile_phone_field.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/multi_line_text_field.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/multiple_checkboxes_field.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/number_field.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/number_field_validation.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/phone_field.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/phone_field_validation.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/radio_field.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/single_checkbox_field.rb +1 -0
- data/lib/hubspot/codegen/marketing/forms/models/single_line_text_field.rb +1 -0
- data/lib/hubspot/codegen/marketing/transactional/models/email_send_status_view.rb +1 -0
- data/lib/hubspot/codegen/marketing/transactional/models/event_id_view.rb +1 -0
- data/lib/hubspot/codegen/marketing/transactional/models/public_single_send_email.rb +1 -0
- data/lib/hubspot/codegen/marketing/transactional/models/public_single_send_request_egg.rb +1 -0
- data/lib/hubspot/codegen/marketing/transactional/models/smtp_api_token_request_egg.rb +1 -0
- data/lib/hubspot/codegen/marketing/transactional/models/smtp_api_token_view.rb +1 -0
- data/lib/hubspot/codegen/settings/users/models/public_permission_set.rb +1 -0
- data/lib/hubspot/codegen/settings/users/models/public_team.rb +1 -0
- data/lib/hubspot/codegen/settings/users/models/public_user.rb +1 -0
- data/lib/hubspot/codegen/settings/users/models/public_user_update.rb +1 -0
- data/lib/hubspot/codegen/settings/users/models/user_provision_request.rb +1 -0
- data/lib/hubspot/discovery/marketing/events/api/search_api.rb +13 -0
- data/lib/hubspot/discovery/marketing/events/client.rb +1 -0
- data/lib/hubspot/version.rb +1 -1
- data/spec/discovery/marketing/events/marketing_events_external_api_spec.rb +0 -1
- data/spec/discovery/marketing/events/search_api_spec.rb +7 -0
- metadata +12 -3
@@ -0,0 +1,230 @@
|
|
1
|
+
=begin
|
2
|
+
#Associations
|
3
|
+
|
4
|
+
#Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.2.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Hubspot
|
17
|
+
module Crm
|
18
|
+
module Associations
|
19
|
+
class CollectionResponsePublicAssociationDefinitionNoPaging
|
20
|
+
attr_accessor :results
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'results' => :'results'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns all the JSON keys this model knows about
|
30
|
+
def self.acceptable_attributes
|
31
|
+
attribute_map.values
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.openapi_types
|
36
|
+
{
|
37
|
+
:'results' => :'Array<PublicAssociationDefinition>'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# List of attributes with nullable: true
|
42
|
+
def self.openapi_nullable
|
43
|
+
Set.new([
|
44
|
+
])
|
45
|
+
end
|
46
|
+
|
47
|
+
# Initializes the object
|
48
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
49
|
+
def initialize(attributes = {})
|
50
|
+
if (!attributes.is_a?(Hash))
|
51
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Crm::Associations::CollectionResponsePublicAssociationDefinitionNoPaging` initialize method"
|
52
|
+
end
|
53
|
+
|
54
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
55
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
56
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
57
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Crm::Associations::CollectionResponsePublicAssociationDefinitionNoPaging`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
58
|
+
end
|
59
|
+
h[k.to_sym] = v
|
60
|
+
}
|
61
|
+
|
62
|
+
if attributes.key?(:'results')
|
63
|
+
if (value = attributes[:'results']).is_a?(Array)
|
64
|
+
self.results = value
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
70
|
+
# @return Array for valid properties with the reasons
|
71
|
+
def list_invalid_properties
|
72
|
+
invalid_properties = Array.new
|
73
|
+
if @results.nil?
|
74
|
+
invalid_properties.push('invalid value for "results", results cannot be nil.')
|
75
|
+
end
|
76
|
+
|
77
|
+
invalid_properties
|
78
|
+
end
|
79
|
+
|
80
|
+
# Check to see if the all the properties in the model are valid
|
81
|
+
# @return true if the model is valid
|
82
|
+
def valid?
|
83
|
+
return false if @results.nil?
|
84
|
+
true
|
85
|
+
end
|
86
|
+
|
87
|
+
# Checks equality by comparing each attribute.
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def ==(o)
|
90
|
+
return true if self.equal?(o)
|
91
|
+
self.class == o.class &&
|
92
|
+
results == o.results
|
93
|
+
end
|
94
|
+
|
95
|
+
# @see the `==` method
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def eql?(o)
|
98
|
+
self == o
|
99
|
+
end
|
100
|
+
|
101
|
+
# Calculates hash code according to all attributes.
|
102
|
+
# @return [Integer] Hash code
|
103
|
+
def hash
|
104
|
+
[results].hash
|
105
|
+
end
|
106
|
+
|
107
|
+
# Builds the object from hash
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
+
# @return [Object] Returns the model itself
|
110
|
+
def self.build_from_hash(attributes)
|
111
|
+
new.build_from_hash(attributes)
|
112
|
+
end
|
113
|
+
|
114
|
+
# Builds the object from hash
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
+
# @return [Object] Returns the model itself
|
117
|
+
def build_from_hash(attributes)
|
118
|
+
return nil unless attributes.is_a?(Hash)
|
119
|
+
attributes = attributes.transform_keys(&:to_sym)
|
120
|
+
self.class.openapi_types.each_pair do |key, type|
|
121
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
122
|
+
self.send("#{key}=", nil)
|
123
|
+
elsif type =~ /\AArray<(.*)>/i
|
124
|
+
# check to ensure the input is an array given that the attribute
|
125
|
+
# is documented as an array but the input is not
|
126
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
127
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
128
|
+
end
|
129
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
130
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
self
|
135
|
+
end
|
136
|
+
|
137
|
+
# Deserializes the data based on type
|
138
|
+
# @param string type Data type
|
139
|
+
# @param string value Value to be deserialized
|
140
|
+
# @return [Object] Deserialized data
|
141
|
+
def _deserialize(type, value)
|
142
|
+
case type.to_sym
|
143
|
+
when :Time
|
144
|
+
Time.parse(value)
|
145
|
+
when :Date
|
146
|
+
Date.parse(value)
|
147
|
+
when :String
|
148
|
+
value.to_s
|
149
|
+
when :Integer
|
150
|
+
value.to_i
|
151
|
+
when :Float
|
152
|
+
value.to_f
|
153
|
+
when :Boolean
|
154
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
155
|
+
true
|
156
|
+
else
|
157
|
+
false
|
158
|
+
end
|
159
|
+
when :Object
|
160
|
+
# generic object (usually a Hash), return directly
|
161
|
+
value
|
162
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
163
|
+
inner_type = Regexp.last_match[:inner_type]
|
164
|
+
value.map { |v| _deserialize(inner_type, v) }
|
165
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
166
|
+
k_type = Regexp.last_match[:k_type]
|
167
|
+
v_type = Regexp.last_match[:v_type]
|
168
|
+
{}.tap do |hash|
|
169
|
+
value.each do |k, v|
|
170
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
else # model
|
174
|
+
# models (e.g. Pet) or oneOf
|
175
|
+
klass = Hubspot::Crm::Associations.const_get(type)
|
176
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns the string representation of the object
|
181
|
+
# @return [String] String presentation of the object
|
182
|
+
def to_s
|
183
|
+
to_hash.to_s
|
184
|
+
end
|
185
|
+
|
186
|
+
# to_body is an alias to to_hash (backward compatibility)
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
188
|
+
def to_body
|
189
|
+
to_hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Returns the object in the form of hash
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
194
|
+
def to_hash
|
195
|
+
hash = {}
|
196
|
+
self.class.attribute_map.each_pair do |attr, param|
|
197
|
+
value = self.send(attr)
|
198
|
+
if value.nil?
|
199
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
200
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
201
|
+
end
|
202
|
+
|
203
|
+
hash[param] = _to_hash(value)
|
204
|
+
end
|
205
|
+
hash
|
206
|
+
end
|
207
|
+
|
208
|
+
# Outputs non-array value in the form of hash
|
209
|
+
# For object, use to_hash. Otherwise, just return the value
|
210
|
+
# @param [Object] value Any valid value
|
211
|
+
# @return [Hash] Returns the value in the form of hash
|
212
|
+
def _to_hash(value)
|
213
|
+
if value.is_a?(Array)
|
214
|
+
value.compact.map { |v| _to_hash(v) }
|
215
|
+
elsif value.is_a?(Hash)
|
216
|
+
{}.tap do |hash|
|
217
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
218
|
+
end
|
219
|
+
elsif value.respond_to? :to_hash
|
220
|
+
value.to_hash
|
221
|
+
else
|
222
|
+
value
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
end
|
227
|
+
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
@@ -17,10 +17,10 @@ module Hubspot
|
|
17
17
|
module Crm
|
18
18
|
module Associations
|
19
19
|
class ErrorCategory
|
20
|
-
attr_accessor :http_status
|
21
|
-
|
22
20
|
attr_accessor :name
|
23
21
|
|
22
|
+
attr_accessor :http_status
|
23
|
+
|
24
24
|
class EnumAttributeValidator
|
25
25
|
attr_reader :datatype
|
26
26
|
attr_reader :allowable_values
|
@@ -46,8 +46,8 @@ module Hubspot
|
|
46
46
|
# Attribute mapping from ruby-style variable name to JSON key.
|
47
47
|
def self.attribute_map
|
48
48
|
{
|
49
|
-
:'
|
50
|
-
:'
|
49
|
+
:'name' => :'name',
|
50
|
+
:'http_status' => :'httpStatus'
|
51
51
|
}
|
52
52
|
end
|
53
53
|
|
@@ -59,8 +59,8 @@ module Hubspot
|
|
59
59
|
# Attribute type mapping.
|
60
60
|
def self.openapi_types
|
61
61
|
{
|
62
|
-
:'
|
63
|
-
:'
|
62
|
+
:'name' => :'String',
|
63
|
+
:'http_status' => :'String'
|
64
64
|
}
|
65
65
|
end
|
66
66
|
|
@@ -85,44 +85,44 @@ module Hubspot
|
|
85
85
|
h[k.to_sym] = v
|
86
86
|
}
|
87
87
|
|
88
|
-
if attributes.key?(:'http_status')
|
89
|
-
self.http_status = attributes[:'http_status']
|
90
|
-
end
|
91
|
-
|
92
88
|
if attributes.key?(:'name')
|
93
89
|
self.name = attributes[:'name']
|
94
90
|
end
|
91
|
+
|
92
|
+
if attributes.key?(:'http_status')
|
93
|
+
self.http_status = attributes[:'http_status']
|
94
|
+
end
|
95
95
|
end
|
96
96
|
|
97
97
|
# Show invalid properties with the reasons. Usually used together with valid?
|
98
98
|
# @return Array for valid properties with the reasons
|
99
99
|
def list_invalid_properties
|
100
100
|
invalid_properties = Array.new
|
101
|
-
if @http_status.nil?
|
102
|
-
invalid_properties.push('invalid value for "http_status", http_status cannot be nil.')
|
103
|
-
end
|
104
|
-
|
105
101
|
if @name.nil?
|
106
102
|
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
107
103
|
end
|
108
104
|
|
105
|
+
if @http_status.nil?
|
106
|
+
invalid_properties.push('invalid value for "http_status", http_status cannot be nil.')
|
107
|
+
end
|
108
|
+
|
109
109
|
invalid_properties
|
110
110
|
end
|
111
111
|
|
112
112
|
# Check to see if the all the properties in the model are valid
|
113
113
|
# @return true if the model is valid
|
114
114
|
def valid?
|
115
|
+
return false if @name.nil?
|
115
116
|
return false if @http_status.nil?
|
116
|
-
http_status_validator = EnumAttributeValidator.new('String', ["CONTINUE", "SWITCHING_PROTOCOLS", "PROCESSING", "OK", "CREATED", "ACCEPTED", "NON_AUTHORITATIVE_INFORMATION", "NO_CONTENT", "RESET_CONTENT", "PARTIAL_CONTENT", "MULTI_STATUS", "ALREADY_REPORTED", "IM_USED", "MULTIPLE_CHOICES", "MOVED_PERMANENTLY", "FOUND", "SEE_OTHER", "NOT_MODIFIED", "USE_PROXY", "TEMPORARY_REDIRECT", "PERMANENT_REDIRECT", "BAD_REQUEST", "UNAUTHORIZED", "PAYMENT_REQUIRED", "FORBIDDEN", "NOT_FOUND", "METHOD_NOT_ALLOWED", "NOT_ACCEPTABLE", "PROXY_AUTHENTICATION_REQUIRED", "REQUEST_TIMEOUT", "CONFLICT", "GONE", "LENGTH_REQUIRED", "PRECONDITION_FAILED", "REQUEST_ENTITY_TOO_LARGE", "REQUEST_URI_TOO_LONG", "UNSUPPORTED_MEDIA_TYPE", "REQUESTED_RANGE_NOT_SATISFIABLE", "EXPECTATION_FAILED", "IM_A_TEAPOT", "MISDIRECTED_REQUEST", "UNPROCESSABLE_ENTITY", "LOCKED", "FAILED_DEPENDENCY", "UPGRADE_REQUIRED", "PRECONDITION_REQUIRED", "TOO_MANY_REQUESTS", "REQUEST_HEADERS_FIELDS_TOO_LARGE", "INTERNAL_STALE_SERVICE_DISCOVERY", "UNAVAILABLE_FOR_LEGAL_REASONS", "INTERNAL_SERVER_ERROR", "NOT_IMPLEMENTED", "BAD_GATEWAY", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT", "HTTP_VERSION_NOT_SUPPORTED", "VARIANT_ALSO_NEGOTIATES", "INSUFFICIENT_STORAGE", "LOOP_DETECTED", "NOT_EXTENDED", "NETWORK_AUTHENTICATION_REQUIRED"])
|
117
|
+
http_status_validator = EnumAttributeValidator.new('String', ["CONTINUE", "SWITCHING_PROTOCOLS", "PROCESSING", "OK", "CREATED", "ACCEPTED", "NON_AUTHORITATIVE_INFORMATION", "NO_CONTENT", "RESET_CONTENT", "PARTIAL_CONTENT", "MULTI_STATUS", "ALREADY_REPORTED", "IM_USED", "MULTIPLE_CHOICES", "MOVED_PERMANENTLY", "FOUND", "SEE_OTHER", "NOT_MODIFIED", "USE_PROXY", "TEMPORARY_REDIRECT", "PERMANENT_REDIRECT", "BAD_REQUEST", "UNAUTHORIZED", "PAYMENT_REQUIRED", "FORBIDDEN", "NOT_FOUND", "METHOD_NOT_ALLOWED", "NOT_ACCEPTABLE", "PROXY_AUTHENTICATION_REQUIRED", "REQUEST_TIMEOUT", "CONFLICT", "GONE", "LENGTH_REQUIRED", "PRECONDITION_FAILED", "REQUEST_ENTITY_TOO_LARGE", "REQUEST_URI_TOO_LONG", "UNSUPPORTED_MEDIA_TYPE", "REQUESTED_RANGE_NOT_SATISFIABLE", "EXPECTATION_FAILED", "IM_A_TEAPOT", "MISDIRECTED_REQUEST", "UNPROCESSABLE_ENTITY", "LOCKED", "FAILED_DEPENDENCY", "UPGRADE_REQUIRED", "PRECONDITION_REQUIRED", "TOO_MANY_REQUESTS", "REQUEST_HEADERS_FIELDS_TOO_LARGE", "INTERNAL_STALE_SERVICE_DISCOVERY", "UNAVAILABLE_FOR_LEGAL_REASONS", "MIGRATION_IN_PROGRESS", "INTERNAL_SERVER_ERROR", "NOT_IMPLEMENTED", "BAD_GATEWAY", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT", "HTTP_VERSION_NOT_SUPPORTED", "VARIANT_ALSO_NEGOTIATES", "INSUFFICIENT_STORAGE", "LOOP_DETECTED", "NOT_EXTENDED", "NETWORK_AUTHENTICATION_REQUIRED"])
|
117
118
|
return false unless http_status_validator.valid?(@http_status)
|
118
|
-
return false if @name.nil?
|
119
119
|
true
|
120
120
|
end
|
121
121
|
|
122
122
|
# Custom attribute writer method checking allowed values (enum).
|
123
123
|
# @param [Object] http_status Object to be assigned
|
124
124
|
def http_status=(http_status)
|
125
|
-
validator = EnumAttributeValidator.new('String', ["CONTINUE", "SWITCHING_PROTOCOLS", "PROCESSING", "OK", "CREATED", "ACCEPTED", "NON_AUTHORITATIVE_INFORMATION", "NO_CONTENT", "RESET_CONTENT", "PARTIAL_CONTENT", "MULTI_STATUS", "ALREADY_REPORTED", "IM_USED", "MULTIPLE_CHOICES", "MOVED_PERMANENTLY", "FOUND", "SEE_OTHER", "NOT_MODIFIED", "USE_PROXY", "TEMPORARY_REDIRECT", "PERMANENT_REDIRECT", "BAD_REQUEST", "UNAUTHORIZED", "PAYMENT_REQUIRED", "FORBIDDEN", "NOT_FOUND", "METHOD_NOT_ALLOWED", "NOT_ACCEPTABLE", "PROXY_AUTHENTICATION_REQUIRED", "REQUEST_TIMEOUT", "CONFLICT", "GONE", "LENGTH_REQUIRED", "PRECONDITION_FAILED", "REQUEST_ENTITY_TOO_LARGE", "REQUEST_URI_TOO_LONG", "UNSUPPORTED_MEDIA_TYPE", "REQUESTED_RANGE_NOT_SATISFIABLE", "EXPECTATION_FAILED", "IM_A_TEAPOT", "MISDIRECTED_REQUEST", "UNPROCESSABLE_ENTITY", "LOCKED", "FAILED_DEPENDENCY", "UPGRADE_REQUIRED", "PRECONDITION_REQUIRED", "TOO_MANY_REQUESTS", "REQUEST_HEADERS_FIELDS_TOO_LARGE", "INTERNAL_STALE_SERVICE_DISCOVERY", "UNAVAILABLE_FOR_LEGAL_REASONS", "INTERNAL_SERVER_ERROR", "NOT_IMPLEMENTED", "BAD_GATEWAY", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT", "HTTP_VERSION_NOT_SUPPORTED", "VARIANT_ALSO_NEGOTIATES", "INSUFFICIENT_STORAGE", "LOOP_DETECTED", "NOT_EXTENDED", "NETWORK_AUTHENTICATION_REQUIRED"])
|
125
|
+
validator = EnumAttributeValidator.new('String', ["CONTINUE", "SWITCHING_PROTOCOLS", "PROCESSING", "OK", "CREATED", "ACCEPTED", "NON_AUTHORITATIVE_INFORMATION", "NO_CONTENT", "RESET_CONTENT", "PARTIAL_CONTENT", "MULTI_STATUS", "ALREADY_REPORTED", "IM_USED", "MULTIPLE_CHOICES", "MOVED_PERMANENTLY", "FOUND", "SEE_OTHER", "NOT_MODIFIED", "USE_PROXY", "TEMPORARY_REDIRECT", "PERMANENT_REDIRECT", "BAD_REQUEST", "UNAUTHORIZED", "PAYMENT_REQUIRED", "FORBIDDEN", "NOT_FOUND", "METHOD_NOT_ALLOWED", "NOT_ACCEPTABLE", "PROXY_AUTHENTICATION_REQUIRED", "REQUEST_TIMEOUT", "CONFLICT", "GONE", "LENGTH_REQUIRED", "PRECONDITION_FAILED", "REQUEST_ENTITY_TOO_LARGE", "REQUEST_URI_TOO_LONG", "UNSUPPORTED_MEDIA_TYPE", "REQUESTED_RANGE_NOT_SATISFIABLE", "EXPECTATION_FAILED", "IM_A_TEAPOT", "MISDIRECTED_REQUEST", "UNPROCESSABLE_ENTITY", "LOCKED", "FAILED_DEPENDENCY", "UPGRADE_REQUIRED", "PRECONDITION_REQUIRED", "TOO_MANY_REQUESTS", "REQUEST_HEADERS_FIELDS_TOO_LARGE", "INTERNAL_STALE_SERVICE_DISCOVERY", "UNAVAILABLE_FOR_LEGAL_REASONS", "MIGRATION_IN_PROGRESS", "INTERNAL_SERVER_ERROR", "NOT_IMPLEMENTED", "BAD_GATEWAY", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT", "HTTP_VERSION_NOT_SUPPORTED", "VARIANT_ALSO_NEGOTIATES", "INSUFFICIENT_STORAGE", "LOOP_DETECTED", "NOT_EXTENDED", "NETWORK_AUTHENTICATION_REQUIRED"])
|
126
126
|
unless validator.valid?(http_status)
|
127
127
|
fail ArgumentError, "invalid value for \"http_status\", must be one of #{validator.allowable_values}."
|
128
128
|
end
|
@@ -134,8 +134,8 @@ module Hubspot
|
|
134
134
|
def ==(o)
|
135
135
|
return true if self.equal?(o)
|
136
136
|
self.class == o.class &&
|
137
|
-
|
138
|
-
|
137
|
+
name == o.name &&
|
138
|
+
http_status == o.http_status
|
139
139
|
end
|
140
140
|
|
141
141
|
# @see the `==` method
|
@@ -147,7 +147,7 @@ module Hubspot
|
|
147
147
|
# Calculates hash code according to all attributes.
|
148
148
|
# @return [Integer] Hash code
|
149
149
|
def hash
|
150
|
-
[
|
150
|
+
[name, http_status].hash
|
151
151
|
end
|
152
152
|
|
153
153
|
# Builds the object from hash
|
@@ -19,10 +19,13 @@ module Hubspot
|
|
19
19
|
class Paging
|
20
20
|
attr_accessor :_next
|
21
21
|
|
22
|
+
attr_accessor :prev
|
23
|
+
|
22
24
|
# Attribute mapping from ruby-style variable name to JSON key.
|
23
25
|
def self.attribute_map
|
24
26
|
{
|
25
|
-
:'_next' => :'next'
|
27
|
+
:'_next' => :'next',
|
28
|
+
:'prev' => :'prev'
|
26
29
|
}
|
27
30
|
end
|
28
31
|
|
@@ -34,7 +37,8 @@ module Hubspot
|
|
34
37
|
# Attribute type mapping.
|
35
38
|
def self.openapi_types
|
36
39
|
{
|
37
|
-
:'_next' => :'NextPage'
|
40
|
+
:'_next' => :'NextPage',
|
41
|
+
:'prev' => :'PreviousPage'
|
38
42
|
}
|
39
43
|
end
|
40
44
|
|
@@ -62,6 +66,10 @@ module Hubspot
|
|
62
66
|
if attributes.key?(:'_next')
|
63
67
|
self._next = attributes[:'_next']
|
64
68
|
end
|
69
|
+
|
70
|
+
if attributes.key?(:'prev')
|
71
|
+
self.prev = attributes[:'prev']
|
72
|
+
end
|
65
73
|
end
|
66
74
|
|
67
75
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -82,7 +90,8 @@ module Hubspot
|
|
82
90
|
def ==(o)
|
83
91
|
return true if self.equal?(o)
|
84
92
|
self.class == o.class &&
|
85
|
-
_next == o._next
|
93
|
+
_next == o._next &&
|
94
|
+
prev == o.prev
|
86
95
|
end
|
87
96
|
|
88
97
|
# @see the `==` method
|
@@ -94,7 +103,7 @@ module Hubspot
|
|
94
103
|
# Calculates hash code according to all attributes.
|
95
104
|
# @return [Integer] Hash code
|
96
105
|
def hash
|
97
|
-
[_next].hash
|
106
|
+
[_next, prev].hash
|
98
107
|
end
|
99
108
|
|
100
109
|
# Builds the object from hash
|
@@ -0,0 +1,237 @@
|
|
1
|
+
=begin
|
2
|
+
#Associations
|
3
|
+
|
4
|
+
#Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.2.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Hubspot
|
17
|
+
module Crm
|
18
|
+
module Associations
|
19
|
+
class PreviousPage
|
20
|
+
attr_accessor :before
|
21
|
+
|
22
|
+
attr_accessor :link
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'before' => :'before',
|
28
|
+
:'link' => :'link'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns all the JSON keys this model knows about
|
33
|
+
def self.acceptable_attributes
|
34
|
+
attribute_map.values
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.openapi_types
|
39
|
+
{
|
40
|
+
:'before' => :'String',
|
41
|
+
:'link' => :'String'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# List of attributes with nullable: true
|
46
|
+
def self.openapi_nullable
|
47
|
+
Set.new([
|
48
|
+
])
|
49
|
+
end
|
50
|
+
|
51
|
+
# Initializes the object
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
+
def initialize(attributes = {})
|
54
|
+
if (!attributes.is_a?(Hash))
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Crm::Associations::PreviousPage` initialize method"
|
56
|
+
end
|
57
|
+
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
60
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
61
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Crm::Associations::PreviousPage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
62
|
+
end
|
63
|
+
h[k.to_sym] = v
|
64
|
+
}
|
65
|
+
|
66
|
+
if attributes.key?(:'before')
|
67
|
+
self.before = attributes[:'before']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.key?(:'link')
|
71
|
+
self.link = attributes[:'link']
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
76
|
+
# @return Array for valid properties with the reasons
|
77
|
+
def list_invalid_properties
|
78
|
+
invalid_properties = Array.new
|
79
|
+
if @before.nil?
|
80
|
+
invalid_properties.push('invalid value for "before", before cannot be nil.')
|
81
|
+
end
|
82
|
+
|
83
|
+
invalid_properties
|
84
|
+
end
|
85
|
+
|
86
|
+
# Check to see if the all the properties in the model are valid
|
87
|
+
# @return true if the model is valid
|
88
|
+
def valid?
|
89
|
+
return false if @before.nil?
|
90
|
+
true
|
91
|
+
end
|
92
|
+
|
93
|
+
# Checks equality by comparing each attribute.
|
94
|
+
# @param [Object] Object to be compared
|
95
|
+
def ==(o)
|
96
|
+
return true if self.equal?(o)
|
97
|
+
self.class == o.class &&
|
98
|
+
before == o.before &&
|
99
|
+
link == o.link
|
100
|
+
end
|
101
|
+
|
102
|
+
# @see the `==` method
|
103
|
+
# @param [Object] Object to be compared
|
104
|
+
def eql?(o)
|
105
|
+
self == o
|
106
|
+
end
|
107
|
+
|
108
|
+
# Calculates hash code according to all attributes.
|
109
|
+
# @return [Integer] Hash code
|
110
|
+
def hash
|
111
|
+
[before, link].hash
|
112
|
+
end
|
113
|
+
|
114
|
+
# Builds the object from hash
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
+
# @return [Object] Returns the model itself
|
117
|
+
def self.build_from_hash(attributes)
|
118
|
+
new.build_from_hash(attributes)
|
119
|
+
end
|
120
|
+
|
121
|
+
# Builds the object from hash
|
122
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
123
|
+
# @return [Object] Returns the model itself
|
124
|
+
def build_from_hash(attributes)
|
125
|
+
return nil unless attributes.is_a?(Hash)
|
126
|
+
attributes = attributes.transform_keys(&:to_sym)
|
127
|
+
self.class.openapi_types.each_pair do |key, type|
|
128
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
129
|
+
self.send("#{key}=", nil)
|
130
|
+
elsif 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
|
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 :Time
|
151
|
+
Time.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
|
+
# models (e.g. Pet) or oneOf
|
182
|
+
klass = Hubspot::Crm::Associations.const_get(type)
|
183
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
# Returns the string representation of the object
|
188
|
+
# @return [String] String presentation of the object
|
189
|
+
def to_s
|
190
|
+
to_hash.to_s
|
191
|
+
end
|
192
|
+
|
193
|
+
# to_body is an alias to to_hash (backward compatibility)
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
195
|
+
def to_body
|
196
|
+
to_hash
|
197
|
+
end
|
198
|
+
|
199
|
+
# Returns the object in the form of hash
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
201
|
+
def to_hash
|
202
|
+
hash = {}
|
203
|
+
self.class.attribute_map.each_pair do |attr, param|
|
204
|
+
value = self.send(attr)
|
205
|
+
if value.nil?
|
206
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
207
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
208
|
+
end
|
209
|
+
|
210
|
+
hash[param] = _to_hash(value)
|
211
|
+
end
|
212
|
+
hash
|
213
|
+
end
|
214
|
+
|
215
|
+
# Outputs non-array value in the form of hash
|
216
|
+
# For object, use to_hash. Otherwise, just return the value
|
217
|
+
# @param [Object] value Any valid value
|
218
|
+
# @return [Hash] Returns the value in the form of hash
|
219
|
+
def _to_hash(value)
|
220
|
+
if value.is_a?(Array)
|
221
|
+
value.compact.map { |v| _to_hash(v) }
|
222
|
+
elsif value.is_a?(Hash)
|
223
|
+
{}.tap do |hash|
|
224
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
225
|
+
end
|
226
|
+
elsif value.respond_to? :to_hash
|
227
|
+
value.to_hash
|
228
|
+
else
|
229
|
+
value
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|