whatsapp-ruby-sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +85 -0
- data/lib/whats_app_cloud_api/api_helper.rb +277 -0
- data/lib/whats_app_cloud_api/client.rb +68 -0
- data/lib/whats_app_cloud_api/configuration.rb +132 -0
- data/lib/whats_app_cloud_api/controllers/base_controller.rb +52 -0
- data/lib/whats_app_cloud_api/controllers/business_profiles_controller.rb +94 -0
- data/lib/whats_app_cloud_api/controllers/media_controller.rb +142 -0
- data/lib/whats_app_cloud_api/controllers/messages_controller.rb +51 -0
- data/lib/whats_app_cloud_api/controllers/phone_numbers_controller.rb +141 -0
- data/lib/whats_app_cloud_api/controllers/registration_controller.rb +91 -0
- data/lib/whats_app_cloud_api/controllers/two_step_verification_controller.rb +57 -0
- data/lib/whats_app_cloud_api/exceptions/api_exception.rb +20 -0
- data/lib/whats_app_cloud_api/http/auth/o_auth2.rb +17 -0
- data/lib/whats_app_cloud_api/http/faraday_client.rb +97 -0
- data/lib/whats_app_cloud_api/http/http_call_back.rb +24 -0
- data/lib/whats_app_cloud_api/http/http_client.rb +123 -0
- data/lib/whats_app_cloud_api/http/http_method_enum.rb +13 -0
- data/lib/whats_app_cloud_api/http/http_request.rb +54 -0
- data/lib/whats_app_cloud_api/http/http_response.rb +29 -0
- data/lib/whats_app_cloud_api/models/action.rb +91 -0
- data/lib/whats_app_cloud_api/models/address.rb +110 -0
- data/lib/whats_app_cloud_api/models/audio.rb +61 -0
- data/lib/whats_app_cloud_api/models/base_model.rb +58 -0
- data/lib/whats_app_cloud_api/models/body.rb +49 -0
- data/lib/whats_app_cloud_api/models/business_profile.rb +123 -0
- data/lib/whats_app_cloud_api/models/button.rb +71 -0
- data/lib/whats_app_cloud_api/models/button_parameter.rb +72 -0
- data/lib/whats_app_cloud_api/models/button_parameter_type_enum.rb +17 -0
- data/lib/whats_app_cloud_api/models/component.rb +83 -0
- data/lib/whats_app_cloud_api/models/component_type_enum.rb +20 -0
- data/lib/whats_app_cloud_api/models/contact.rb +145 -0
- data/lib/whats_app_cloud_api/models/content_type_enum.rb +14 -0
- data/lib/whats_app_cloud_api/models/currency.rb +67 -0
- data/lib/whats_app_cloud_api/models/date_time_object.rb +128 -0
- data/lib/whats_app_cloud_api/models/document.rb +81 -0
- data/lib/whats_app_cloud_api/models/email_object.rb +60 -0
- data/lib/whats_app_cloud_api/models/footer.rb +49 -0
- data/lib/whats_app_cloud_api/models/get_business_profile_id_response.rb +57 -0
- data/lib/whats_app_cloud_api/models/get_phone_number_by_id_response.rb +78 -0
- data/lib/whats_app_cloud_api/models/header.rb +93 -0
- data/lib/whats_app_cloud_api/models/header_type_enum.rb +23 -0
- data/lib/whats_app_cloud_api/models/image.rb +71 -0
- data/lib/whats_app_cloud_api/models/interactive.rb +87 -0
- data/lib/whats_app_cloud_api/models/interactive_type_enum.rb +17 -0
- data/lib/whats_app_cloud_api/models/language.rb +60 -0
- data/lib/whats_app_cloud_api/models/location.rb +78 -0
- data/lib/whats_app_cloud_api/models/message.rb +194 -0
- data/lib/whats_app_cloud_api/models/message_type_enum.rb +41 -0
- data/lib/whats_app_cloud_api/models/name.rb +100 -0
- data/lib/whats_app_cloud_api/models/org.rb +70 -0
- data/lib/whats_app_cloud_api/models/parameter.rb +113 -0
- data/lib/whats_app_cloud_api/models/parameter_type_enum.rb +29 -0
- data/lib/whats_app_cloud_api/models/personal_information_type_enum.rb +17 -0
- data/lib/whats_app_cloud_api/models/phone_object.rb +70 -0
- data/lib/whats_app_cloud_api/models/phone_type_enum.rb +26 -0
- data/lib/whats_app_cloud_api/models/quality_rating_enum.rb +25 -0
- data/lib/whats_app_cloud_api/models/register_phone_request.rb +58 -0
- data/lib/whats_app_cloud_api/models/request_verification_code_method_enum.rb +17 -0
- data/lib/whats_app_cloud_api/models/request_verification_code_request.rb +57 -0
- data/lib/whats_app_cloud_api/models/response_contact.rb +57 -0
- data/lib/whats_app_cloud_api/models/response_message.rb +48 -0
- data/lib/whats_app_cloud_api/models/retrieve_media_url_response.rb +94 -0
- data/lib/whats_app_cloud_api/models/row.rb +68 -0
- data/lib/whats_app_cloud_api/models/section.rb +72 -0
- data/lib/whats_app_cloud_api/models/send_message_response.rb +85 -0
- data/lib/whats_app_cloud_api/models/set_two_step_verification_code_request.rb +48 -0
- data/lib/whats_app_cloud_api/models/sticker.rb +61 -0
- data/lib/whats_app_cloud_api/models/sub_type_enum.rb +20 -0
- data/lib/whats_app_cloud_api/models/success_response.rb +48 -0
- data/lib/whats_app_cloud_api/models/template.rb +78 -0
- data/lib/whats_app_cloud_api/models/text.rb +72 -0
- data/lib/whats_app_cloud_api/models/update_business_profile_request.rb +116 -0
- data/lib/whats_app_cloud_api/models/upload_media.rb +48 -0
- data/lib/whats_app_cloud_api/models/upload_media_request.rb +80 -0
- data/lib/whats_app_cloud_api/models/url_object.rb +60 -0
- data/lib/whats_app_cloud_api/models/verify_code_request.rb +48 -0
- data/lib/whats_app_cloud_api/models/vertical_enum.rb +68 -0
- data/lib/whats_app_cloud_api/models/video.rb +61 -0
- data/lib/whats_app_cloud_api/utilities/date_time_helper.rb +156 -0
- data/lib/whats_app_cloud_api/utilities/file_wrapper.rb +16 -0
- data/lib/whats_app_cloud_api.rb +104 -0
- metadata +266 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
# whats_app_cloud_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WhatsAppCloudApi
|
7
|
+
# Body Model.
|
8
|
+
class Body < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# The body content of the message. Emojis and markdown are supported. Links
|
13
|
+
# are supported.
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :text
|
16
|
+
|
17
|
+
# A mapping from model property names to API property names.
|
18
|
+
def self.names
|
19
|
+
@_hash = {} if @_hash.nil?
|
20
|
+
@_hash['text'] = 'text'
|
21
|
+
@_hash
|
22
|
+
end
|
23
|
+
|
24
|
+
# An array for optional fields
|
25
|
+
def optionals
|
26
|
+
[]
|
27
|
+
end
|
28
|
+
|
29
|
+
# An array for nullable fields
|
30
|
+
def nullables
|
31
|
+
[]
|
32
|
+
end
|
33
|
+
|
34
|
+
def initialize(text = nil)
|
35
|
+
@text = text unless text == SKIP
|
36
|
+
end
|
37
|
+
|
38
|
+
# Creates an instance of the object from a hash.
|
39
|
+
def self.from_hash(hash)
|
40
|
+
return nil unless hash
|
41
|
+
|
42
|
+
# Extract variables from the hash.
|
43
|
+
text = hash.key?('text') ? hash['text'] : SKIP
|
44
|
+
|
45
|
+
# Create object from extracted values.
|
46
|
+
Body.new(text)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
# whats_app_cloud_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WhatsAppCloudApi
|
7
|
+
# BusinessProfile Model.
|
8
|
+
class BusinessProfile < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# ID of the business profile object.
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :id
|
15
|
+
|
16
|
+
# The messaging service used for the request. Always set it to "whatsapp" if
|
17
|
+
# you are using the WhatsApp Business API.
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :messaging_product
|
20
|
+
|
21
|
+
# Address of the business.
|
22
|
+
# @return [String]
|
23
|
+
attr_accessor :address
|
24
|
+
|
25
|
+
# Description of the business.
|
26
|
+
# @return [String]
|
27
|
+
attr_accessor :description
|
28
|
+
|
29
|
+
# Industry of the business. This can be either an empty string or one of the
|
30
|
+
# accepted values.
|
31
|
+
# @return [VerticalEnum]
|
32
|
+
attr_accessor :vertical
|
33
|
+
|
34
|
+
# The contact email address (in valid email format) of the business.
|
35
|
+
# @return [String]
|
36
|
+
attr_accessor :email
|
37
|
+
|
38
|
+
# The URLs associated with the business. For instance, a website, Facebook
|
39
|
+
# Page, or Instagram. You must include the http:// or https:// portion of
|
40
|
+
# the URL.
|
41
|
+
# @return [List of String]
|
42
|
+
attr_accessor :websites
|
43
|
+
|
44
|
+
# URL of the profile picture generated from a call to the Resumable Upload
|
45
|
+
# API.
|
46
|
+
# @return [String]
|
47
|
+
attr_accessor :profile_picture_url
|
48
|
+
|
49
|
+
# A mapping from model property names to API property names.
|
50
|
+
def self.names
|
51
|
+
@_hash = {} if @_hash.nil?
|
52
|
+
@_hash['id'] = 'id'
|
53
|
+
@_hash['messaging_product'] = 'messaging_product'
|
54
|
+
@_hash['address'] = 'address'
|
55
|
+
@_hash['description'] = 'description'
|
56
|
+
@_hash['vertical'] = 'vertical'
|
57
|
+
@_hash['email'] = 'email'
|
58
|
+
@_hash['websites'] = 'websites'
|
59
|
+
@_hash['profile_picture_url'] = 'profile_picture_url'
|
60
|
+
@_hash
|
61
|
+
end
|
62
|
+
|
63
|
+
# An array for optional fields
|
64
|
+
def optionals
|
65
|
+
%w[
|
66
|
+
vertical
|
67
|
+
email
|
68
|
+
websites
|
69
|
+
profile_picture_url
|
70
|
+
]
|
71
|
+
end
|
72
|
+
|
73
|
+
# An array for nullable fields
|
74
|
+
def nullables
|
75
|
+
[]
|
76
|
+
end
|
77
|
+
|
78
|
+
def initialize(id = nil,
|
79
|
+
messaging_product = nil,
|
80
|
+
address = nil,
|
81
|
+
description = nil,
|
82
|
+
vertical = nil,
|
83
|
+
email = nil,
|
84
|
+
websites = nil,
|
85
|
+
profile_picture_url = nil)
|
86
|
+
@id = id unless id == SKIP
|
87
|
+
@messaging_product = messaging_product unless messaging_product == SKIP
|
88
|
+
@address = address unless address == SKIP
|
89
|
+
@description = description unless description == SKIP
|
90
|
+
@vertical = vertical unless vertical == SKIP
|
91
|
+
@email = email unless email == SKIP
|
92
|
+
@websites = websites unless websites == SKIP
|
93
|
+
@profile_picture_url = profile_picture_url unless profile_picture_url == SKIP
|
94
|
+
end
|
95
|
+
|
96
|
+
# Creates an instance of the object from a hash.
|
97
|
+
def self.from_hash(hash)
|
98
|
+
return nil unless hash
|
99
|
+
|
100
|
+
# Extract variables from the hash.
|
101
|
+
id = hash.key?('id') ? hash['id'] : SKIP
|
102
|
+
messaging_product =
|
103
|
+
hash.key?('messaging_product') ? hash['messaging_product'] : SKIP
|
104
|
+
address = hash.key?('address') ? hash['address'] : SKIP
|
105
|
+
description = hash.key?('description') ? hash['description'] : SKIP
|
106
|
+
vertical = hash.key?('vertical') ? hash['vertical'] : SKIP
|
107
|
+
email = hash.key?('email') ? hash['email'] : SKIP
|
108
|
+
websites = hash.key?('websites') ? hash['websites'] : SKIP
|
109
|
+
profile_picture_url =
|
110
|
+
hash.key?('profile_picture_url') ? hash['profile_picture_url'] : SKIP
|
111
|
+
|
112
|
+
# Create object from extracted values.
|
113
|
+
BusinessProfile.new(id,
|
114
|
+
messaging_product,
|
115
|
+
address,
|
116
|
+
description,
|
117
|
+
vertical,
|
118
|
+
email,
|
119
|
+
websites,
|
120
|
+
profile_picture_url)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# whats_app_cloud_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WhatsAppCloudApi
|
7
|
+
# Button Model.
|
8
|
+
class Button < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# TODO: Write general description for this method
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :type
|
15
|
+
|
16
|
+
# Button title. It cannot be an empty string and must be unique within the
|
17
|
+
# message. Emojis are supported, markdown is not.
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :title
|
20
|
+
|
21
|
+
# Unique identifier for your button. This ID is returned in the webhook when
|
22
|
+
# the button is clicked by the user.
|
23
|
+
# @return [String]
|
24
|
+
attr_accessor :id
|
25
|
+
|
26
|
+
# A mapping from model property names to API property names.
|
27
|
+
def self.names
|
28
|
+
@_hash = {} if @_hash.nil?
|
29
|
+
@_hash['type'] = 'type'
|
30
|
+
@_hash['title'] = 'title'
|
31
|
+
@_hash['id'] = 'id'
|
32
|
+
@_hash
|
33
|
+
end
|
34
|
+
|
35
|
+
# An array for optional fields
|
36
|
+
def optionals
|
37
|
+
%w[
|
38
|
+
title
|
39
|
+
id
|
40
|
+
]
|
41
|
+
end
|
42
|
+
|
43
|
+
# An array for nullable fields
|
44
|
+
def nullables
|
45
|
+
[]
|
46
|
+
end
|
47
|
+
|
48
|
+
def initialize(type = 'reply',
|
49
|
+
title = nil,
|
50
|
+
id = nil)
|
51
|
+
@type = type unless type == SKIP
|
52
|
+
@title = title unless title == SKIP
|
53
|
+
@id = id unless id == SKIP
|
54
|
+
end
|
55
|
+
|
56
|
+
# Creates an instance of the object from a hash.
|
57
|
+
def self.from_hash(hash)
|
58
|
+
return nil unless hash
|
59
|
+
|
60
|
+
# Extract variables from the hash.
|
61
|
+
type = hash['type'] ||= 'reply'
|
62
|
+
title = hash.key?('title') ? hash['title'] : SKIP
|
63
|
+
id = hash.key?('id') ? hash['id'] : SKIP
|
64
|
+
|
65
|
+
# Create object from extracted values.
|
66
|
+
Button.new(type,
|
67
|
+
title,
|
68
|
+
id)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# whats_app_cloud_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WhatsAppCloudApi
|
7
|
+
# ButtonParameter Model.
|
8
|
+
class ButtonParameter < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# Indicates the type of parameter for the button.
|
13
|
+
# @return [ButtonParameterTypeEnum]
|
14
|
+
attr_accessor :type
|
15
|
+
|
16
|
+
# Required for quick_reply buttons. Developer-defined payload that is
|
17
|
+
# returned when the button is clicked in addition to the display text on the
|
18
|
+
# button.
|
19
|
+
# @return [String]
|
20
|
+
attr_accessor :payload
|
21
|
+
|
22
|
+
# Required for URL buttons. Developer-provided suffix that is appended to
|
23
|
+
# the predefined prefix URL in the template.
|
24
|
+
# @return [String]
|
25
|
+
attr_accessor :text
|
26
|
+
|
27
|
+
# A mapping from model property names to API property names.
|
28
|
+
def self.names
|
29
|
+
@_hash = {} if @_hash.nil?
|
30
|
+
@_hash['type'] = 'type'
|
31
|
+
@_hash['payload'] = 'payload'
|
32
|
+
@_hash['text'] = 'text'
|
33
|
+
@_hash
|
34
|
+
end
|
35
|
+
|
36
|
+
# An array for optional fields
|
37
|
+
def optionals
|
38
|
+
%w[
|
39
|
+
payload
|
40
|
+
text
|
41
|
+
]
|
42
|
+
end
|
43
|
+
|
44
|
+
# An array for nullable fields
|
45
|
+
def nullables
|
46
|
+
[]
|
47
|
+
end
|
48
|
+
|
49
|
+
def initialize(type = nil,
|
50
|
+
payload = nil,
|
51
|
+
text = nil)
|
52
|
+
@type = type unless type == SKIP
|
53
|
+
@payload = payload unless payload == SKIP
|
54
|
+
@text = text unless text == SKIP
|
55
|
+
end
|
56
|
+
|
57
|
+
# Creates an instance of the object from a hash.
|
58
|
+
def self.from_hash(hash)
|
59
|
+
return nil unless hash
|
60
|
+
|
61
|
+
# Extract variables from the hash.
|
62
|
+
type = hash.key?('type') ? hash['type'] : SKIP
|
63
|
+
payload = hash.key?('payload') ? hash['payload'] : SKIP
|
64
|
+
text = hash.key?('text') ? hash['text'] : SKIP
|
65
|
+
|
66
|
+
# Create object from extracted values.
|
67
|
+
ButtonParameter.new(type,
|
68
|
+
payload,
|
69
|
+
text)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# whats_app_cloud_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WhatsAppCloudApi
|
7
|
+
# ButtonParameterType.
|
8
|
+
class ButtonParameterTypeEnum
|
9
|
+
BUTTON_PARAMETER_TYPE_ENUM = [
|
10
|
+
# TODO: Write general description for PAYLOAD
|
11
|
+
PAYLOAD = 'payload'.freeze,
|
12
|
+
|
13
|
+
# TODO: Write general description for TEXT
|
14
|
+
TEXT = 'text'.freeze
|
15
|
+
].freeze
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# whats_app_cloud_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WhatsAppCloudApi
|
7
|
+
# Component Model.
|
8
|
+
class Component < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# Describes the component type. For text-based templates, we only support
|
13
|
+
# the type=body.
|
14
|
+
# @return [ComponentTypeEnum]
|
15
|
+
attr_accessor :type
|
16
|
+
|
17
|
+
# Required when type=button. Not used for the other types. Type of button to
|
18
|
+
# create.
|
19
|
+
# @return [SubTypeEnum]
|
20
|
+
attr_accessor :sub_type
|
21
|
+
|
22
|
+
# Required when type=button. Array of parameter objects with the content of
|
23
|
+
# the message. For components of type=button, see the button parameter
|
24
|
+
# object.
|
25
|
+
# @return [List of Object]
|
26
|
+
attr_accessor :parameters
|
27
|
+
|
28
|
+
# Required when type=button. Not used for the other types. Position index of
|
29
|
+
# the button. You can have up to 3 buttons using index values of 0 to 2.
|
30
|
+
# @return [String]
|
31
|
+
attr_accessor :index
|
32
|
+
|
33
|
+
# A mapping from model property names to API property names.
|
34
|
+
def self.names
|
35
|
+
@_hash = {} if @_hash.nil?
|
36
|
+
@_hash['type'] = 'type'
|
37
|
+
@_hash['sub_type'] = 'sub_type'
|
38
|
+
@_hash['parameters'] = 'parameters'
|
39
|
+
@_hash['index'] = 'index'
|
40
|
+
@_hash
|
41
|
+
end
|
42
|
+
|
43
|
+
# An array for optional fields
|
44
|
+
def optionals
|
45
|
+
%w[
|
46
|
+
sub_type
|
47
|
+
index
|
48
|
+
]
|
49
|
+
end
|
50
|
+
|
51
|
+
# An array for nullable fields
|
52
|
+
def nullables
|
53
|
+
[]
|
54
|
+
end
|
55
|
+
|
56
|
+
def initialize(type = nil,
|
57
|
+
parameters = nil,
|
58
|
+
sub_type = nil,
|
59
|
+
index = nil)
|
60
|
+
@type = type unless type == SKIP
|
61
|
+
@sub_type = sub_type unless sub_type == SKIP
|
62
|
+
@parameters = parameters unless parameters == SKIP
|
63
|
+
@index = index unless index == SKIP
|
64
|
+
end
|
65
|
+
|
66
|
+
# Creates an instance of the object from a hash.
|
67
|
+
def self.from_hash(hash)
|
68
|
+
return nil unless hash
|
69
|
+
|
70
|
+
# Extract variables from the hash.
|
71
|
+
type = hash.key?('type') ? hash['type'] : SKIP
|
72
|
+
parameters = hash.key?('parameters') ? hash['parameters'] : SKIP
|
73
|
+
sub_type = hash.key?('sub_type') ? hash['sub_type'] : SKIP
|
74
|
+
index = hash.key?('index') ? hash['index'] : SKIP
|
75
|
+
|
76
|
+
# Create object from extracted values.
|
77
|
+
Component.new(type,
|
78
|
+
parameters,
|
79
|
+
sub_type,
|
80
|
+
index)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# whats_app_cloud_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WhatsAppCloudApi
|
7
|
+
# ComponentType.
|
8
|
+
class ComponentTypeEnum
|
9
|
+
COMPONENT_TYPE_ENUM = [
|
10
|
+
# TODO: Write general description for HEADER
|
11
|
+
HEADER = 'header'.freeze,
|
12
|
+
|
13
|
+
# TODO: Write general description for BODY
|
14
|
+
BODY = 'body'.freeze,
|
15
|
+
|
16
|
+
# TODO: Write general description for BUTTON
|
17
|
+
BUTTON = 'button'.freeze
|
18
|
+
].freeze
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
# whats_app_cloud_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WhatsAppCloudApi
|
7
|
+
# Contact Model.
|
8
|
+
class Contact < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# Full contact address(es)
|
13
|
+
# @return [List of Address]
|
14
|
+
attr_accessor :addresses
|
15
|
+
|
16
|
+
# Full contact address(es)
|
17
|
+
# @return [String]
|
18
|
+
attr_accessor :birthday
|
19
|
+
|
20
|
+
# Contact email address(es)
|
21
|
+
# @return [List of EmailObject]
|
22
|
+
attr_accessor :emails
|
23
|
+
|
24
|
+
# Full contact name
|
25
|
+
# @return [Name]
|
26
|
+
attr_accessor :name
|
27
|
+
|
28
|
+
# Contact organization information
|
29
|
+
# @return [Org]
|
30
|
+
attr_accessor :org
|
31
|
+
|
32
|
+
# Contact phone number(s)
|
33
|
+
# @return [List of PhoneObject]
|
34
|
+
attr_accessor :phones
|
35
|
+
|
36
|
+
# Contact URL(s)
|
37
|
+
# @return [List of UrlObject]
|
38
|
+
attr_accessor :urls
|
39
|
+
|
40
|
+
# A mapping from model property names to API property names.
|
41
|
+
def self.names
|
42
|
+
@_hash = {} if @_hash.nil?
|
43
|
+
@_hash['addresses'] = 'addresses'
|
44
|
+
@_hash['birthday'] = 'birthday'
|
45
|
+
@_hash['emails'] = 'emails'
|
46
|
+
@_hash['name'] = 'name'
|
47
|
+
@_hash['org'] = 'org'
|
48
|
+
@_hash['phones'] = 'phones'
|
49
|
+
@_hash['urls'] = 'urls'
|
50
|
+
@_hash
|
51
|
+
end
|
52
|
+
|
53
|
+
# An array for optional fields
|
54
|
+
def optionals
|
55
|
+
%w[
|
56
|
+
addresses
|
57
|
+
birthday
|
58
|
+
emails
|
59
|
+
org
|
60
|
+
phones
|
61
|
+
urls
|
62
|
+
]
|
63
|
+
end
|
64
|
+
|
65
|
+
# An array for nullable fields
|
66
|
+
def nullables
|
67
|
+
[]
|
68
|
+
end
|
69
|
+
|
70
|
+
def initialize(name = nil,
|
71
|
+
addresses = nil,
|
72
|
+
birthday = 'YYYY-MM-DD formatted string.',
|
73
|
+
emails = nil,
|
74
|
+
org = nil,
|
75
|
+
phones = nil,
|
76
|
+
urls = nil)
|
77
|
+
@addresses = addresses unless addresses == SKIP
|
78
|
+
@birthday = birthday unless birthday == SKIP
|
79
|
+
@emails = emails unless emails == SKIP
|
80
|
+
@name = name unless name == SKIP
|
81
|
+
@org = org unless org == SKIP
|
82
|
+
@phones = phones unless phones == SKIP
|
83
|
+
@urls = urls unless urls == SKIP
|
84
|
+
end
|
85
|
+
|
86
|
+
# Creates an instance of the object from a hash.
|
87
|
+
def self.from_hash(hash)
|
88
|
+
return nil unless hash
|
89
|
+
|
90
|
+
# Extract variables from the hash.
|
91
|
+
name = Name.from_hash(hash['name']) if hash['name']
|
92
|
+
# Parameter is an array, so we need to iterate through it
|
93
|
+
addresses = nil
|
94
|
+
unless hash['addresses'].nil?
|
95
|
+
addresses = []
|
96
|
+
hash['addresses'].each do |structure|
|
97
|
+
addresses << (Address.from_hash(structure) if structure)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
addresses = SKIP unless hash.key?('addresses')
|
102
|
+
birthday = hash['birthday'] ||= 'YYYY-MM-DD formatted string.'
|
103
|
+
# Parameter is an array, so we need to iterate through it
|
104
|
+
emails = nil
|
105
|
+
unless hash['emails'].nil?
|
106
|
+
emails = []
|
107
|
+
hash['emails'].each do |structure|
|
108
|
+
emails << (EmailObject.from_hash(structure) if structure)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
emails = SKIP unless hash.key?('emails')
|
113
|
+
org = Org.from_hash(hash['org']) if hash['org']
|
114
|
+
# Parameter is an array, so we need to iterate through it
|
115
|
+
phones = nil
|
116
|
+
unless hash['phones'].nil?
|
117
|
+
phones = []
|
118
|
+
hash['phones'].each do |structure|
|
119
|
+
phones << (PhoneObject.from_hash(structure) if structure)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
phones = SKIP unless hash.key?('phones')
|
124
|
+
# Parameter is an array, so we need to iterate through it
|
125
|
+
urls = nil
|
126
|
+
unless hash['urls'].nil?
|
127
|
+
urls = []
|
128
|
+
hash['urls'].each do |structure|
|
129
|
+
urls << (UrlObject.from_hash(structure) if structure)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
urls = SKIP unless hash.key?('urls')
|
134
|
+
|
135
|
+
# Create object from extracted values.
|
136
|
+
Contact.new(name,
|
137
|
+
addresses,
|
138
|
+
birthday,
|
139
|
+
emails,
|
140
|
+
org,
|
141
|
+
phones,
|
142
|
+
urls)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# whats_app_cloud_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WhatsAppCloudApi
|
7
|
+
# Content-Type.
|
8
|
+
class ContentTypeEnum
|
9
|
+
CONTENT_TYPE_ENUM = [
|
10
|
+
# TODO: Write general description for ENUM_APPLICATIONJSON
|
11
|
+
ENUM_APPLICATIONJSON = 'application/json'.freeze
|
12
|
+
].freeze
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# whats_app_cloud_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WhatsAppCloudApi
|
7
|
+
# Currency Model.
|
8
|
+
class Currency < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# Default text if localization fails.
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :fallback_value
|
15
|
+
|
16
|
+
# Currency code as defined in ISO 4217.
|
17
|
+
# @return [String]
|
18
|
+
attr_accessor :code
|
19
|
+
|
20
|
+
# Amount multiplied by 1000.
|
21
|
+
# @return [Integer]
|
22
|
+
attr_accessor :amount_1000
|
23
|
+
|
24
|
+
# A mapping from model property names to API property names.
|
25
|
+
def self.names
|
26
|
+
@_hash = {} if @_hash.nil?
|
27
|
+
@_hash['fallback_value'] = 'fallback_value'
|
28
|
+
@_hash['code'] = 'code'
|
29
|
+
@_hash['amount_1000'] = 'amount_1000'
|
30
|
+
@_hash
|
31
|
+
end
|
32
|
+
|
33
|
+
# An array for optional fields
|
34
|
+
def optionals
|
35
|
+
[]
|
36
|
+
end
|
37
|
+
|
38
|
+
# An array for nullable fields
|
39
|
+
def nullables
|
40
|
+
[]
|
41
|
+
end
|
42
|
+
|
43
|
+
def initialize(fallback_value = nil,
|
44
|
+
code = nil,
|
45
|
+
amount_1000 = nil)
|
46
|
+
@fallback_value = fallback_value unless fallback_value == SKIP
|
47
|
+
@code = code unless code == SKIP
|
48
|
+
@amount_1000 = amount_1000 unless amount_1000 == SKIP
|
49
|
+
end
|
50
|
+
|
51
|
+
# Creates an instance of the object from a hash.
|
52
|
+
def self.from_hash(hash)
|
53
|
+
return nil unless hash
|
54
|
+
|
55
|
+
# Extract variables from the hash.
|
56
|
+
fallback_value =
|
57
|
+
hash.key?('fallback_value') ? hash['fallback_value'] : SKIP
|
58
|
+
code = hash.key?('code') ? hash['code'] : SKIP
|
59
|
+
amount_1000 = hash.key?('amount_1000') ? hash['amount_1000'] : SKIP
|
60
|
+
|
61
|
+
# Create object from extracted values.
|
62
|
+
Currency.new(fallback_value,
|
63
|
+
code,
|
64
|
+
amount_1000)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|