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,113 @@
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
+ # Parameter Model.
8
+ class Parameter < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Describes the parameter type. For text-based templates, the only supported
13
+ # parameter types are text, currency, date_time.
14
+ # @return [ParameterTypeEnum]
15
+ attr_accessor :type
16
+
17
+ # Required when type=text. The message’s text. For the header component, the
18
+ # character limit is 60 characters. For the body component, the character
19
+ # limit is 1024 characters.
20
+ # @return [String]
21
+ attr_accessor :text
22
+
23
+ # Required when type=currency.
24
+ # @return [Currency]
25
+ attr_accessor :currency
26
+
27
+ # Required when type=date_time.
28
+ # @return [DateTimeObject]
29
+ attr_accessor :date_time
30
+
31
+ # Required when type=image.
32
+ # @return [Image]
33
+ attr_accessor :image
34
+
35
+ # Required when type=document. Only PDF documents are supported for
36
+ # media-based message templates.
37
+ # @return [Document]
38
+ attr_accessor :document
39
+
40
+ # Required when type=video.
41
+ # @return [Video]
42
+ attr_accessor :video
43
+
44
+ # A mapping from model property names to API property names.
45
+ def self.names
46
+ @_hash = {} if @_hash.nil?
47
+ @_hash['type'] = 'type'
48
+ @_hash['text'] = 'text'
49
+ @_hash['currency'] = 'currency'
50
+ @_hash['date_time'] = 'date_time'
51
+ @_hash['image'] = 'image'
52
+ @_hash['document'] = 'document'
53
+ @_hash['video'] = 'video'
54
+ @_hash
55
+ end
56
+
57
+ # An array for optional fields
58
+ def optionals
59
+ %w[
60
+ text
61
+ currency
62
+ date_time
63
+ image
64
+ document
65
+ video
66
+ ]
67
+ end
68
+
69
+ # An array for nullable fields
70
+ def nullables
71
+ []
72
+ end
73
+
74
+ def initialize(type = nil,
75
+ text = nil,
76
+ currency = nil,
77
+ date_time = nil,
78
+ image = nil,
79
+ document = nil,
80
+ video = nil)
81
+ @type = type unless type == SKIP
82
+ @text = text unless text == SKIP
83
+ @currency = currency unless currency == SKIP
84
+ @date_time = date_time unless date_time == SKIP
85
+ @image = image unless image == SKIP
86
+ @document = document unless document == SKIP
87
+ @video = video unless video == SKIP
88
+ end
89
+
90
+ # Creates an instance of the object from a hash.
91
+ def self.from_hash(hash)
92
+ return nil unless hash
93
+
94
+ # Extract variables from the hash.
95
+ type = hash.key?('type') ? hash['type'] : SKIP
96
+ text = hash.key?('text') ? hash['text'] : SKIP
97
+ currency = Currency.from_hash(hash['currency']) if hash['currency']
98
+ date_time = DateTimeObject.from_hash(hash['date_time']) if hash['date_time']
99
+ image = Image.from_hash(hash['image']) if hash['image']
100
+ document = Document.from_hash(hash['document']) if hash['document']
101
+ video = Video.from_hash(hash['video']) if hash['video']
102
+
103
+ # Create object from extracted values.
104
+ Parameter.new(type,
105
+ text,
106
+ currency,
107
+ date_time,
108
+ image,
109
+ document,
110
+ video)
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,29 @@
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
+ # ParameterType.
8
+ class ParameterTypeEnum
9
+ PARAMETER_TYPE_ENUM = [
10
+ # TODO: Write general description for TEXT
11
+ TEXT = 'text'.freeze,
12
+
13
+ # TODO: Write general description for CURRENCY
14
+ CURRENCY = 'currency'.freeze,
15
+
16
+ # TODO: Write general description for DATE_TIME
17
+ DATE_TIME = 'date_time'.freeze,
18
+
19
+ # TODO: Write general description for IMAGE
20
+ IMAGE = 'image'.freeze,
21
+
22
+ # TODO: Write general description for DOCUMENT
23
+ DOCUMENT = 'document'.freeze,
24
+
25
+ # TODO: Write general description for VIDEO
26
+ VIDEO = 'video'.freeze
27
+ ].freeze
28
+ end
29
+ 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
+ # PersonalInformationType.
8
+ class PersonalInformationTypeEnum
9
+ PERSONAL_INFORMATION_TYPE_ENUM = [
10
+ # TODO: Write general description for HOME
11
+ HOME = 'HOME'.freeze,
12
+
13
+ # TODO: Write general description for WORK
14
+ WORK = 'WORK'.freeze
15
+ ].freeze
16
+ end
17
+ end
@@ -0,0 +1,70 @@
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
+ # PhoneObject Model.
8
+ class PhoneObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Automatically populated with the wa_id value as a formatted phone number.
13
+ # @return [String]
14
+ attr_accessor :phone
15
+
16
+ # WhatsApp ID.
17
+ # @return [String]
18
+ attr_accessor :wa_id
19
+
20
+ # WhatsApp ID.
21
+ # @return [PhoneTypeEnum]
22
+ attr_accessor :type
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['phone'] = 'phone'
28
+ @_hash['wa_id'] = 'wa_id'
29
+ @_hash['type'] = 'type'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def optionals
35
+ %w[
36
+ phone
37
+ wa_id
38
+ type
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def nullables
44
+ []
45
+ end
46
+
47
+ def initialize(phone = nil,
48
+ wa_id = nil,
49
+ type = nil)
50
+ @phone = phone unless phone == SKIP
51
+ @wa_id = wa_id unless wa_id == SKIP
52
+ @type = type unless type == SKIP
53
+ end
54
+
55
+ # Creates an instance of the object from a hash.
56
+ def self.from_hash(hash)
57
+ return nil unless hash
58
+
59
+ # Extract variables from the hash.
60
+ phone = hash.key?('phone') ? hash['phone'] : SKIP
61
+ wa_id = hash.key?('wa_id') ? hash['wa_id'] : SKIP
62
+ type = hash.key?('type') ? hash['type'] : SKIP
63
+
64
+ # Create object from extracted values.
65
+ PhoneObject.new(phone,
66
+ wa_id,
67
+ type)
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,26 @@
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
+ # PhoneType.
8
+ class PhoneTypeEnum
9
+ PHONE_TYPE_ENUM = [
10
+ # TODO: Write general description for HOME
11
+ HOME = 'HOME'.freeze,
12
+
13
+ # TODO: Write general description for WORK
14
+ WORK = 'WORK'.freeze,
15
+
16
+ # TODO: Write general description for CELL
17
+ CELL = 'CELL'.freeze,
18
+
19
+ # TODO: Write general description for MAIN
20
+ MAIN = 'MAIN'.freeze,
21
+
22
+ # TODO: Write general description for IPHONE
23
+ IPHONE = 'IPHONE'.freeze
24
+ ].freeze
25
+ end
26
+ end
@@ -0,0 +1,25 @@
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
+ # For more information relating to quality rating, see [About WhatsApp
8
+ # Business Account Message Quality
9
+ # Rating](https://www.facebook.com/business/help/896873687365001).
10
+ class QualityRatingEnum
11
+ QUALITY_RATING_ENUM = [
12
+ # High Quality.
13
+ GREEN = 'GREEN'.freeze,
14
+
15
+ # Medium Quality.
16
+ YELLOW = 'YELLOW'.freeze,
17
+
18
+ # Low Quality.
19
+ RED = 'RED'.freeze,
20
+
21
+ # Quality has not been determined.
22
+ NA = 'NA'.freeze
23
+ ].freeze
24
+ end
25
+ end
@@ -0,0 +1,58 @@
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
+ # RegisterPhoneRequest Model.
8
+ class RegisterPhoneRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Messaging service used. In this case, use "whatsapp".
13
+ # @return [String]
14
+ attr_accessor :messaging_product
15
+
16
+ # A 6-digit pin you have previously set up - See Set Two-Step Verification.
17
+ # @return [String]
18
+ attr_accessor :pin
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['messaging_product'] = 'messaging_product'
24
+ @_hash['pin'] = 'pin'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def optionals
30
+ []
31
+ end
32
+
33
+ # An array for nullable fields
34
+ def nullables
35
+ []
36
+ end
37
+
38
+ def initialize(messaging_product = nil,
39
+ pin = nil)
40
+ @messaging_product = messaging_product unless messaging_product == SKIP
41
+ @pin = pin unless pin == SKIP
42
+ end
43
+
44
+ # Creates an instance of the object from a hash.
45
+ def self.from_hash(hash)
46
+ return nil unless hash
47
+
48
+ # Extract variables from the hash.
49
+ messaging_product =
50
+ hash.key?('messaging_product') ? hash['messaging_product'] : SKIP
51
+ pin = hash.key?('pin') ? hash['pin'] : SKIP
52
+
53
+ # Create object from extracted values.
54
+ RegisterPhoneRequest.new(messaging_product,
55
+ pin)
56
+ end
57
+ end
58
+ 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
+ # RequestVerificationCodeMethod.
8
+ class RequestVerificationCodeMethodEnum
9
+ REQUEST_VERIFICATION_CODE_METHOD_ENUM = [
10
+ # TODO: Write general description for SMS
11
+ SMS = 'SMS'.freeze,
12
+
13
+ # TODO: Write general description for VOICE
14
+ VOICE = 'VOICE'.freeze
15
+ ].freeze
16
+ end
17
+ 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
+ # RequestVerificationCodeRequest Model.
8
+ class RequestVerificationCodeRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Chosen method for verification.
13
+ # @return [RequestVerificationCodeMethodEnum]
14
+ attr_accessor :code_method
15
+
16
+ # Your locale. For example: "en_US".
17
+ # @return [String]
18
+ attr_accessor :locale
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['code_method'] = 'code_method'
24
+ @_hash['locale'] = 'locale'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def optionals
30
+ []
31
+ end
32
+
33
+ # An array for nullable fields
34
+ def nullables
35
+ []
36
+ end
37
+
38
+ def initialize(code_method = nil,
39
+ locale = nil)
40
+ @code_method = code_method unless code_method == SKIP
41
+ @locale = locale unless locale == SKIP
42
+ end
43
+
44
+ # Creates an instance of the object from a hash.
45
+ def self.from_hash(hash)
46
+ return nil unless hash
47
+
48
+ # Extract variables from the hash.
49
+ code_method = hash.key?('code_method') ? hash['code_method'] : SKIP
50
+ locale = hash.key?('locale') ? hash['locale'] : SKIP
51
+
52
+ # Create object from extracted values.
53
+ RequestVerificationCodeRequest.new(code_method,
54
+ locale)
55
+ end
56
+ end
57
+ 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
+ # ResponseContact Model.
8
+ class ResponseContact < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :input
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :wa_id
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['input'] = 'input'
24
+ @_hash['wa_id'] = 'wa_id'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def optionals
30
+ []
31
+ end
32
+
33
+ # An array for nullable fields
34
+ def nullables
35
+ []
36
+ end
37
+
38
+ def initialize(input = nil,
39
+ wa_id = nil)
40
+ @input = input unless input == SKIP
41
+ @wa_id = wa_id unless wa_id == SKIP
42
+ end
43
+
44
+ # Creates an instance of the object from a hash.
45
+ def self.from_hash(hash)
46
+ return nil unless hash
47
+
48
+ # Extract variables from the hash.
49
+ input = hash.key?('input') ? hash['input'] : SKIP
50
+ wa_id = hash.key?('wa_id') ? hash['wa_id'] : SKIP
51
+
52
+ # Create object from extracted values.
53
+ ResponseContact.new(input,
54
+ wa_id)
55
+ end
56
+ end
57
+ 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
+ # ResponseMessage Model.
8
+ class ResponseMessage < 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
+ ResponseMessage.new(id)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,94 @@
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
+ # RetrieveMediaURLResponse Model.
8
+ class RetrieveMediaURLResponse < 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 [String]
18
+ attr_accessor :url
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :mime_type
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :sha256
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [String]
30
+ attr_accessor :file_size
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [String]
34
+ attr_accessor :id
35
+
36
+ # A mapping from model property names to API property names.
37
+ def self.names
38
+ @_hash = {} if @_hash.nil?
39
+ @_hash['messaging_product'] = 'messaging_product'
40
+ @_hash['url'] = 'url'
41
+ @_hash['mime_type'] = 'mime_type'
42
+ @_hash['sha256'] = 'sha256'
43
+ @_hash['file_size'] = 'file_size'
44
+ @_hash['id'] = 'id'
45
+ @_hash
46
+ end
47
+
48
+ # An array for optional fields
49
+ def optionals
50
+ []
51
+ end
52
+
53
+ # An array for nullable fields
54
+ def nullables
55
+ []
56
+ end
57
+
58
+ def initialize(messaging_product = nil,
59
+ url = nil,
60
+ mime_type = nil,
61
+ sha256 = nil,
62
+ file_size = nil,
63
+ id = nil)
64
+ @messaging_product = messaging_product unless messaging_product == SKIP
65
+ @url = url unless url == SKIP
66
+ @mime_type = mime_type unless mime_type == SKIP
67
+ @sha256 = sha256 unless sha256 == SKIP
68
+ @file_size = file_size unless file_size == SKIP
69
+ @id = id unless id == SKIP
70
+ end
71
+
72
+ # Creates an instance of the object from a hash.
73
+ def self.from_hash(hash)
74
+ return nil unless hash
75
+
76
+ # Extract variables from the hash.
77
+ messaging_product =
78
+ hash.key?('messaging_product') ? hash['messaging_product'] : SKIP
79
+ url = hash.key?('url') ? hash['url'] : SKIP
80
+ mime_type = hash.key?('mime_type') ? hash['mime_type'] : SKIP
81
+ sha256 = hash.key?('sha256') ? hash['sha256'] : SKIP
82
+ file_size = hash.key?('file_size') ? hash['file_size'] : SKIP
83
+ id = hash.key?('id') ? hash['id'] : SKIP
84
+
85
+ # Create object from extracted values.
86
+ RetrieveMediaURLResponse.new(messaging_product,
87
+ url,
88
+ mime_type,
89
+ sha256,
90
+ file_size,
91
+ id)
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,68 @@
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
+ # Row Model.
8
+ class Row < 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
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :title
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :description
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['id'] = 'id'
28
+ @_hash['title'] = 'title'
29
+ @_hash['description'] = 'description'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def optionals
35
+ %w[
36
+ description
37
+ ]
38
+ end
39
+
40
+ # An array for nullable fields
41
+ def nullables
42
+ []
43
+ end
44
+
45
+ def initialize(id = nil,
46
+ title = nil,
47
+ description = nil)
48
+ @id = id unless id == SKIP
49
+ @title = title unless title == SKIP
50
+ @description = description unless description == SKIP
51
+ end
52
+
53
+ # Creates an instance of the object from a hash.
54
+ def self.from_hash(hash)
55
+ return nil unless hash
56
+
57
+ # Extract variables from the hash.
58
+ id = hash.key?('id') ? hash['id'] : SKIP
59
+ title = hash.key?('title') ? hash['title'] : SKIP
60
+ description = hash.key?('description') ? hash['description'] : SKIP
61
+
62
+ # Create object from extracted values.
63
+ Row.new(id,
64
+ title,
65
+ description)
66
+ end
67
+ end
68
+ end