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,128 @@
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
+ # DateTimeObject Model.
8
+ class DateTimeObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Default text. For Cloud API, we always use the fallback value, and we do
13
+ # not attempt to localize using other optional fields.
14
+ # @return [String]
15
+ attr_accessor :fallback_value
16
+
17
+ # Default text. For Cloud API, we always use the fallback value, and we do
18
+ # not attempt to localize using other optional fields.
19
+ # @return [Integer]
20
+ attr_accessor :day_of_week
21
+
22
+ # Default text. For Cloud API, we always use the fallback value, and we do
23
+ # not attempt to localize using other optional fields.
24
+ # @return [Integer]
25
+ attr_accessor :year
26
+
27
+ # Default text. For Cloud API, we always use the fallback value, and we do
28
+ # not attempt to localize using other optional fields.
29
+ # @return [Integer]
30
+ attr_accessor :month
31
+
32
+ # Default text. For Cloud API, we always use the fallback value, and we do
33
+ # not attempt to localize using other optional fields.
34
+ # @return [Integer]
35
+ attr_accessor :day_of_month
36
+
37
+ # Default text. For Cloud API, we always use the fallback value, and we do
38
+ # not attempt to localize using other optional fields.
39
+ # @return [Integer]
40
+ attr_accessor :hour
41
+
42
+ # Default text. For Cloud API, we always use the fallback value, and we do
43
+ # not attempt to localize using other optional fields.
44
+ # @return [Integer]
45
+ attr_accessor :minute
46
+
47
+ # Default text. For Cloud API, we always use the fallback value, and we do
48
+ # not attempt to localize using other optional fields.
49
+ # @return [String]
50
+ attr_accessor :calendar
51
+
52
+ # A mapping from model property names to API property names.
53
+ def self.names
54
+ @_hash = {} if @_hash.nil?
55
+ @_hash['fallback_value'] = 'fallback_value'
56
+ @_hash['day_of_week'] = 'day_of_week'
57
+ @_hash['year'] = 'year'
58
+ @_hash['month'] = 'month'
59
+ @_hash['day_of_month'] = 'day_of_month'
60
+ @_hash['hour'] = 'hour'
61
+ @_hash['minute'] = 'minute'
62
+ @_hash['calendar'] = 'calendar'
63
+ @_hash
64
+ end
65
+
66
+ # An array for optional fields
67
+ def optionals
68
+ %w[
69
+ day_of_week
70
+ year
71
+ month
72
+ day_of_month
73
+ hour
74
+ minute
75
+ calendar
76
+ ]
77
+ end
78
+
79
+ # An array for nullable fields
80
+ def nullables
81
+ []
82
+ end
83
+
84
+ def initialize(fallback_value = nil,
85
+ day_of_week = nil,
86
+ year = nil,
87
+ month = nil,
88
+ day_of_month = nil,
89
+ hour = nil,
90
+ minute = nil,
91
+ calendar = nil)
92
+ @fallback_value = fallback_value unless fallback_value == SKIP
93
+ @day_of_week = day_of_week unless day_of_week == SKIP
94
+ @year = year unless year == SKIP
95
+ @month = month unless month == SKIP
96
+ @day_of_month = day_of_month unless day_of_month == SKIP
97
+ @hour = hour unless hour == SKIP
98
+ @minute = minute unless minute == SKIP
99
+ @calendar = calendar unless calendar == SKIP
100
+ end
101
+
102
+ # Creates an instance of the object from a hash.
103
+ def self.from_hash(hash)
104
+ return nil unless hash
105
+
106
+ # Extract variables from the hash.
107
+ fallback_value =
108
+ hash.key?('fallback_value') ? hash['fallback_value'] : SKIP
109
+ day_of_week = hash.key?('day_of_week') ? hash['day_of_week'] : SKIP
110
+ year = hash.key?('year') ? hash['year'] : SKIP
111
+ month = hash.key?('month') ? hash['month'] : SKIP
112
+ day_of_month = hash.key?('day_of_month') ? hash['day_of_month'] : SKIP
113
+ hour = hash.key?('hour') ? hash['hour'] : SKIP
114
+ minute = hash.key?('minute') ? hash['minute'] : SKIP
115
+ calendar = hash.key?('calendar') ? hash['calendar'] : SKIP
116
+
117
+ # Create object from extracted values.
118
+ DateTimeObject.new(fallback_value,
119
+ day_of_week,
120
+ year,
121
+ month,
122
+ day_of_month,
123
+ hour,
124
+ minute,
125
+ calendar)
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,81 @@
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
+ # Document Model.
8
+ class Document < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # It is the media object ID. Required when you are not using a link.
13
+ # @return [String]
14
+ attr_accessor :id
15
+
16
+ # The protocol and URL of the media to be sent. Use only with HTTP/HTTPS
17
+ # URLs. Required when you are not using an uploaded media ID.
18
+ # @return [String]
19
+ attr_accessor :link
20
+
21
+ # Describes the specified document media.
22
+ # @return [String]
23
+ attr_accessor :caption
24
+
25
+ # Describes the filename for the specific document.
26
+ # @return [String]
27
+ attr_accessor :filename
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['id'] = 'id'
33
+ @_hash['link'] = 'link'
34
+ @_hash['caption'] = 'caption'
35
+ @_hash['filename'] = 'filename'
36
+ @_hash
37
+ end
38
+
39
+ # An array for optional fields
40
+ def optionals
41
+ %w[
42
+ id
43
+ link
44
+ caption
45
+ filename
46
+ ]
47
+ end
48
+
49
+ # An array for nullable fields
50
+ def nullables
51
+ []
52
+ end
53
+
54
+ def initialize(id = nil,
55
+ link = nil,
56
+ caption = nil,
57
+ filename = nil)
58
+ @id = id unless id == SKIP
59
+ @link = link unless link == SKIP
60
+ @caption = caption unless caption == SKIP
61
+ @filename = filename unless filename == SKIP
62
+ end
63
+
64
+ # Creates an instance of the object from a hash.
65
+ def self.from_hash(hash)
66
+ return nil unless hash
67
+
68
+ # Extract variables from the hash.
69
+ id = hash.key?('id') ? hash['id'] : SKIP
70
+ link = hash.key?('link') ? hash['link'] : SKIP
71
+ caption = hash.key?('caption') ? hash['caption'] : SKIP
72
+ filename = hash.key?('filename') ? hash['filename'] : SKIP
73
+
74
+ # Create object from extracted values.
75
+ Document.new(id,
76
+ link,
77
+ caption,
78
+ filename)
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,60 @@
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
+ # EmailObject Model.
8
+ class EmailObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :email
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [PersonalInformationTypeEnum]
18
+ attr_accessor :type
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['email'] = 'email'
24
+ @_hash['type'] = 'type'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def optionals
30
+ %w[
31
+ email
32
+ type
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def nullables
38
+ []
39
+ end
40
+
41
+ def initialize(email = nil,
42
+ type = nil)
43
+ @email = email unless email == SKIP
44
+ @type = type unless type == SKIP
45
+ end
46
+
47
+ # Creates an instance of the object from a hash.
48
+ def self.from_hash(hash)
49
+ return nil unless hash
50
+
51
+ # Extract variables from the hash.
52
+ email = hash.key?('email') ? hash['email'] : SKIP
53
+ type = hash.key?('type') ? hash['type'] : SKIP
54
+
55
+ # Create object from extracted values.
56
+ EmailObject.new(email,
57
+ type)
58
+ end
59
+ end
60
+ end
@@ -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
+ # Footer Model.
8
+ class Footer < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The footer content. Emojis and markdown are supported. Links are
13
+ # 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
+ Footer.new(text)
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,57 @@
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
+ # GetBusinessProfileIDResponse Model.
8
+ class GetBusinessProfileIDResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [List of BusinessProfile]
14
+ attr_accessor :data
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['data'] = 'data'
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(data = nil)
34
+ @data = data unless data == 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
+ # Parameter is an array, so we need to iterate through it
43
+ data = nil
44
+ unless hash['data'].nil?
45
+ data = []
46
+ hash['data'].each do |structure|
47
+ data << (BusinessProfile.from_hash(structure) if structure)
48
+ end
49
+ end
50
+
51
+ data = SKIP unless hash.key?('data')
52
+
53
+ # Create object from extracted values.
54
+ GetBusinessProfileIDResponse.new(data)
55
+ end
56
+ end
57
+ 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
+ # GetPhoneNumberByIDResponse Model.
8
+ class GetPhoneNumberByIDResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The verified name associated with the phone number.
13
+ # @return [String]
14
+ attr_accessor :verified_name
15
+
16
+ # The string representation of the phone number.
17
+ # @return [String]
18
+ attr_accessor :display_phone_number
19
+
20
+ # The ID associated with the phone number.
21
+ # @return [String]
22
+ attr_accessor :id
23
+
24
+ # The quality rating of the phone number based on how messages have been
25
+ # received by recipients in recent days.
26
+ # @return [QualityRatingEnum]
27
+ attr_accessor :quality_rating
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['verified_name'] = 'verified_name'
33
+ @_hash['display_phone_number'] = 'display_phone_number'
34
+ @_hash['id'] = 'id'
35
+ @_hash['quality_rating'] = 'quality_rating'
36
+ @_hash
37
+ end
38
+
39
+ # An array for optional fields
40
+ def optionals
41
+ []
42
+ end
43
+
44
+ # An array for nullable fields
45
+ def nullables
46
+ []
47
+ end
48
+
49
+ def initialize(verified_name = nil,
50
+ display_phone_number = nil,
51
+ id = nil,
52
+ quality_rating = nil)
53
+ @verified_name = verified_name unless verified_name == SKIP
54
+ @display_phone_number = display_phone_number unless display_phone_number == SKIP
55
+ @id = id unless id == SKIP
56
+ @quality_rating = quality_rating unless quality_rating == 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
+ verified_name = hash.key?('verified_name') ? hash['verified_name'] : SKIP
65
+ display_phone_number =
66
+ hash.key?('display_phone_number') ? hash['display_phone_number'] : SKIP
67
+ id = hash.key?('id') ? hash['id'] : SKIP
68
+ quality_rating =
69
+ hash.key?('quality_rating') ? hash['quality_rating'] : SKIP
70
+
71
+ # Create object from extracted values.
72
+ GetPhoneNumberByIDResponse.new(verified_name,
73
+ display_phone_number,
74
+ id,
75
+ quality_rating)
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,93 @@
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
+ # Header Model.
8
+ class Header < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The header type you would like to use.
13
+ # @return [HeaderTypeEnum]
14
+ attr_accessor :type
15
+
16
+ # Required if type is set to text. Text for the header. Formatting allows
17
+ # emojis, but not markdown.
18
+ # @return [String]
19
+ attr_accessor :text
20
+
21
+ # Required if type is set to video. Contains the media object for this
22
+ # video.
23
+ # @return [Video]
24
+ attr_accessor :video
25
+
26
+ # Required if type is set to image. Contains the media object for this
27
+ # image.
28
+ # @return [Image]
29
+ attr_accessor :image
30
+
31
+ # Required if type is set to document. Contains the media object for this
32
+ # document.
33
+ # @return [Document]
34
+ attr_accessor :document
35
+
36
+ # A mapping from model property names to API property names.
37
+ def self.names
38
+ @_hash = {} if @_hash.nil?
39
+ @_hash['type'] = 'type'
40
+ @_hash['text'] = 'text'
41
+ @_hash['video'] = 'video'
42
+ @_hash['image'] = 'image'
43
+ @_hash['document'] = 'document'
44
+ @_hash
45
+ end
46
+
47
+ # An array for optional fields
48
+ def optionals
49
+ %w[
50
+ text
51
+ video
52
+ image
53
+ document
54
+ ]
55
+ end
56
+
57
+ # An array for nullable fields
58
+ def nullables
59
+ []
60
+ end
61
+
62
+ def initialize(type = nil,
63
+ text = nil,
64
+ video = nil,
65
+ image = nil,
66
+ document = nil)
67
+ @type = type unless type == SKIP
68
+ @text = text unless text == SKIP
69
+ @video = video unless video == SKIP
70
+ @image = image unless image == SKIP
71
+ @document = document unless document == SKIP
72
+ end
73
+
74
+ # Creates an instance of the object from a hash.
75
+ def self.from_hash(hash)
76
+ return nil unless hash
77
+
78
+ # Extract variables from the hash.
79
+ type = hash.key?('type') ? hash['type'] : SKIP
80
+ text = hash.key?('text') ? hash['text'] : SKIP
81
+ video = Video.from_hash(hash['video']) if hash['video']
82
+ image = Image.from_hash(hash['image']) if hash['image']
83
+ document = Document.from_hash(hash['document']) if hash['document']
84
+
85
+ # Create object from extracted values.
86
+ Header.new(type,
87
+ text,
88
+ video,
89
+ image,
90
+ document)
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,23 @@
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
+ # HeaderType.
8
+ class HeaderTypeEnum
9
+ HEADER_TYPE_ENUM = [
10
+ # Used for List Messages and Reply Buttons.
11
+ TEXT = 'text'.freeze,
12
+
13
+ # Used for Reply Buttons.
14
+ DOCUMENT = 'document'.freeze,
15
+
16
+ # Used for Reply Buttons.
17
+ IMAGE = 'image'.freeze,
18
+
19
+ # Used for Reply Buttons.
20
+ VIDEO = 'video'.freeze
21
+ ].freeze
22
+ end
23
+ 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
+ # Image Model.
8
+ class Image < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The media object ID. Required when you are not using a link.
13
+ # @return [String]
14
+ attr_accessor :id
15
+
16
+ # The protocol and URL of the media to be sent. Use only with HTTP/HTTPS
17
+ # URLs. Required when you are not using an uploaded media ID.
18
+ # @return [String]
19
+ attr_accessor :link
20
+
21
+ # Describes the specified image media.
22
+ # @return [String]
23
+ attr_accessor :caption
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['id'] = 'id'
29
+ @_hash['link'] = 'link'
30
+ @_hash['caption'] = 'caption'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def optionals
36
+ %w[
37
+ id
38
+ link
39
+ caption
40
+ ]
41
+ end
42
+
43
+ # An array for nullable fields
44
+ def nullables
45
+ []
46
+ end
47
+
48
+ def initialize(id = nil,
49
+ link = nil,
50
+ caption = nil)
51
+ @id = id unless id == SKIP
52
+ @link = link unless link == SKIP
53
+ @caption = caption unless caption == 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
+ id = hash.key?('id') ? hash['id'] : SKIP
62
+ link = hash.key?('link') ? hash['link'] : SKIP
63
+ caption = hash.key?('caption') ? hash['caption'] : SKIP
64
+
65
+ # Create object from extracted values.
66
+ Image.new(id,
67
+ link,
68
+ caption)
69
+ end
70
+ end
71
+ end