twilio-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 (42) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +155 -0
  4. data/bin/console +15 -0
  5. data/lib/twilio_accounts/api_helper.rb +10 -0
  6. data/lib/twilio_accounts/apis/accounts_v1_auth_token_promotion_api.rb +27 -0
  7. data/lib/twilio_accounts/apis/accounts_v1_aws_api.rb +137 -0
  8. data/lib/twilio_accounts/apis/accounts_v1_bulk_consents_api.rb +41 -0
  9. data/lib/twilio_accounts/apis/accounts_v1_bulk_contacts_api.rb +36 -0
  10. data/lib/twilio_accounts/apis/accounts_v1_messaging_geopermissions_api.rb +54 -0
  11. data/lib/twilio_accounts/apis/accounts_v1_public_key_api.rb +136 -0
  12. data/lib/twilio_accounts/apis/accounts_v1_safelist_api.rb +69 -0
  13. data/lib/twilio_accounts/apis/accounts_v1_secondary_auth_token_api.rb +39 -0
  14. data/lib/twilio_accounts/apis/base_api.rb +67 -0
  15. data/lib/twilio_accounts/client.rb +117 -0
  16. data/lib/twilio_accounts/configuration.rb +165 -0
  17. data/lib/twilio_accounts/exceptions/api_exception.rb +21 -0
  18. data/lib/twilio_accounts/http/api_response.rb +19 -0
  19. data/lib/twilio_accounts/http/auth/basic_auth.rb +62 -0
  20. data/lib/twilio_accounts/http/http_call_back.rb +10 -0
  21. data/lib/twilio_accounts/http/http_method_enum.rb +10 -0
  22. data/lib/twilio_accounts/http/http_request.rb +10 -0
  23. data/lib/twilio_accounts/http/http_response.rb +10 -0
  24. data/lib/twilio_accounts/http/proxy_settings.rb +22 -0
  25. data/lib/twilio_accounts/logging/configuration/api_logging_configuration.rb +186 -0
  26. data/lib/twilio_accounts/logging/sdk_logger.rb +17 -0
  27. data/lib/twilio_accounts/models/accounts_v1_auth_token_promotion.rb +142 -0
  28. data/lib/twilio_accounts/models/accounts_v1_bulk_consents.rb +83 -0
  29. data/lib/twilio_accounts/models/accounts_v1_bulk_contacts.rb +83 -0
  30. data/lib/twilio_accounts/models/accounts_v1_credential_credential_aws.rb +153 -0
  31. data/lib/twilio_accounts/models/accounts_v1_credential_credential_public_key.rb +153 -0
  32. data/lib/twilio_accounts/models/accounts_v1_messaging_geopermissions.rb +86 -0
  33. data/lib/twilio_accounts/models/accounts_v1_safelist.rb +88 -0
  34. data/lib/twilio_accounts/models/accounts_v1_secondary_auth_token.rb +145 -0
  35. data/lib/twilio_accounts/models/base_model.rb +110 -0
  36. data/lib/twilio_accounts/models/list_credential_aws_response.rb +94 -0
  37. data/lib/twilio_accounts/models/list_credential_public_key_response.rb +94 -0
  38. data/lib/twilio_accounts/models/meta.rb +140 -0
  39. data/lib/twilio_accounts/utilities/date_time_helper.rb +11 -0
  40. data/lib/twilio_accounts/utilities/file_wrapper.rb +28 -0
  41. data/lib/twilio_accounts.rb +64 -0
  42. metadata +125 -0
@@ -0,0 +1,186 @@
1
+ # twilio_accounts
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module TwilioAccounts
7
+ # Initializes a new instance of RequestLoggingConfiguration.
8
+ class RequestLoggingConfiguration < CoreLibrary::ApiRequestLoggingConfiguration
9
+ # @param log_body [Boolean] Indicates whether the message body should be logged. Default is false.
10
+ # @param log_headers [Boolean] Indicates whether the message headers should be logged. Default is false.
11
+ # @param headers_to_exclude [Array<String>] Array of headers not displayed in logging. Default is an empty array.
12
+ # @param headers_to_include [Array<String>] Array of headers to be displayed in logging. Default is an empty array.
13
+ # @param headers_to_unmask [Array<String>] Array of headers which values are non-sensitive to display in logging.
14
+ # Default is an empty array.
15
+ def initialize(log_body: false, log_headers: false, headers_to_include: nil,
16
+ headers_to_exclude: nil, headers_to_unmask: nil,
17
+ include_query_in_path: false)
18
+ super(
19
+ log_body,
20
+ log_headers,
21
+ headers_to_exclude,
22
+ headers_to_include,
23
+ headers_to_unmask,
24
+ include_query_in_path
25
+ )
26
+ end
27
+
28
+ def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
29
+ headers_to_exclude: nil, headers_to_unmask: nil, include_query_in_path: nil)
30
+ log_body ||= self.log_body
31
+ log_headers ||= self.log_headers
32
+ headers_to_include ||= self.headers_to_include
33
+ headers_to_exclude ||= self.headers_to_exclude
34
+ headers_to_unmask ||= self.headers_to_unmask
35
+ include_query_in_path ||= self.include_query_in_path
36
+
37
+ RequestLoggingConfiguration.new(
38
+ log_body: log_body,
39
+ log_headers: log_headers,
40
+ headers_to_include: headers_to_include,
41
+ headers_to_exclude: headers_to_exclude,
42
+ headers_to_unmask: headers_to_unmask,
43
+ include_query_in_path: include_query_in_path
44
+ )
45
+ end
46
+
47
+ def self.from_env
48
+ log_body = ENV['REQUEST_LOG_BODY']
49
+ log_headers = ENV['REQUEST_LOG_HEADERS']
50
+ headers_to_include = ENV['REQUEST_HEADERS_TO_INCLUDE']
51
+ headers_to_exclude = ENV['REQUEST_HEADERS_TO_EXCLUDE']
52
+ headers_to_unmask = ENV['REQUEST_HEADERS_TO_UNMASK']
53
+ include_query_in_path = ENV['REQUEST_INCLUDE_QUERY_IN_PATH']
54
+
55
+ new(
56
+ log_body: log_body,
57
+ log_headers: log_headers,
58
+ headers_to_include: headers_to_include,
59
+ headers_to_exclude: headers_to_exclude,
60
+ headers_to_unmask: headers_to_unmask,
61
+ include_query_in_path: include_query_in_path
62
+ )
63
+ end
64
+
65
+ def self.any_logging_configured?
66
+ %w[
67
+ REQUEST_LOG_BODY
68
+ REQUEST_LOG_HEADERS
69
+ REQUEST_HEADERS_TO_INCLUDE
70
+ REQUEST_HEADERS_TO_EXCLUDE
71
+ REQUEST_HEADERS_TO_UNMASK
72
+ REQUEST_INCLUDE_QUERY_IN_PATH
73
+ ].any? { |key| ENV.key?(key) && !ENV[key].nil? && !ENV[key].empty? }
74
+ end
75
+ end
76
+
77
+ # Initializes a new instance of ResponseLoggingConfiguration.
78
+ class ResponseLoggingConfiguration < CoreLibrary::ApiResponseLoggingConfiguration
79
+ def initialize(log_body: false, log_headers: false, headers_to_include: nil,
80
+ headers_to_exclude: nil, headers_to_unmask: nil)
81
+ super(
82
+ log_body,
83
+ log_headers,
84
+ headers_to_exclude,
85
+ headers_to_include,
86
+ headers_to_unmask
87
+ )
88
+ end
89
+
90
+ def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
91
+ headers_to_exclude: nil, headers_to_unmask: nil)
92
+ log_body ||= self.log_body
93
+ log_headers ||= self.log_headers
94
+ headers_to_include ||= self.headers_to_include
95
+ headers_to_exclude ||= self.headers_to_exclude
96
+ headers_to_unmask ||= self.headers_to_unmask
97
+
98
+ ResponseLoggingConfiguration.new(
99
+ log_body: log_body,
100
+ log_headers: log_headers,
101
+ headers_to_include: headers_to_include,
102
+ headers_to_exclude: headers_to_exclude,
103
+ headers_to_unmask: headers_to_unmask
104
+ )
105
+ end
106
+
107
+ def self.from_env
108
+ log_body = ENV['RESPONSE_LOG_BODY']
109
+ log_headers = ENV['RESPONSE_LOG_HEADERS']
110
+ headers_to_include = ENV['RESPONSE_HEADERS_TO_INCLUDE']
111
+ headers_to_exclude = ENV['RESPONSE_HEADERS_TO_EXCLUDE']
112
+ headers_to_unmask = ENV['RESPONSE_HEADERS_TO_UNMASK']
113
+
114
+ new(
115
+ log_body: log_body,
116
+ log_headers: log_headers,
117
+ headers_to_include: headers_to_include,
118
+ headers_to_exclude: headers_to_exclude,
119
+ headers_to_unmask: headers_to_unmask
120
+ )
121
+ end
122
+
123
+ def self.any_logging_configured?
124
+ %w[
125
+ RESPONSE_LOG_BODY
126
+ RESPONSE_LOG_HEADERS
127
+ RESPONSE_HEADERS_TO_INCLUDE
128
+ RESPONSE_HEADERS_TO_EXCLUDE
129
+ RESPONSE_HEADERS_TO_UNMASK
130
+ ].any? { |key| ENV.key?(key) && !ENV[key].nil? && !ENV[key].empty? }
131
+ end
132
+ end
133
+
134
+ # Initializes a new instance of LoggingConfiguration.
135
+ class LoggingConfiguration < CoreLibrary::ApiLoggingConfiguration
136
+ def initialize(logger: nil, log_level: nil, mask_sensitive_headers: true,
137
+ request_logging_config: nil,
138
+ response_logging_config: nil)
139
+ request_logging_config ||= RequestLoggingConfiguration.new
140
+ response_logging_config ||= ResponseLoggingConfiguration.new
141
+ super(
142
+ logger,
143
+ log_level,
144
+ request_logging_config,
145
+ response_logging_config,
146
+ mask_sensitive_headers
147
+ )
148
+ end
149
+
150
+ def clone_with(logger: nil, log_level: nil, mask_sensitive_headers: nil,
151
+ request_logging_config: nil, response_logging_config: nil)
152
+ logger ||= self.logger
153
+ log_level ||= self.log_level
154
+ mask_sensitive_headers ||= self.mask_sensitive_headers
155
+ request_logging_config ||= self.request_logging_config.clone
156
+ response_logging_config ||= self.response_logging_config.clone
157
+
158
+ LoggingConfiguration.new(
159
+ logger: logger,
160
+ log_level: log_level,
161
+ mask_sensitive_headers: mask_sensitive_headers,
162
+ request_logging_config: request_logging_config,
163
+ response_logging_config: response_logging_config
164
+ )
165
+ end
166
+
167
+ def self.from_env
168
+ log_level = ENV['LOG_LEVEL']
169
+ mask_sensitive_headers = ENV['MASK_SENSITIVE_HEADERS']
170
+
171
+ new(
172
+ log_level: log_level,
173
+ mask_sensitive_headers: mask_sensitive_headers,
174
+ request_logging_config: RequestLoggingConfiguration.from_env,
175
+ response_logging_config: ResponseLoggingConfiguration.from_env
176
+ )
177
+ end
178
+
179
+ def self.any_logging_configured?
180
+ RequestLoggingConfiguration.any_logging_configured? ||
181
+ ResponseLoggingConfiguration.any_logging_configured? ||
182
+ ENV.key?('LOG_LEVEL') ||
183
+ ENV.key?('MASK_SENSITIVE_HEADERS')
184
+ end
185
+ end
186
+ end
@@ -0,0 +1,17 @@
1
+ # twilio_accounts
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module TwilioAccounts
7
+ # Represents the generic logger facade
8
+ class AbstractLogger < Logger
9
+ # Logs a message with a specified log level and additional parameters.
10
+ # @param level [Symbol] The log level of the message.
11
+ # @param message [String] The message to log.
12
+ # @param params [Hash] Additional parameters to include in the log message.
13
+ def log(level, message, params)
14
+ raise NotImplementedError, 'This method needs to be implemented in a child class.'
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,142 @@
1
+ # twilio_accounts
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module TwilioAccounts
8
+ # AccountsV1AuthTokenPromotion Model.
9
+ class AccountsV1AuthTokenPromotion < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that
14
+ # the secondary Auth Token was created for.
15
+ # @return [String]
16
+ attr_accessor :account_sid
17
+
18
+ # The promoted Auth Token that must be used to authenticate future API
19
+ # requests.
20
+ # @return [String]
21
+ attr_accessor :auth_token
22
+
23
+ # The date and time in UTC when the resource was created specified in [ISO
24
+ # 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
25
+ # @return [DateTime]
26
+ attr_accessor :date_created
27
+
28
+ # The date and time in GMT when the resource was last updated specified in
29
+ # [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
30
+ # @return [DateTime]
31
+ attr_accessor :date_updated
32
+
33
+ # The URI for this resource, relative to `https://accounts.twilio.com`
34
+ # @return [String]
35
+ attr_accessor :url
36
+
37
+ # A mapping from model property names to API property names.
38
+ def self.names
39
+ @_hash = {} if @_hash.nil?
40
+ @_hash['account_sid'] = 'account_sid'
41
+ @_hash['auth_token'] = 'auth_token'
42
+ @_hash['date_created'] = 'date_created'
43
+ @_hash['date_updated'] = 'date_updated'
44
+ @_hash['url'] = 'url'
45
+ @_hash
46
+ end
47
+
48
+ # An array for optional fields
49
+ def self.optionals
50
+ %w[
51
+ account_sid
52
+ auth_token
53
+ date_created
54
+ date_updated
55
+ url
56
+ ]
57
+ end
58
+
59
+ # An array for nullable fields
60
+ def self.nullables
61
+ %w[
62
+ account_sid
63
+ auth_token
64
+ date_created
65
+ date_updated
66
+ url
67
+ ]
68
+ end
69
+
70
+ def initialize(account_sid: SKIP, auth_token: SKIP, date_created: SKIP,
71
+ date_updated: SKIP, url: SKIP, additional_properties: nil)
72
+ # Add additional model properties to the instance
73
+ additional_properties = {} if additional_properties.nil?
74
+
75
+ @account_sid = account_sid unless account_sid == SKIP
76
+ @auth_token = auth_token unless auth_token == SKIP
77
+ @date_created = date_created unless date_created == SKIP
78
+ @date_updated = date_updated unless date_updated == SKIP
79
+ @url = url unless url == SKIP
80
+ @additional_properties = additional_properties
81
+ end
82
+
83
+ # Creates an instance of the object from a hash.
84
+ def self.from_hash(hash)
85
+ return nil unless hash
86
+
87
+ # Extract variables from the hash.
88
+ account_sid = hash.key?('account_sid') ? hash['account_sid'] : SKIP
89
+ auth_token = hash.key?('auth_token') ? hash['auth_token'] : SKIP
90
+ date_created = if hash.key?('date_created')
91
+ (DateTimeHelper.from_rfc3339(hash['date_created']) if hash['date_created'])
92
+ else
93
+ SKIP
94
+ end
95
+ date_updated = if hash.key?('date_updated')
96
+ (DateTimeHelper.from_rfc3339(hash['date_updated']) if hash['date_updated'])
97
+ else
98
+ SKIP
99
+ end
100
+ url = hash.key?('url') ? hash['url'] : SKIP
101
+
102
+ # Create a new hash for additional properties, removing known properties.
103
+ new_hash = hash.reject { |k, _| names.value?(k) }
104
+
105
+ additional_properties = APIHelper.get_additional_properties(
106
+ new_hash, proc { |value| value }
107
+ )
108
+
109
+ # Create object from extracted values.
110
+ AccountsV1AuthTokenPromotion.new(account_sid: account_sid,
111
+ auth_token: auth_token,
112
+ date_created: date_created,
113
+ date_updated: date_updated,
114
+ url: url,
115
+ additional_properties: additional_properties)
116
+ end
117
+
118
+ def to_custom_date_created
119
+ DateTimeHelper.to_rfc3339(date_created)
120
+ end
121
+
122
+ def to_custom_date_updated
123
+ DateTimeHelper.to_rfc3339(date_updated)
124
+ end
125
+
126
+ # Provides a human-readable string representation of the object.
127
+ def to_s
128
+ class_name = self.class.name.split('::').last
129
+ "<#{class_name} account_sid: #{@account_sid}, auth_token: #{@auth_token}, date_created:"\
130
+ " #{@date_created}, date_updated: #{@date_updated}, url: #{@url}, additional_properties:"\
131
+ " #{@additional_properties}>"
132
+ end
133
+
134
+ # Provides a debugging-friendly string with detailed object information.
135
+ def inspect
136
+ class_name = self.class.name.split('::').last
137
+ "<#{class_name} account_sid: #{@account_sid.inspect}, auth_token: #{@auth_token.inspect},"\
138
+ " date_created: #{@date_created.inspect}, date_updated: #{@date_updated.inspect}, url:"\
139
+ " #{@url.inspect}, additional_properties: #{@additional_properties}>"
140
+ end
141
+ end
142
+ end
@@ -0,0 +1,83 @@
1
+ # twilio_accounts
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module TwilioAccounts
7
+ # AccountsV1BulkConsents Model.
8
+ class AccountsV1BulkConsents < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A list of objects where each object represents the result of processing a
13
+ # `correlation_id`. Each object contains the following fields:
14
+ # `correlation_id`, a unique 32-character UUID that maps the response to the
15
+ # original request; `error_code`, an integer where 0 indicates success and
16
+ # any non-zero value represents an error; and `error_messages`, an array of
17
+ # strings describing specific validation errors encountered. If the request
18
+ # is successful, the error_messages array will be empty.
19
+ # @return [Object]
20
+ attr_accessor :items
21
+
22
+ # A mapping from model property names to API property names.
23
+ def self.names
24
+ @_hash = {} if @_hash.nil?
25
+ @_hash['items'] = 'items'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ %w[
32
+ items
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ %w[
39
+ items
40
+ ]
41
+ end
42
+
43
+ def initialize(items: SKIP, additional_properties: nil)
44
+ # Add additional model properties to the instance
45
+ additional_properties = {} if additional_properties.nil?
46
+
47
+ @items = items unless items == SKIP
48
+ @additional_properties = additional_properties
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
+ items = hash.key?('items') ? hash['items'] : SKIP
57
+
58
+ # Create a new hash for additional properties, removing known properties.
59
+ new_hash = hash.reject { |k, _| names.value?(k) }
60
+
61
+ additional_properties = APIHelper.get_additional_properties(
62
+ new_hash, proc { |value| value }
63
+ )
64
+
65
+ # Create object from extracted values.
66
+ AccountsV1BulkConsents.new(items: items,
67
+ additional_properties: additional_properties)
68
+ end
69
+
70
+ # Provides a human-readable string representation of the object.
71
+ def to_s
72
+ class_name = self.class.name.split('::').last
73
+ "<#{class_name} items: #{@items}, additional_properties: #{@additional_properties}>"
74
+ end
75
+
76
+ # Provides a debugging-friendly string with detailed object information.
77
+ def inspect
78
+ class_name = self.class.name.split('::').last
79
+ "<#{class_name} items: #{@items.inspect}, additional_properties:"\
80
+ " #{@additional_properties}>"
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,83 @@
1
+ # twilio_accounts
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module TwilioAccounts
7
+ # AccountsV1BulkContacts Model.
8
+ class AccountsV1BulkContacts < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A list of objects where each object represents the result of processing a
13
+ # `correlation_id`. Each object contains the following fields:
14
+ # `correlation_id`, a unique 32-character UUID that maps the response to the
15
+ # original request; `error_code`, an integer where 0 indicates success and
16
+ # any non-zero value represents an error; and `error_messages`, an array of
17
+ # strings describing specific validation errors encountered. If the request
18
+ # is successful, the error_messages array will be empty.
19
+ # @return [Object]
20
+ attr_accessor :items
21
+
22
+ # A mapping from model property names to API property names.
23
+ def self.names
24
+ @_hash = {} if @_hash.nil?
25
+ @_hash['items'] = 'items'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ %w[
32
+ items
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ %w[
39
+ items
40
+ ]
41
+ end
42
+
43
+ def initialize(items: SKIP, additional_properties: nil)
44
+ # Add additional model properties to the instance
45
+ additional_properties = {} if additional_properties.nil?
46
+
47
+ @items = items unless items == SKIP
48
+ @additional_properties = additional_properties
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
+ items = hash.key?('items') ? hash['items'] : SKIP
57
+
58
+ # Create a new hash for additional properties, removing known properties.
59
+ new_hash = hash.reject { |k, _| names.value?(k) }
60
+
61
+ additional_properties = APIHelper.get_additional_properties(
62
+ new_hash, proc { |value| value }
63
+ )
64
+
65
+ # Create object from extracted values.
66
+ AccountsV1BulkContacts.new(items: items,
67
+ additional_properties: additional_properties)
68
+ end
69
+
70
+ # Provides a human-readable string representation of the object.
71
+ def to_s
72
+ class_name = self.class.name.split('::').last
73
+ "<#{class_name} items: #{@items}, additional_properties: #{@additional_properties}>"
74
+ end
75
+
76
+ # Provides a debugging-friendly string with detailed object information.
77
+ def inspect
78
+ class_name = self.class.name.split('::').last
79
+ "<#{class_name} items: #{@items.inspect}, additional_properties:"\
80
+ " #{@additional_properties}>"
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,153 @@
1
+ # twilio_accounts
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module TwilioAccounts
8
+ # AccountsV1CredentialCredentialAws Model.
9
+ class AccountsV1CredentialCredentialAws < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # The unique string that we created to identify the AWS resource.
14
+ # @return [String]
15
+ attr_accessor :sid
16
+
17
+ # The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that
18
+ # created the AWS resource.
19
+ # @return [String]
20
+ attr_accessor :account_sid
21
+
22
+ # The string that you assigned to describe the resource.
23
+ # @return [String]
24
+ attr_accessor :friendly_name
25
+
26
+ # The date and time in GMT when the resource was created specified in [RFC
27
+ # 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
28
+ # @return [DateTime]
29
+ attr_accessor :date_created
30
+
31
+ # The date and time in GMT when the resource was last updated specified in
32
+ # [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
33
+ # @return [DateTime]
34
+ attr_accessor :date_updated
35
+
36
+ # The URI for this resource, relative to `https://accounts.twilio.com`
37
+ # @return [String]
38
+ attr_accessor :url
39
+
40
+ # A mapping from model property names to API property names.
41
+ def self.names
42
+ @_hash = {} if @_hash.nil?
43
+ @_hash['sid'] = 'sid'
44
+ @_hash['account_sid'] = 'account_sid'
45
+ @_hash['friendly_name'] = 'friendly_name'
46
+ @_hash['date_created'] = 'date_created'
47
+ @_hash['date_updated'] = 'date_updated'
48
+ @_hash['url'] = 'url'
49
+ @_hash
50
+ end
51
+
52
+ # An array for optional fields
53
+ def self.optionals
54
+ %w[
55
+ sid
56
+ account_sid
57
+ friendly_name
58
+ date_created
59
+ date_updated
60
+ url
61
+ ]
62
+ end
63
+
64
+ # An array for nullable fields
65
+ def self.nullables
66
+ %w[
67
+ sid
68
+ account_sid
69
+ friendly_name
70
+ date_created
71
+ date_updated
72
+ url
73
+ ]
74
+ end
75
+
76
+ def initialize(sid: SKIP, account_sid: SKIP, friendly_name: SKIP,
77
+ date_created: SKIP, date_updated: SKIP, url: SKIP,
78
+ additional_properties: nil)
79
+ # Add additional model properties to the instance
80
+ additional_properties = {} if additional_properties.nil?
81
+
82
+ @sid = sid unless sid == SKIP
83
+ @account_sid = account_sid unless account_sid == SKIP
84
+ @friendly_name = friendly_name unless friendly_name == SKIP
85
+ @date_created = date_created unless date_created == SKIP
86
+ @date_updated = date_updated unless date_updated == SKIP
87
+ @url = url unless url == SKIP
88
+ @additional_properties = additional_properties
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
+ sid = hash.key?('sid') ? hash['sid'] : SKIP
97
+ account_sid = hash.key?('account_sid') ? hash['account_sid'] : SKIP
98
+ friendly_name = hash.key?('friendly_name') ? hash['friendly_name'] : SKIP
99
+ date_created = if hash.key?('date_created')
100
+ (DateTimeHelper.from_rfc3339(hash['date_created']) if hash['date_created'])
101
+ else
102
+ SKIP
103
+ end
104
+ date_updated = if hash.key?('date_updated')
105
+ (DateTimeHelper.from_rfc3339(hash['date_updated']) if hash['date_updated'])
106
+ else
107
+ SKIP
108
+ end
109
+ url = hash.key?('url') ? hash['url'] : SKIP
110
+
111
+ # Create a new hash for additional properties, removing known properties.
112
+ new_hash = hash.reject { |k, _| names.value?(k) }
113
+
114
+ additional_properties = APIHelper.get_additional_properties(
115
+ new_hash, proc { |value| value }
116
+ )
117
+
118
+ # Create object from extracted values.
119
+ AccountsV1CredentialCredentialAws.new(sid: sid,
120
+ account_sid: account_sid,
121
+ friendly_name: friendly_name,
122
+ date_created: date_created,
123
+ date_updated: date_updated,
124
+ url: url,
125
+ additional_properties: additional_properties)
126
+ end
127
+
128
+ def to_custom_date_created
129
+ DateTimeHelper.to_rfc3339(date_created)
130
+ end
131
+
132
+ def to_custom_date_updated
133
+ DateTimeHelper.to_rfc3339(date_updated)
134
+ end
135
+
136
+ # Provides a human-readable string representation of the object.
137
+ def to_s
138
+ class_name = self.class.name.split('::').last
139
+ "<#{class_name} sid: #{@sid}, account_sid: #{@account_sid}, friendly_name:"\
140
+ " #{@friendly_name}, date_created: #{@date_created}, date_updated: #{@date_updated}, url:"\
141
+ " #{@url}, additional_properties: #{@additional_properties}>"
142
+ end
143
+
144
+ # Provides a debugging-friendly string with detailed object information.
145
+ def inspect
146
+ class_name = self.class.name.split('::').last
147
+ "<#{class_name} sid: #{@sid.inspect}, account_sid: #{@account_sid.inspect}, friendly_name:"\
148
+ " #{@friendly_name.inspect}, date_created: #{@date_created.inspect}, date_updated:"\
149
+ " #{@date_updated.inspect}, url: #{@url.inspect}, additional_properties:"\
150
+ " #{@additional_properties}>"
151
+ end
152
+ end
153
+ end