one_msg_chat_api 1.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 +7 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +10 -0
- data/docs/AddTemplateRequest.md +24 -0
- data/docs/BlockUserRequest.md +18 -0
- data/docs/CallingApi.md +231 -0
- data/docs/CatalogApi.md +153 -0
- data/docs/ChannelApi.md +225 -0
- data/docs/ConversationalAutomation.md +22 -0
- data/docs/ConversationalAutomationCommandsInner.md +20 -0
- data/docs/CreateCommerce200Response.md +18 -0
- data/docs/CreateCommerceRequest.md +18 -0
- data/docs/CreateCommerceRequestParams.md +20 -0
- data/docs/CreateGroups200Response.md +18 -0
- data/docs/CreateReadMessage200Response.md +18 -0
- data/docs/CreateReadMessage401Response.md +18 -0
- data/docs/CreateReadMessageRequest.md +22 -0
- data/docs/DeleteFlowsFlowId200Response.md +20 -0
- data/docs/DeleteGroupsGroupId200Response.md +20 -0
- data/docs/DeleteMediaLegacyRequest.md +18 -0
- data/docs/ErrorResponse.md +18 -0
- data/docs/FlowsApi.md +836 -0
- data/docs/GetCommerce200ResponseInner.md +22 -0
- data/docs/GetMmLiteStatus200Response.md +22 -0
- data/docs/GetWebhook200Response.md +18 -0
- data/docs/GetWhatsappBusinessEncryption200Response.md +22 -0
- data/docs/GroupsApi.md +507 -0
- data/docs/ListBlockedUsers200Response.md +18 -0
- data/docs/ListFlows200Response.md +26 -0
- data/docs/ListMessages200Response.md +20 -0
- data/docs/ListTemplates200Response.md +22 -0
- data/docs/MessageSentResponse.md +24 -0
- data/docs/MessagingApi.md +1784 -0
- data/docs/PatchFlowsFlowIdAssets200Response.md +22 -0
- data/docs/ProfileApi.md +155 -0
- data/docs/ProfileInfo.md +32 -0
- data/docs/RetrieveMedia200Response.md +26 -0
- data/docs/SendAddressMessageRequest.md +32 -0
- data/docs/SendButtonRequest.md +24 -0
- data/docs/SendButtonRequestSectionsInner.md +20 -0
- data/docs/SendButtonRequestSectionsInnerReply.md +20 -0
- data/docs/SendCarouselRequest1.md +26 -0
- data/docs/SendContactRequest.md +20 -0
- data/docs/SendContactRequestContactsInner.md +30 -0
- data/docs/SendContactRequestContactsInnerName.md +28 -0
- data/docs/SendContactRequestContactsInnerOrg.md +22 -0
- data/docs/SendContactRequestContactsInnerPhonesInner.md +22 -0
- data/docs/SendCtaUrlRequest.md +32 -0
- data/docs/SendFileRequest.md +34 -0
- data/docs/SendFlowRequest1.md +46 -0
- data/docs/SendFlowRequest1Header.md +49 -0
- data/docs/SendFlowRequestHeader.md +49 -0
- data/docs/SendListRequest.md +26 -0
- data/docs/SendListRequestSectionsInner.md +20 -0
- data/docs/SendListRequestSectionsInnerRowsInner.md +22 -0
- data/docs/SendLocationRequest1.md +30 -0
- data/docs/SendLocationRequestRequest.md +20 -0
- data/docs/SendMessageRequest.md +24 -0
- data/docs/SendOrderDetailsRequest.md +36 -0
- data/docs/SendOrderDetailsRequestLanguage.md +20 -0
- data/docs/SendOrderDetailsRequestOrder.md +28 -0
- data/docs/SendOrderDetailsRequestOrderItemsInner.md +24 -0
- data/docs/SendOrderDetailsRequestOrderItemsInnerAmount.md +20 -0
- data/docs/SendPaymentRequestRequest.md +26 -0
- data/docs/SendReactionRequest.md +22 -0
- data/docs/SendStickerRequest.md +26 -0
- data/docs/SendTemplateRequest.md +32 -0
- data/docs/SendTemplateRequestLanguage.md +20 -0
- data/docs/SetWhatsappBusinessEncryptionRequest.md +21 -0
- data/docs/SuccessResponse.md +18 -0
- data/docs/TemplatesApi.md +301 -0
- data/docs/UpdateMeRequest.md +30 -0
- data/docs/UsersApi.md +223 -0
- data/docs/WebhooksApi.md +155 -0
- data/git_push.sh +57 -0
- data/lib/one_msg_chat_api/api/calling_api.rb +228 -0
- data/lib/one_msg_chat_api/api/catalog_api.rb +161 -0
- data/lib/one_msg_chat_api/api/channel_api.rb +225 -0
- data/lib/one_msg_chat_api/api/flows_api.rb +788 -0
- data/lib/one_msg_chat_api/api/groups_api.rb +486 -0
- data/lib/one_msg_chat_api/api/messaging_api.rb +1833 -0
- data/lib/one_msg_chat_api/api/profile_api.rb +157 -0
- data/lib/one_msg_chat_api/api/templates_api.rb +293 -0
- data/lib/one_msg_chat_api/api/users_api.rb +232 -0
- data/lib/one_msg_chat_api/api/webhooks_api.rb +157 -0
- data/lib/one_msg_chat_api/api_client.rb +441 -0
- data/lib/one_msg_chat_api/api_error.rb +58 -0
- data/lib/one_msg_chat_api/api_model_base.rb +88 -0
- data/lib/one_msg_chat_api/configuration.rb +400 -0
- data/lib/one_msg_chat_api/models/add_template_request.rb +176 -0
- data/lib/one_msg_chat_api/models/block_user_request.rb +164 -0
- data/lib/one_msg_chat_api/models/conversational_automation.rb +210 -0
- data/lib/one_msg_chat_api/models/conversational_automation_commands_inner.rb +208 -0
- data/lib/one_msg_chat_api/models/create_commerce200_response.rb +147 -0
- data/lib/one_msg_chat_api/models/create_commerce_request.rb +164 -0
- data/lib/one_msg_chat_api/models/create_commerce_request_params.rb +192 -0
- data/lib/one_msg_chat_api/models/create_groups200_response.rb +149 -0
- data/lib/one_msg_chat_api/models/create_read_message200_response.rb +147 -0
- data/lib/one_msg_chat_api/models/create_read_message401_response.rb +147 -0
- data/lib/one_msg_chat_api/models/create_read_message_request.rb +168 -0
- data/lib/one_msg_chat_api/models/delete_flows_flow_id200_response.rb +158 -0
- data/lib/one_msg_chat_api/models/delete_groups_group_id200_response.rb +158 -0
- data/lib/one_msg_chat_api/models/delete_media_legacy_request.rb +165 -0
- data/lib/one_msg_chat_api/models/error_response.rb +149 -0
- data/lib/one_msg_chat_api/models/get_commerce200_response_inner.rb +168 -0
- data/lib/one_msg_chat_api/models/get_mm_lite_status200_response.rb +165 -0
- data/lib/one_msg_chat_api/models/get_webhook200_response.rb +147 -0
- data/lib/one_msg_chat_api/models/get_whatsapp_business_encryption200_response.rb +202 -0
- data/lib/one_msg_chat_api/models/list_blocked_users200_response.rb +149 -0
- data/lib/one_msg_chat_api/models/list_flows200_response.rb +189 -0
- data/lib/one_msg_chat_api/models/list_messages200_response.rb +158 -0
- data/lib/one_msg_chat_api/models/list_templates200_response.rb +169 -0
- data/lib/one_msg_chat_api/models/message_sent_response.rb +179 -0
- data/lib/one_msg_chat_api/models/patch_flows_flow_id_assets200_response.rb +169 -0
- data/lib/one_msg_chat_api/models/profile_info.rb +254 -0
- data/lib/one_msg_chat_api/models/retrieve_media200_response.rb +183 -0
- data/lib/one_msg_chat_api/models/send_address_message_request.rb +273 -0
- data/lib/one_msg_chat_api/models/send_button_request.rb +176 -0
- data/lib/one_msg_chat_api/models/send_button_request_sections_inner.rb +156 -0
- data/lib/one_msg_chat_api/models/send_button_request_sections_inner_reply.rb +156 -0
- data/lib/one_msg_chat_api/models/send_carousel_request1.rb +202 -0
- data/lib/one_msg_chat_api/models/send_contact_request.rb +158 -0
- data/lib/one_msg_chat_api/models/send_contact_request_contacts_inner.rb +209 -0
- data/lib/one_msg_chat_api/models/send_contact_request_contacts_inner_name.rb +192 -0
- data/lib/one_msg_chat_api/models/send_contact_request_contacts_inner_org.rb +165 -0
- data/lib/one_msg_chat_api/models/send_contact_request_contacts_inner_phones_inner.rb +165 -0
- data/lib/one_msg_chat_api/models/send_cta_url_request.rb +264 -0
- data/lib/one_msg_chat_api/models/send_file_request.rb +278 -0
- data/lib/one_msg_chat_api/models/send_flow_request1.rb +387 -0
- data/lib/one_msg_chat_api/models/send_flow_request1_header.rb +104 -0
- data/lib/one_msg_chat_api/models/send_flow_request_header.rb +105 -0
- data/lib/one_msg_chat_api/models/send_list_request.rb +185 -0
- data/lib/one_msg_chat_api/models/send_list_request_sections_inner.rb +158 -0
- data/lib/one_msg_chat_api/models/send_list_request_sections_inner_rows_inner.rb +165 -0
- data/lib/one_msg_chat_api/models/send_location_request1.rb +235 -0
- data/lib/one_msg_chat_api/models/send_location_request_request.rb +156 -0
- data/lib/one_msg_chat_api/models/send_message_request.rb +284 -0
- data/lib/one_msg_chat_api/models/send_order_details_request.rb +308 -0
- data/lib/one_msg_chat_api/models/send_order_details_request_language.rb +176 -0
- data/lib/one_msg_chat_api/models/send_order_details_request_order.rb +220 -0
- data/lib/one_msg_chat_api/models/send_order_details_request_order_items_inner.rb +174 -0
- data/lib/one_msg_chat_api/models/send_order_details_request_order_items_inner_amount.rb +156 -0
- data/lib/one_msg_chat_api/models/send_payment_request_request.rb +245 -0
- data/lib/one_msg_chat_api/models/send_reaction_request.rb +165 -0
- data/lib/one_msg_chat_api/models/send_sticker_request.rb +185 -0
- data/lib/one_msg_chat_api/models/send_template_request.rb +215 -0
- data/lib/one_msg_chat_api/models/send_template_request_language.rb +156 -0
- data/lib/one_msg_chat_api/models/set_whatsapp_business_encryption_request.rb +165 -0
- data/lib/one_msg_chat_api/models/success_response.rb +149 -0
- data/lib/one_msg_chat_api/models/update_me_request.rb +207 -0
- data/lib/one_msg_chat_api/version.rb +15 -0
- data/lib/one_msg_chat_api.rb +111 -0
- data/one_msg_chat_api.gemspec +41 -0
- data/spec/api/calling_api_spec.rb +73 -0
- data/spec/api/catalog_api_spec.rb +60 -0
- data/spec/api/channel_api_spec.rb +72 -0
- data/spec/api/flows_api_spec.rb +175 -0
- data/spec/api/groups_api_spec.rb +117 -0
- data/spec/api/messaging_api_spec.rb +359 -0
- data/spec/api/profile_api_spec.rb +60 -0
- data/spec/api/templates_api_spec.rb +83 -0
- data/spec/api/users_api_spec.rb +71 -0
- data/spec/api/webhooks_api_spec.rb +60 -0
- data/spec/models/add_template_request_spec.rb +54 -0
- data/spec/models/block_user_request_spec.rb +36 -0
- data/spec/models/conversational_automation_commands_inner_spec.rb +42 -0
- data/spec/models/conversational_automation_spec.rb +48 -0
- data/spec/models/create_commerce200_response_spec.rb +36 -0
- data/spec/models/create_commerce_request_params_spec.rb +42 -0
- data/spec/models/create_commerce_request_spec.rb +36 -0
- data/spec/models/create_groups200_response_spec.rb +36 -0
- data/spec/models/create_read_message200_response_spec.rb +36 -0
- data/spec/models/create_read_message401_response_spec.rb +36 -0
- data/spec/models/create_read_message_request_spec.rb +48 -0
- data/spec/models/delete_flows_flow_id200_response_spec.rb +42 -0
- data/spec/models/delete_groups_group_id200_response_spec.rb +42 -0
- data/spec/models/delete_media_legacy_request_spec.rb +36 -0
- data/spec/models/error_response_spec.rb +36 -0
- data/spec/models/get_commerce200_response_inner_spec.rb +48 -0
- data/spec/models/get_mm_lite_status200_response_spec.rb +48 -0
- data/spec/models/get_webhook200_response_spec.rb +36 -0
- data/spec/models/get_whatsapp_business_encryption200_response_spec.rb +52 -0
- data/spec/models/list_blocked_users200_response_spec.rb +36 -0
- data/spec/models/list_flows200_response_spec.rb +60 -0
- data/spec/models/list_messages200_response_spec.rb +42 -0
- data/spec/models/list_templates200_response_spec.rb +48 -0
- data/spec/models/message_sent_response_spec.rb +54 -0
- data/spec/models/patch_flows_flow_id_assets200_response_spec.rb +48 -0
- data/spec/models/profile_info_spec.rb +82 -0
- data/spec/models/retrieve_media200_response_spec.rb +60 -0
- data/spec/models/send_address_message_request_spec.rb +82 -0
- data/spec/models/send_button_request_sections_inner_reply_spec.rb +42 -0
- data/spec/models/send_button_request_sections_inner_spec.rb +42 -0
- data/spec/models/send_button_request_spec.rb +54 -0
- data/spec/models/send_carousel_request1_spec.rb +60 -0
- data/spec/models/send_contact_request_contacts_inner_name_spec.rb +66 -0
- data/spec/models/send_contact_request_contacts_inner_org_spec.rb +48 -0
- data/spec/models/send_contact_request_contacts_inner_phones_inner_spec.rb +48 -0
- data/spec/models/send_contact_request_contacts_inner_spec.rb +72 -0
- data/spec/models/send_contact_request_spec.rb +42 -0
- data/spec/models/send_cta_url_request_spec.rb +78 -0
- data/spec/models/send_file_request_spec.rb +88 -0
- data/spec/models/send_flow_request1_header_spec.rb +32 -0
- data/spec/models/send_flow_request1_spec.rb +128 -0
- data/spec/models/send_flow_request_header_spec.rb +32 -0
- data/spec/models/send_list_request_sections_inner_rows_inner_spec.rb +48 -0
- data/spec/models/send_list_request_sections_inner_spec.rb +42 -0
- data/spec/models/send_list_request_spec.rb +60 -0
- data/spec/models/send_location_request1_spec.rb +72 -0
- data/spec/models/send_location_request_request_spec.rb +42 -0
- data/spec/models/send_message_request_spec.rb +54 -0
- data/spec/models/send_order_details_request_language_spec.rb +42 -0
- data/spec/models/send_order_details_request_order_items_inner_amount_spec.rb +42 -0
- data/spec/models/send_order_details_request_order_items_inner_spec.rb +54 -0
- data/spec/models/send_order_details_request_order_spec.rb +66 -0
- data/spec/models/send_order_details_request_spec.rb +90 -0
- data/spec/models/send_payment_request_request_spec.rb +64 -0
- data/spec/models/send_reaction_request_spec.rb +48 -0
- data/spec/models/send_sticker_request_spec.rb +60 -0
- data/spec/models/send_template_request_language_spec.rb +42 -0
- data/spec/models/send_template_request_spec.rb +78 -0
- data/spec/models/set_whatsapp_business_encryption_request_spec.rb +36 -0
- data/spec/models/success_response_spec.rb +36 -0
- data/spec/models/update_me_request_spec.rb +72 -0
- data/spec/spec_helper.rb +111 -0
- metadata +408 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#1MSG WhatsApp Business API (Public)
|
|
3
|
+
|
|
4
|
+
#Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** All requests require `token` query parameter with JWT or API key. **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@1msg.io
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module OneMsgChatApi
|
|
17
|
+
class SendContactRequestContactsInnerPhonesInner < ApiModelBase
|
|
18
|
+
attr_accessor :phone
|
|
19
|
+
|
|
20
|
+
attr_accessor :type
|
|
21
|
+
|
|
22
|
+
attr_accessor :wa_id
|
|
23
|
+
|
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
|
+
def self.attribute_map
|
|
26
|
+
{
|
|
27
|
+
:'phone' => :'phone',
|
|
28
|
+
:'type' => :'type',
|
|
29
|
+
:'wa_id' => :'wa_id'
|
|
30
|
+
}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Returns attribute mapping this model knows about
|
|
34
|
+
def self.acceptable_attribute_map
|
|
35
|
+
attribute_map
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Returns all the JSON keys this model knows about
|
|
39
|
+
def self.acceptable_attributes
|
|
40
|
+
acceptable_attribute_map.values
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Attribute type mapping.
|
|
44
|
+
def self.openapi_types
|
|
45
|
+
{
|
|
46
|
+
:'phone' => :'String',
|
|
47
|
+
:'type' => :'String',
|
|
48
|
+
:'wa_id' => :'String'
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# List of attributes with nullable: true
|
|
53
|
+
def self.openapi_nullable
|
|
54
|
+
Set.new([
|
|
55
|
+
])
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Initializes the object
|
|
59
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
60
|
+
def initialize(attributes = {})
|
|
61
|
+
if (!attributes.is_a?(Hash))
|
|
62
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneMsgChatApi::SendContactRequestContactsInnerPhonesInner` initialize method"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
66
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
67
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
68
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
69
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneMsgChatApi::SendContactRequestContactsInnerPhonesInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
70
|
+
end
|
|
71
|
+
h[k.to_sym] = v
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if attributes.key?(:'phone')
|
|
75
|
+
self.phone = attributes[:'phone']
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
if attributes.key?(:'type')
|
|
79
|
+
self.type = attributes[:'type']
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
if attributes.key?(:'wa_id')
|
|
83
|
+
self.wa_id = attributes[:'wa_id']
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
88
|
+
# @return Array for valid properties with the reasons
|
|
89
|
+
def list_invalid_properties
|
|
90
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
91
|
+
invalid_properties = Array.new
|
|
92
|
+
invalid_properties
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Check to see if the all the properties in the model are valid
|
|
96
|
+
# @return true if the model is valid
|
|
97
|
+
def valid?
|
|
98
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
99
|
+
true
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Checks equality by comparing each attribute.
|
|
103
|
+
# @param [Object] Object to be compared
|
|
104
|
+
def ==(o)
|
|
105
|
+
return true if self.equal?(o)
|
|
106
|
+
self.class == o.class &&
|
|
107
|
+
phone == o.phone &&
|
|
108
|
+
type == o.type &&
|
|
109
|
+
wa_id == o.wa_id
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# @see the `==` method
|
|
113
|
+
# @param [Object] Object to be compared
|
|
114
|
+
def eql?(o)
|
|
115
|
+
self == o
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Calculates hash code according to all attributes.
|
|
119
|
+
# @return [Integer] Hash code
|
|
120
|
+
def hash
|
|
121
|
+
[phone, type, wa_id].hash
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Builds the object from hash
|
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
126
|
+
# @return [Object] Returns the model itself
|
|
127
|
+
def self.build_from_hash(attributes)
|
|
128
|
+
return nil unless attributes.is_a?(Hash)
|
|
129
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
130
|
+
transformed_hash = {}
|
|
131
|
+
openapi_types.each_pair do |key, type|
|
|
132
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
133
|
+
transformed_hash["#{key}"] = nil
|
|
134
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
135
|
+
# check to ensure the input is an array given that the attribute
|
|
136
|
+
# is documented as an array but the input is not
|
|
137
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
138
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
139
|
+
end
|
|
140
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
141
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
new(transformed_hash)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Returns the object in the form of hash
|
|
148
|
+
# @return [Hash] Returns the object in the form of hash
|
|
149
|
+
def to_hash
|
|
150
|
+
hash = {}
|
|
151
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
152
|
+
value = self.send(attr)
|
|
153
|
+
if value.nil?
|
|
154
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
155
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
hash[param] = _to_hash(value)
|
|
159
|
+
end
|
|
160
|
+
hash
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
end
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#1MSG WhatsApp Business API (Public)
|
|
3
|
+
|
|
4
|
+
#Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** All requests require `token` query parameter with JWT or API key. **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@1msg.io
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module OneMsgChatApi
|
|
17
|
+
class SendCtaUrlRequest < ApiModelBase
|
|
18
|
+
attr_accessor :phone
|
|
19
|
+
|
|
20
|
+
attr_accessor :chat_id
|
|
21
|
+
|
|
22
|
+
attr_accessor :body
|
|
23
|
+
|
|
24
|
+
# Button label
|
|
25
|
+
attr_accessor :display_text
|
|
26
|
+
|
|
27
|
+
attr_accessor :url
|
|
28
|
+
|
|
29
|
+
attr_accessor :header
|
|
30
|
+
|
|
31
|
+
attr_accessor :footer
|
|
32
|
+
|
|
33
|
+
attr_accessor :quoted_msg_id
|
|
34
|
+
|
|
35
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
36
|
+
def self.attribute_map
|
|
37
|
+
{
|
|
38
|
+
:'phone' => :'phone',
|
|
39
|
+
:'chat_id' => :'chatId',
|
|
40
|
+
:'body' => :'body',
|
|
41
|
+
:'display_text' => :'displayText',
|
|
42
|
+
:'url' => :'url',
|
|
43
|
+
:'header' => :'header',
|
|
44
|
+
:'footer' => :'footer',
|
|
45
|
+
:'quoted_msg_id' => :'quotedMsgId'
|
|
46
|
+
}
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Returns attribute mapping this model knows about
|
|
50
|
+
def self.acceptable_attribute_map
|
|
51
|
+
attribute_map
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Returns all the JSON keys this model knows about
|
|
55
|
+
def self.acceptable_attributes
|
|
56
|
+
acceptable_attribute_map.values
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Attribute type mapping.
|
|
60
|
+
def self.openapi_types
|
|
61
|
+
{
|
|
62
|
+
:'phone' => :'Integer',
|
|
63
|
+
:'chat_id' => :'String',
|
|
64
|
+
:'body' => :'String',
|
|
65
|
+
:'display_text' => :'String',
|
|
66
|
+
:'url' => :'String',
|
|
67
|
+
:'header' => :'Hash<String, Object>',
|
|
68
|
+
:'footer' => :'String',
|
|
69
|
+
:'quoted_msg_id' => :'String'
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# List of attributes with nullable: true
|
|
74
|
+
def self.openapi_nullable
|
|
75
|
+
Set.new([
|
|
76
|
+
])
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Initializes the object
|
|
80
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
81
|
+
def initialize(attributes = {})
|
|
82
|
+
if (!attributes.is_a?(Hash))
|
|
83
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneMsgChatApi::SendCtaUrlRequest` initialize method"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
87
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
89
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneMsgChatApi::SendCtaUrlRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
91
|
+
end
|
|
92
|
+
h[k.to_sym] = v
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'phone')
|
|
96
|
+
self.phone = attributes[:'phone']
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if attributes.key?(:'chat_id')
|
|
100
|
+
self.chat_id = attributes[:'chat_id']
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
if attributes.key?(:'body')
|
|
104
|
+
self.body = attributes[:'body']
|
|
105
|
+
else
|
|
106
|
+
self.body = nil
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if attributes.key?(:'display_text')
|
|
110
|
+
self.display_text = attributes[:'display_text']
|
|
111
|
+
else
|
|
112
|
+
self.display_text = nil
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
if attributes.key?(:'url')
|
|
116
|
+
self.url = attributes[:'url']
|
|
117
|
+
else
|
|
118
|
+
self.url = nil
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
if attributes.key?(:'header')
|
|
122
|
+
if (value = attributes[:'header']).is_a?(Hash)
|
|
123
|
+
self.header = value
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
if attributes.key?(:'footer')
|
|
128
|
+
self.footer = attributes[:'footer']
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if attributes.key?(:'quoted_msg_id')
|
|
132
|
+
self.quoted_msg_id = attributes[:'quoted_msg_id']
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
137
|
+
# @return Array for valid properties with the reasons
|
|
138
|
+
def list_invalid_properties
|
|
139
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
140
|
+
invalid_properties = Array.new
|
|
141
|
+
if @body.nil?
|
|
142
|
+
invalid_properties.push('invalid value for "body", body cannot be nil.')
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if @display_text.nil?
|
|
146
|
+
invalid_properties.push('invalid value for "display_text", display_text cannot be nil.')
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if @url.nil?
|
|
150
|
+
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
invalid_properties
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Check to see if the all the properties in the model are valid
|
|
157
|
+
# @return true if the model is valid
|
|
158
|
+
def valid?
|
|
159
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
160
|
+
return false if @body.nil?
|
|
161
|
+
return false if @display_text.nil?
|
|
162
|
+
return false if @url.nil?
|
|
163
|
+
true
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Custom attribute writer method with validation
|
|
167
|
+
# @param [Object] body Value to be assigned
|
|
168
|
+
def body=(body)
|
|
169
|
+
if body.nil?
|
|
170
|
+
fail ArgumentError, 'body cannot be nil'
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
@body = body
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Custom attribute writer method with validation
|
|
177
|
+
# @param [Object] display_text Value to be assigned
|
|
178
|
+
def display_text=(display_text)
|
|
179
|
+
if display_text.nil?
|
|
180
|
+
fail ArgumentError, 'display_text cannot be nil'
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
@display_text = display_text
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# Custom attribute writer method with validation
|
|
187
|
+
# @param [Object] url Value to be assigned
|
|
188
|
+
def url=(url)
|
|
189
|
+
if url.nil?
|
|
190
|
+
fail ArgumentError, 'url cannot be nil'
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
@url = url
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Checks equality by comparing each attribute.
|
|
197
|
+
# @param [Object] Object to be compared
|
|
198
|
+
def ==(o)
|
|
199
|
+
return true if self.equal?(o)
|
|
200
|
+
self.class == o.class &&
|
|
201
|
+
phone == o.phone &&
|
|
202
|
+
chat_id == o.chat_id &&
|
|
203
|
+
body == o.body &&
|
|
204
|
+
display_text == o.display_text &&
|
|
205
|
+
url == o.url &&
|
|
206
|
+
header == o.header &&
|
|
207
|
+
footer == o.footer &&
|
|
208
|
+
quoted_msg_id == o.quoted_msg_id
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# @see the `==` method
|
|
212
|
+
# @param [Object] Object to be compared
|
|
213
|
+
def eql?(o)
|
|
214
|
+
self == o
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Calculates hash code according to all attributes.
|
|
218
|
+
# @return [Integer] Hash code
|
|
219
|
+
def hash
|
|
220
|
+
[phone, chat_id, body, display_text, url, header, footer, quoted_msg_id].hash
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# Builds the object from hash
|
|
224
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
225
|
+
# @return [Object] Returns the model itself
|
|
226
|
+
def self.build_from_hash(attributes)
|
|
227
|
+
return nil unless attributes.is_a?(Hash)
|
|
228
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
229
|
+
transformed_hash = {}
|
|
230
|
+
openapi_types.each_pair do |key, type|
|
|
231
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
232
|
+
transformed_hash["#{key}"] = nil
|
|
233
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
234
|
+
# check to ensure the input is an array given that the attribute
|
|
235
|
+
# is documented as an array but the input is not
|
|
236
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
237
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
238
|
+
end
|
|
239
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
240
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
new(transformed_hash)
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# Returns the object in the form of hash
|
|
247
|
+
# @return [Hash] Returns the object in the form of hash
|
|
248
|
+
def to_hash
|
|
249
|
+
hash = {}
|
|
250
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
251
|
+
value = self.send(attr)
|
|
252
|
+
if value.nil?
|
|
253
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
254
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
hash[param] = _to_hash(value)
|
|
258
|
+
end
|
|
259
|
+
hash
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
end
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#1MSG WhatsApp Business API (Public)
|
|
3
|
+
|
|
4
|
+
#Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** All requests require `token` query parameter with JWT or API key. **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@1msg.io
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module OneMsgChatApi
|
|
17
|
+
# Send file by URL/base64 or by mediaId
|
|
18
|
+
class SendFileRequest < ApiModelBase
|
|
19
|
+
# File source (required unless mediaId is set): - HTTP/HTTPS URL - Base64 data URI
|
|
20
|
+
attr_accessor :body
|
|
21
|
+
|
|
22
|
+
# File name with extension (required with body, not with mediaId)
|
|
23
|
+
attr_accessor :filename
|
|
24
|
+
|
|
25
|
+
# WABA media id from uploadMedia (alternative to body)
|
|
26
|
+
attr_accessor :media_id
|
|
27
|
+
|
|
28
|
+
# Required when using mediaId
|
|
29
|
+
attr_accessor :media_type
|
|
30
|
+
|
|
31
|
+
# Native WhatsApp voice note (audio/ogg only)
|
|
32
|
+
attr_accessor :voice
|
|
33
|
+
|
|
34
|
+
attr_accessor :caption
|
|
35
|
+
|
|
36
|
+
attr_accessor :quoted_msg_id
|
|
37
|
+
|
|
38
|
+
attr_accessor :chat_id
|
|
39
|
+
|
|
40
|
+
attr_accessor :phone
|
|
41
|
+
|
|
42
|
+
class EnumAttributeValidator
|
|
43
|
+
attr_reader :datatype
|
|
44
|
+
attr_reader :allowable_values
|
|
45
|
+
|
|
46
|
+
def initialize(datatype, allowable_values)
|
|
47
|
+
@allowable_values = allowable_values.map do |value|
|
|
48
|
+
case datatype.to_s
|
|
49
|
+
when /Integer/i
|
|
50
|
+
value.to_i
|
|
51
|
+
when /Float/i
|
|
52
|
+
value.to_f
|
|
53
|
+
else
|
|
54
|
+
value
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def valid?(value)
|
|
60
|
+
!value || allowable_values.include?(value)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
65
|
+
def self.attribute_map
|
|
66
|
+
{
|
|
67
|
+
:'body' => :'body',
|
|
68
|
+
:'filename' => :'filename',
|
|
69
|
+
:'media_id' => :'mediaId',
|
|
70
|
+
:'media_type' => :'mediaType',
|
|
71
|
+
:'voice' => :'voice',
|
|
72
|
+
:'caption' => :'caption',
|
|
73
|
+
:'quoted_msg_id' => :'quotedMsgId',
|
|
74
|
+
:'chat_id' => :'chatId',
|
|
75
|
+
:'phone' => :'phone'
|
|
76
|
+
}
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Returns attribute mapping this model knows about
|
|
80
|
+
def self.acceptable_attribute_map
|
|
81
|
+
attribute_map
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Returns all the JSON keys this model knows about
|
|
85
|
+
def self.acceptable_attributes
|
|
86
|
+
acceptable_attribute_map.values
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Attribute type mapping.
|
|
90
|
+
def self.openapi_types
|
|
91
|
+
{
|
|
92
|
+
:'body' => :'String',
|
|
93
|
+
:'filename' => :'String',
|
|
94
|
+
:'media_id' => :'String',
|
|
95
|
+
:'media_type' => :'String',
|
|
96
|
+
:'voice' => :'Boolean',
|
|
97
|
+
:'caption' => :'String',
|
|
98
|
+
:'quoted_msg_id' => :'String',
|
|
99
|
+
:'chat_id' => :'String',
|
|
100
|
+
:'phone' => :'Integer'
|
|
101
|
+
}
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# List of attributes with nullable: true
|
|
105
|
+
def self.openapi_nullable
|
|
106
|
+
Set.new([
|
|
107
|
+
])
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Initializes the object
|
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
112
|
+
def initialize(attributes = {})
|
|
113
|
+
if (!attributes.is_a?(Hash))
|
|
114
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneMsgChatApi::SendFileRequest` initialize method"
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
118
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
119
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
120
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
121
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneMsgChatApi::SendFileRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
122
|
+
end
|
|
123
|
+
h[k.to_sym] = v
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if attributes.key?(:'body')
|
|
127
|
+
self.body = attributes[:'body']
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if attributes.key?(:'filename')
|
|
131
|
+
self.filename = attributes[:'filename']
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if attributes.key?(:'media_id')
|
|
135
|
+
self.media_id = attributes[:'media_id']
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if attributes.key?(:'media_type')
|
|
139
|
+
self.media_type = attributes[:'media_type']
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if attributes.key?(:'voice')
|
|
143
|
+
self.voice = attributes[:'voice']
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if attributes.key?(:'caption')
|
|
147
|
+
self.caption = attributes[:'caption']
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
if attributes.key?(:'quoted_msg_id')
|
|
151
|
+
self.quoted_msg_id = attributes[:'quoted_msg_id']
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
if attributes.key?(:'chat_id')
|
|
155
|
+
self.chat_id = attributes[:'chat_id']
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if attributes.key?(:'phone')
|
|
159
|
+
self.phone = attributes[:'phone']
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
164
|
+
# @return Array for valid properties with the reasons
|
|
165
|
+
def list_invalid_properties
|
|
166
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
167
|
+
invalid_properties = Array.new
|
|
168
|
+
if !@caption.nil? && @caption.to_s.length > 1024
|
|
169
|
+
invalid_properties.push('invalid value for "caption", the character length must be smaller than or equal to 1024.')
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
invalid_properties
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Check to see if the all the properties in the model are valid
|
|
176
|
+
# @return true if the model is valid
|
|
177
|
+
def valid?
|
|
178
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
179
|
+
media_type_validator = EnumAttributeValidator.new('String', ["image", "video", "audio", "document"])
|
|
180
|
+
return false unless media_type_validator.valid?(@media_type)
|
|
181
|
+
return false if !@caption.nil? && @caption.to_s.length > 1024
|
|
182
|
+
true
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
186
|
+
# @param [Object] media_type Object to be assigned
|
|
187
|
+
def media_type=(media_type)
|
|
188
|
+
validator = EnumAttributeValidator.new('String', ["image", "video", "audio", "document"])
|
|
189
|
+
unless validator.valid?(media_type)
|
|
190
|
+
fail ArgumentError, "invalid value for \"media_type\", must be one of #{validator.allowable_values}."
|
|
191
|
+
end
|
|
192
|
+
@media_type = media_type
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Custom attribute writer method with validation
|
|
196
|
+
# @param [Object] caption Value to be assigned
|
|
197
|
+
def caption=(caption)
|
|
198
|
+
if caption.nil?
|
|
199
|
+
fail ArgumentError, 'caption cannot be nil'
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
if caption.to_s.length > 1024
|
|
203
|
+
fail ArgumentError, 'invalid value for "caption", the character length must be smaller than or equal to 1024.'
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
@caption = caption
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Checks equality by comparing each attribute.
|
|
210
|
+
# @param [Object] Object to be compared
|
|
211
|
+
def ==(o)
|
|
212
|
+
return true if self.equal?(o)
|
|
213
|
+
self.class == o.class &&
|
|
214
|
+
body == o.body &&
|
|
215
|
+
filename == o.filename &&
|
|
216
|
+
media_id == o.media_id &&
|
|
217
|
+
media_type == o.media_type &&
|
|
218
|
+
voice == o.voice &&
|
|
219
|
+
caption == o.caption &&
|
|
220
|
+
quoted_msg_id == o.quoted_msg_id &&
|
|
221
|
+
chat_id == o.chat_id &&
|
|
222
|
+
phone == o.phone
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# @see the `==` method
|
|
226
|
+
# @param [Object] Object to be compared
|
|
227
|
+
def eql?(o)
|
|
228
|
+
self == o
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# Calculates hash code according to all attributes.
|
|
232
|
+
# @return [Integer] Hash code
|
|
233
|
+
def hash
|
|
234
|
+
[body, filename, media_id, media_type, voice, caption, quoted_msg_id, chat_id, phone].hash
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Builds the object from hash
|
|
238
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
239
|
+
# @return [Object] Returns the model itself
|
|
240
|
+
def self.build_from_hash(attributes)
|
|
241
|
+
return nil unless attributes.is_a?(Hash)
|
|
242
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
243
|
+
transformed_hash = {}
|
|
244
|
+
openapi_types.each_pair do |key, type|
|
|
245
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
246
|
+
transformed_hash["#{key}"] = nil
|
|
247
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
248
|
+
# check to ensure the input is an array given that the attribute
|
|
249
|
+
# is documented as an array but the input is not
|
|
250
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
251
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
252
|
+
end
|
|
253
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
254
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
new(transformed_hash)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# Returns the object in the form of hash
|
|
261
|
+
# @return [Hash] Returns the object in the form of hash
|
|
262
|
+
def to_hash
|
|
263
|
+
hash = {}
|
|
264
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
265
|
+
value = self.send(attr)
|
|
266
|
+
if value.nil?
|
|
267
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
268
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
hash[param] = _to_hash(value)
|
|
272
|
+
end
|
|
273
|
+
hash
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
end
|