whatsapp-ruby-sdk 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.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +85 -0
  4. data/lib/whats_app_cloud_api/api_helper.rb +277 -0
  5. data/lib/whats_app_cloud_api/client.rb +68 -0
  6. data/lib/whats_app_cloud_api/configuration.rb +132 -0
  7. data/lib/whats_app_cloud_api/controllers/base_controller.rb +52 -0
  8. data/lib/whats_app_cloud_api/controllers/business_profiles_controller.rb +94 -0
  9. data/lib/whats_app_cloud_api/controllers/media_controller.rb +142 -0
  10. data/lib/whats_app_cloud_api/controllers/messages_controller.rb +51 -0
  11. data/lib/whats_app_cloud_api/controllers/phone_numbers_controller.rb +141 -0
  12. data/lib/whats_app_cloud_api/controllers/registration_controller.rb +91 -0
  13. data/lib/whats_app_cloud_api/controllers/two_step_verification_controller.rb +57 -0
  14. data/lib/whats_app_cloud_api/exceptions/api_exception.rb +20 -0
  15. data/lib/whats_app_cloud_api/http/auth/o_auth2.rb +17 -0
  16. data/lib/whats_app_cloud_api/http/faraday_client.rb +97 -0
  17. data/lib/whats_app_cloud_api/http/http_call_back.rb +24 -0
  18. data/lib/whats_app_cloud_api/http/http_client.rb +123 -0
  19. data/lib/whats_app_cloud_api/http/http_method_enum.rb +13 -0
  20. data/lib/whats_app_cloud_api/http/http_request.rb +54 -0
  21. data/lib/whats_app_cloud_api/http/http_response.rb +29 -0
  22. data/lib/whats_app_cloud_api/models/action.rb +91 -0
  23. data/lib/whats_app_cloud_api/models/address.rb +110 -0
  24. data/lib/whats_app_cloud_api/models/audio.rb +61 -0
  25. data/lib/whats_app_cloud_api/models/base_model.rb +58 -0
  26. data/lib/whats_app_cloud_api/models/body.rb +49 -0
  27. data/lib/whats_app_cloud_api/models/business_profile.rb +123 -0
  28. data/lib/whats_app_cloud_api/models/button.rb +71 -0
  29. data/lib/whats_app_cloud_api/models/button_parameter.rb +72 -0
  30. data/lib/whats_app_cloud_api/models/button_parameter_type_enum.rb +17 -0
  31. data/lib/whats_app_cloud_api/models/component.rb +83 -0
  32. data/lib/whats_app_cloud_api/models/component_type_enum.rb +20 -0
  33. data/lib/whats_app_cloud_api/models/contact.rb +145 -0
  34. data/lib/whats_app_cloud_api/models/content_type_enum.rb +14 -0
  35. data/lib/whats_app_cloud_api/models/currency.rb +67 -0
  36. data/lib/whats_app_cloud_api/models/date_time_object.rb +128 -0
  37. data/lib/whats_app_cloud_api/models/document.rb +81 -0
  38. data/lib/whats_app_cloud_api/models/email_object.rb +60 -0
  39. data/lib/whats_app_cloud_api/models/footer.rb +49 -0
  40. data/lib/whats_app_cloud_api/models/get_business_profile_id_response.rb +57 -0
  41. data/lib/whats_app_cloud_api/models/get_phone_number_by_id_response.rb +78 -0
  42. data/lib/whats_app_cloud_api/models/header.rb +93 -0
  43. data/lib/whats_app_cloud_api/models/header_type_enum.rb +23 -0
  44. data/lib/whats_app_cloud_api/models/image.rb +71 -0
  45. data/lib/whats_app_cloud_api/models/interactive.rb +87 -0
  46. data/lib/whats_app_cloud_api/models/interactive_type_enum.rb +17 -0
  47. data/lib/whats_app_cloud_api/models/language.rb +60 -0
  48. data/lib/whats_app_cloud_api/models/location.rb +78 -0
  49. data/lib/whats_app_cloud_api/models/message.rb +194 -0
  50. data/lib/whats_app_cloud_api/models/message_type_enum.rb +41 -0
  51. data/lib/whats_app_cloud_api/models/name.rb +100 -0
  52. data/lib/whats_app_cloud_api/models/org.rb +70 -0
  53. data/lib/whats_app_cloud_api/models/parameter.rb +113 -0
  54. data/lib/whats_app_cloud_api/models/parameter_type_enum.rb +29 -0
  55. data/lib/whats_app_cloud_api/models/personal_information_type_enum.rb +17 -0
  56. data/lib/whats_app_cloud_api/models/phone_object.rb +70 -0
  57. data/lib/whats_app_cloud_api/models/phone_type_enum.rb +26 -0
  58. data/lib/whats_app_cloud_api/models/quality_rating_enum.rb +25 -0
  59. data/lib/whats_app_cloud_api/models/register_phone_request.rb +58 -0
  60. data/lib/whats_app_cloud_api/models/request_verification_code_method_enum.rb +17 -0
  61. data/lib/whats_app_cloud_api/models/request_verification_code_request.rb +57 -0
  62. data/lib/whats_app_cloud_api/models/response_contact.rb +57 -0
  63. data/lib/whats_app_cloud_api/models/response_message.rb +48 -0
  64. data/lib/whats_app_cloud_api/models/retrieve_media_url_response.rb +94 -0
  65. data/lib/whats_app_cloud_api/models/row.rb +68 -0
  66. data/lib/whats_app_cloud_api/models/section.rb +72 -0
  67. data/lib/whats_app_cloud_api/models/send_message_response.rb +85 -0
  68. data/lib/whats_app_cloud_api/models/set_two_step_verification_code_request.rb +48 -0
  69. data/lib/whats_app_cloud_api/models/sticker.rb +61 -0
  70. data/lib/whats_app_cloud_api/models/sub_type_enum.rb +20 -0
  71. data/lib/whats_app_cloud_api/models/success_response.rb +48 -0
  72. data/lib/whats_app_cloud_api/models/template.rb +78 -0
  73. data/lib/whats_app_cloud_api/models/text.rb +72 -0
  74. data/lib/whats_app_cloud_api/models/update_business_profile_request.rb +116 -0
  75. data/lib/whats_app_cloud_api/models/upload_media.rb +48 -0
  76. data/lib/whats_app_cloud_api/models/upload_media_request.rb +80 -0
  77. data/lib/whats_app_cloud_api/models/url_object.rb +60 -0
  78. data/lib/whats_app_cloud_api/models/verify_code_request.rb +48 -0
  79. data/lib/whats_app_cloud_api/models/vertical_enum.rb +68 -0
  80. data/lib/whats_app_cloud_api/models/video.rb +61 -0
  81. data/lib/whats_app_cloud_api/utilities/date_time_helper.rb +156 -0
  82. data/lib/whats_app_cloud_api/utilities/file_wrapper.rb +16 -0
  83. data/lib/whats_app_cloud_api.rb +104 -0
  84. metadata +266 -0
@@ -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
+ # Section Model.
8
+ class Section < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Required if the message has more than one section. Title of the section.
13
+ # @return [String]
14
+ attr_accessor :title
15
+
16
+ # Required for List Messages. Contains a list of rows. You can have a total
17
+ # of 10 rows across your sections. Each row must have a title (Maximum
18
+ # length: 24 characters) and an ID (Maximum length: 200 characters). You can
19
+ # add a description (Maximum length: 72 characters), but it is optional.
20
+ # @return [List of Row]
21
+ attr_accessor :rows
22
+
23
+ # A mapping from model property names to API property names.
24
+ def self.names
25
+ @_hash = {} if @_hash.nil?
26
+ @_hash['title'] = 'title'
27
+ @_hash['rows'] = 'rows'
28
+ @_hash
29
+ end
30
+
31
+ # An array for optional fields
32
+ def optionals
33
+ %w[
34
+ title
35
+ rows
36
+ ]
37
+ end
38
+
39
+ # An array for nullable fields
40
+ def nullables
41
+ []
42
+ end
43
+
44
+ def initialize(title = nil,
45
+ rows = nil)
46
+ @title = title unless title == SKIP
47
+ @rows = rows unless rows == SKIP
48
+ end
49
+
50
+ # Creates an instance of the object from a hash.
51
+ def self.from_hash(hash)
52
+ return nil unless hash
53
+
54
+ # Extract variables from the hash.
55
+ title = hash.key?('title') ? hash['title'] : SKIP
56
+ # Parameter is an array, so we need to iterate through it
57
+ rows = nil
58
+ unless hash['rows'].nil?
59
+ rows = []
60
+ hash['rows'].each do |structure|
61
+ rows << (Row.from_hash(structure) if structure)
62
+ end
63
+ end
64
+
65
+ rows = SKIP unless hash.key?('rows')
66
+
67
+ # Create object from extracted values.
68
+ Section.new(title,
69
+ rows)
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,85 @@
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
+ # SendMessageResponse Model.
8
+ class SendMessageResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :messaging_product
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [List of ResponseContact]
18
+ attr_accessor :contacts
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [List of ResponseMessage]
22
+ attr_accessor :messages
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['messaging_product'] = 'messaging_product'
28
+ @_hash['contacts'] = 'contacts'
29
+ @_hash['messages'] = 'messages'
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(messaging_product = nil,
44
+ contacts = nil,
45
+ messages = nil)
46
+ @messaging_product = messaging_product unless messaging_product == SKIP
47
+ @contacts = contacts unless contacts == SKIP
48
+ @messages = messages unless messages == 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
+ messaging_product =
57
+ hash.key?('messaging_product') ? hash['messaging_product'] : SKIP
58
+ # Parameter is an array, so we need to iterate through it
59
+ contacts = nil
60
+ unless hash['contacts'].nil?
61
+ contacts = []
62
+ hash['contacts'].each do |structure|
63
+ contacts << (ResponseContact.from_hash(structure) if structure)
64
+ end
65
+ end
66
+
67
+ contacts = SKIP unless hash.key?('contacts')
68
+ # Parameter is an array, so we need to iterate through it
69
+ messages = nil
70
+ unless hash['messages'].nil?
71
+ messages = []
72
+ hash['messages'].each do |structure|
73
+ messages << (ResponseMessage.from_hash(structure) if structure)
74
+ end
75
+ end
76
+
77
+ messages = SKIP unless hash.key?('messages')
78
+
79
+ # Create object from extracted values.
80
+ SendMessageResponse.new(messaging_product,
81
+ contacts,
82
+ messages)
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,48 @@
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
+ # A 6-digit pin you wish to use for two-step authentication.
8
+ class SetTwoStepVerificationCodeRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :pin
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['pin'] = 'pin'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def optionals
25
+ []
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def nullables
30
+ []
31
+ end
32
+
33
+ def initialize(pin = nil)
34
+ @pin = pin unless pin == SKIP
35
+ end
36
+
37
+ # Creates an instance of the object from a hash.
38
+ def self.from_hash(hash)
39
+ return nil unless hash
40
+
41
+ # Extract variables from the hash.
42
+ pin = hash.key?('pin') ? hash['pin'] : SKIP
43
+
44
+ # Create object from extracted values.
45
+ SetTwoStepVerificationCodeRequest.new(pin)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,61 @@
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
+ # Sticker Model.
8
+ class Sticker < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The protocol and URL of the media to be sent. Use only with HTTP/HTTPS
13
+ # URLs. Required when you are not using an uploaded media ID.
14
+ # @return [String]
15
+ attr_accessor :link
16
+
17
+ # The media object ID. Required when you are not using a link.
18
+ # @return [String]
19
+ attr_accessor :id
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['link'] = 'link'
25
+ @_hash['id'] = 'id'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def optionals
31
+ %w[
32
+ link
33
+ id
34
+ ]
35
+ end
36
+
37
+ # An array for nullable fields
38
+ def nullables
39
+ []
40
+ end
41
+
42
+ def initialize(link = nil,
43
+ id = nil)
44
+ @link = link unless link == SKIP
45
+ @id = id unless id == SKIP
46
+ end
47
+
48
+ # Creates an instance of the object from a hash.
49
+ def self.from_hash(hash)
50
+ return nil unless hash
51
+
52
+ # Extract variables from the hash.
53
+ link = hash.key?('link') ? hash['link'] : SKIP
54
+ id = hash.key?('id') ? hash['id'] : SKIP
55
+
56
+ # Create object from extracted values.
57
+ Sticker.new(link,
58
+ id)
59
+ end
60
+ end
61
+ 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
+ # SubType.
8
+ class SubTypeEnum
9
+ SUB_TYPE_ENUM = [
10
+ # Refers to a previously created quick reply button that allows for the
11
+ # customer to return a predefined message.
12
+ QUICKREPLY = 'quick_reply'.freeze,
13
+
14
+ # Refers to a previously created button that allows the customer to visit
15
+ # the URL generated by appending the text parameter to the predefined
16
+ # prefix URL in the template.
17
+ URL = 'url'.freeze
18
+ ].freeze
19
+ end
20
+ end
@@ -0,0 +1,48 @@
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
+ # SuccessResponse Model.
8
+ class SuccessResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Boolean]
14
+ attr_accessor :success
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['success'] = 'success'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def optionals
25
+ []
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def nullables
30
+ []
31
+ end
32
+
33
+ def initialize(success = nil)
34
+ @success = success unless success == SKIP
35
+ end
36
+
37
+ # Creates an instance of the object from a hash.
38
+ def self.from_hash(hash)
39
+ return nil unless hash
40
+
41
+ # Extract variables from the hash.
42
+ success = hash.key?('success') ? hash['success'] : SKIP
43
+
44
+ # Create object from extracted values.
45
+ SuccessResponse.new(success)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,78 @@
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
+ # Template Model.
8
+ class Template < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Name of the template.
13
+ # @return [String]
14
+ attr_accessor :name
15
+
16
+ # Specifies the language the template may be rendered in. Only the
17
+ # deterministic language policy works with media template messages.
18
+ # @return [Language]
19
+ attr_accessor :language
20
+
21
+ # Array of components objects containing the parameters of the message.
22
+ # @return [List of Component]
23
+ attr_accessor :components
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['name'] = 'name'
29
+ @_hash['language'] = 'language'
30
+ @_hash['components'] = 'components'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def optionals
36
+ %w[
37
+ components
38
+ ]
39
+ end
40
+
41
+ # An array for nullable fields
42
+ def nullables
43
+ []
44
+ end
45
+
46
+ def initialize(name = nil,
47
+ language = nil,
48
+ components = nil)
49
+ @name = name unless name == SKIP
50
+ @language = language unless language == SKIP
51
+ @components = components unless components == SKIP
52
+ end
53
+
54
+ # Creates an instance of the object from a hash.
55
+ def self.from_hash(hash)
56
+ return nil unless hash
57
+
58
+ # Extract variables from the hash.
59
+ name = hash.key?('name') ? hash['name'] : SKIP
60
+ language = Language.from_hash(hash['language']) if hash['language']
61
+ # Parameter is an array, so we need to iterate through it
62
+ components = nil
63
+ unless hash['components'].nil?
64
+ components = []
65
+ hash['components'].each do |structure|
66
+ components << (Component.from_hash(structure) if structure)
67
+ end
68
+ end
69
+
70
+ components = SKIP unless hash.key?('components')
71
+
72
+ # Create object from extracted values.
73
+ Template.new(name,
74
+ language,
75
+ components)
76
+ end
77
+ end
78
+ 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
+ # Text Model.
8
+ class Text < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Required for text messages. The text of the text message which can contain
13
+ # URLs which begin with http:// or https:// and formatting. See available
14
+ # formatting options here. If you include URLs in your text and want to
15
+ # include a preview box in text messages (preview_url: true), make sure the
16
+ # URL starts with http:// or https:// —https:// URLs are preferred. You must
17
+ # include a hostname, since IP addresses will not be matched.
18
+ # @return [String]
19
+ attr_accessor :body
20
+
21
+ # By default, WhatsApp recognizes URLs and makes them clickable, but you can
22
+ # also include a preview box with more information about the link. Set this
23
+ # field to true if you want to include a URL preview box. The majority of
24
+ # the time, the receiver will see a URL they can click on when you send an
25
+ # URL, set preview_url to true, and provide a body object with a http or
26
+ # https link. URL previews are only rendered after one of the following has
27
+ # happened: The business has sent a message template to the user. The user
28
+ # initiates a conversation with a "click to chat" link. The user adds the
29
+ # business phone number to their address book and initiates a conversation.
30
+ # @return [Boolean]
31
+ attr_accessor :preview_url
32
+
33
+ # A mapping from model property names to API property names.
34
+ def self.names
35
+ @_hash = {} if @_hash.nil?
36
+ @_hash['body'] = 'body'
37
+ @_hash['preview_url'] = 'preview_url'
38
+ @_hash
39
+ end
40
+
41
+ # An array for optional fields
42
+ def optionals
43
+ %w[
44
+ preview_url
45
+ ]
46
+ end
47
+
48
+ # An array for nullable fields
49
+ def nullables
50
+ []
51
+ end
52
+
53
+ def initialize(body = nil,
54
+ preview_url = false)
55
+ @body = body unless body == SKIP
56
+ @preview_url = preview_url unless preview_url == SKIP
57
+ end
58
+
59
+ # Creates an instance of the object from a hash.
60
+ def self.from_hash(hash)
61
+ return nil unless hash
62
+
63
+ # Extract variables from the hash.
64
+ body = hash.key?('body') ? hash['body'] : SKIP
65
+ preview_url = hash['preview_url'] ||= false
66
+
67
+ # Create object from extracted values.
68
+ Text.new(body,
69
+ preview_url)
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,116 @@
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
+ # UpdateBusinessProfileRequest Model.
8
+ class UpdateBusinessProfileRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The messaging service used for the request. Always set it to "whatsapp" if
13
+ # you are using the WhatsApp Business API.
14
+ # @return [String]
15
+ attr_accessor :messaging_product
16
+
17
+ # Address of the business.
18
+ # @return [String]
19
+ attr_accessor :address
20
+
21
+ # Description of the business.
22
+ # @return [String]
23
+ attr_accessor :description
24
+
25
+ # Industry of the business. This can be either an empty string or one of the
26
+ # accepted values.
27
+ # @return [VerticalEnum]
28
+ attr_accessor :vertical
29
+
30
+ # The contact email address (in valid email format) of the business.
31
+ # @return [String]
32
+ attr_accessor :email
33
+
34
+ # The URLs associated with the business. For instance, a website, Facebook
35
+ # Page, or Instagram. You must include the http:// or https:// portion of
36
+ # the URL.
37
+ # @return [List of String]
38
+ attr_accessor :websites
39
+
40
+ # URL of the profile picture generated from a call to the Resumable Upload
41
+ # API.
42
+ # @return [String]
43
+ attr_accessor :profile_picture_url
44
+
45
+ # A mapping from model property names to API property names.
46
+ def self.names
47
+ @_hash = {} if @_hash.nil?
48
+ @_hash['messaging_product'] = 'messaging_product'
49
+ @_hash['address'] = 'address'
50
+ @_hash['description'] = 'description'
51
+ @_hash['vertical'] = 'vertical'
52
+ @_hash['email'] = 'email'
53
+ @_hash['websites'] = 'websites'
54
+ @_hash['profile_picture_url'] = 'profile_picture_url'
55
+ @_hash
56
+ end
57
+
58
+ # An array for optional fields
59
+ def optionals
60
+ %w[
61
+ address
62
+ description
63
+ vertical
64
+ email
65
+ websites
66
+ profile_picture_url
67
+ ]
68
+ end
69
+
70
+ # An array for nullable fields
71
+ def nullables
72
+ []
73
+ end
74
+
75
+ def initialize(messaging_product = nil,
76
+ address = nil,
77
+ description = nil,
78
+ vertical = nil,
79
+ email = nil,
80
+ websites = nil,
81
+ profile_picture_url = nil)
82
+ @messaging_product = messaging_product unless messaging_product == SKIP
83
+ @address = address unless address == SKIP
84
+ @description = description unless description == SKIP
85
+ @vertical = vertical unless vertical == SKIP
86
+ @email = email unless email == SKIP
87
+ @websites = websites unless websites == SKIP
88
+ @profile_picture_url = profile_picture_url unless profile_picture_url == SKIP
89
+ end
90
+
91
+ # Creates an instance of the object from a hash.
92
+ def self.from_hash(hash)
93
+ return nil unless hash
94
+
95
+ # Extract variables from the hash.
96
+ messaging_product =
97
+ hash.key?('messaging_product') ? hash['messaging_product'] : SKIP
98
+ address = hash.key?('address') ? hash['address'] : SKIP
99
+ description = hash.key?('description') ? hash['description'] : SKIP
100
+ vertical = hash.key?('vertical') ? hash['vertical'] : SKIP
101
+ email = hash.key?('email') ? hash['email'] : SKIP
102
+ websites = hash.key?('websites') ? hash['websites'] : SKIP
103
+ profile_picture_url =
104
+ hash.key?('profile_picture_url') ? hash['profile_picture_url'] : SKIP
105
+
106
+ # Create object from extracted values.
107
+ UpdateBusinessProfileRequest.new(messaging_product,
108
+ address,
109
+ description,
110
+ vertical,
111
+ email,
112
+ websites,
113
+ profile_picture_url)
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,48 @@
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
+ # UploadMedia Model.
8
+ class UploadMedia < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :id
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['id'] = 'id'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def optionals
25
+ []
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def nullables
30
+ []
31
+ end
32
+
33
+ def initialize(id = nil)
34
+ @id = id unless id == SKIP
35
+ end
36
+
37
+ # Creates an instance of the object from a hash.
38
+ def self.from_hash(hash)
39
+ return nil unless hash
40
+
41
+ # Extract variables from the hash.
42
+ id = hash.key?('id') ? hash['id'] : SKIP
43
+
44
+ # Create object from extracted values.
45
+ UploadMedia.new(id)
46
+ end
47
+ end
48
+ end