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.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +155 -0
- data/bin/console +15 -0
- data/lib/twilio_accounts/api_helper.rb +10 -0
- data/lib/twilio_accounts/apis/accounts_v1_auth_token_promotion_api.rb +27 -0
- data/lib/twilio_accounts/apis/accounts_v1_aws_api.rb +137 -0
- data/lib/twilio_accounts/apis/accounts_v1_bulk_consents_api.rb +41 -0
- data/lib/twilio_accounts/apis/accounts_v1_bulk_contacts_api.rb +36 -0
- data/lib/twilio_accounts/apis/accounts_v1_messaging_geopermissions_api.rb +54 -0
- data/lib/twilio_accounts/apis/accounts_v1_public_key_api.rb +136 -0
- data/lib/twilio_accounts/apis/accounts_v1_safelist_api.rb +69 -0
- data/lib/twilio_accounts/apis/accounts_v1_secondary_auth_token_api.rb +39 -0
- data/lib/twilio_accounts/apis/base_api.rb +67 -0
- data/lib/twilio_accounts/client.rb +117 -0
- data/lib/twilio_accounts/configuration.rb +165 -0
- data/lib/twilio_accounts/exceptions/api_exception.rb +21 -0
- data/lib/twilio_accounts/http/api_response.rb +19 -0
- data/lib/twilio_accounts/http/auth/basic_auth.rb +62 -0
- data/lib/twilio_accounts/http/http_call_back.rb +10 -0
- data/lib/twilio_accounts/http/http_method_enum.rb +10 -0
- data/lib/twilio_accounts/http/http_request.rb +10 -0
- data/lib/twilio_accounts/http/http_response.rb +10 -0
- data/lib/twilio_accounts/http/proxy_settings.rb +22 -0
- data/lib/twilio_accounts/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/twilio_accounts/logging/sdk_logger.rb +17 -0
- data/lib/twilio_accounts/models/accounts_v1_auth_token_promotion.rb +142 -0
- data/lib/twilio_accounts/models/accounts_v1_bulk_consents.rb +83 -0
- data/lib/twilio_accounts/models/accounts_v1_bulk_contacts.rb +83 -0
- data/lib/twilio_accounts/models/accounts_v1_credential_credential_aws.rb +153 -0
- data/lib/twilio_accounts/models/accounts_v1_credential_credential_public_key.rb +153 -0
- data/lib/twilio_accounts/models/accounts_v1_messaging_geopermissions.rb +86 -0
- data/lib/twilio_accounts/models/accounts_v1_safelist.rb +88 -0
- data/lib/twilio_accounts/models/accounts_v1_secondary_auth_token.rb +145 -0
- data/lib/twilio_accounts/models/base_model.rb +110 -0
- data/lib/twilio_accounts/models/list_credential_aws_response.rb +94 -0
- data/lib/twilio_accounts/models/list_credential_public_key_response.rb +94 -0
- data/lib/twilio_accounts/models/meta.rb +140 -0
- data/lib/twilio_accounts/utilities/date_time_helper.rb +11 -0
- data/lib/twilio_accounts/utilities/file_wrapper.rb +28 -0
- data/lib/twilio_accounts.rb +64 -0
- metadata +125 -0
|
@@ -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
|
+
# AccountsV1CredentialCredentialPublicKey Model.
|
|
9
|
+
class AccountsV1CredentialCredentialPublicKey < BaseModel
|
|
10
|
+
SKIP = Object.new
|
|
11
|
+
private_constant :SKIP
|
|
12
|
+
|
|
13
|
+
# The unique string that that we created to identify the PublicKey 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 Credential that the PublicKey resource belongs to.
|
|
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
|
+
AccountsV1CredentialCredentialPublicKey.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
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# twilio_accounts
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module TwilioAccounts
|
|
7
|
+
# AccountsV1MessagingGeopermissions Model.
|
|
8
|
+
class AccountsV1MessagingGeopermissions < 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
|
+
# messaging Geo Permission. Each object contains the following fields:
|
|
14
|
+
# `country_code`, the country code of the country for which the permission
|
|
15
|
+
# was updated; `type`, the type of the permission i.e. country; `enabled`,
|
|
16
|
+
# true if the permission is enabled else false; `error_code`, an integer
|
|
17
|
+
# where 0 indicates success and any non-zero value represents an error; and
|
|
18
|
+
# `error_messages`, an array of strings describing specific validation
|
|
19
|
+
# errors encountered. If the request is successful, the error_messages array
|
|
20
|
+
# will be empty.
|
|
21
|
+
# @return [Object]
|
|
22
|
+
attr_accessor :permissions
|
|
23
|
+
|
|
24
|
+
# A mapping from model property names to API property names.
|
|
25
|
+
def self.names
|
|
26
|
+
@_hash = {} if @_hash.nil?
|
|
27
|
+
@_hash['permissions'] = 'permissions'
|
|
28
|
+
@_hash
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# An array for optional fields
|
|
32
|
+
def self.optionals
|
|
33
|
+
%w[
|
|
34
|
+
permissions
|
|
35
|
+
]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# An array for nullable fields
|
|
39
|
+
def self.nullables
|
|
40
|
+
%w[
|
|
41
|
+
permissions
|
|
42
|
+
]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def initialize(permissions: SKIP, additional_properties: nil)
|
|
46
|
+
# Add additional model properties to the instance
|
|
47
|
+
additional_properties = {} if additional_properties.nil?
|
|
48
|
+
|
|
49
|
+
@permissions = permissions unless permissions == SKIP
|
|
50
|
+
@additional_properties = additional_properties
|
|
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
|
+
permissions = hash.key?('permissions') ? hash['permissions'] : SKIP
|
|
59
|
+
|
|
60
|
+
# Create a new hash for additional properties, removing known properties.
|
|
61
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
62
|
+
|
|
63
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
64
|
+
new_hash, proc { |value| value }
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Create object from extracted values.
|
|
68
|
+
AccountsV1MessagingGeopermissions.new(permissions: permissions,
|
|
69
|
+
additional_properties: additional_properties)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Provides a human-readable string representation of the object.
|
|
73
|
+
def to_s
|
|
74
|
+
class_name = self.class.name.split('::').last
|
|
75
|
+
"<#{class_name} permissions: #{@permissions}, additional_properties:"\
|
|
76
|
+
" #{@additional_properties}>"
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
80
|
+
def inspect
|
|
81
|
+
class_name = self.class.name.split('::').last
|
|
82
|
+
"<#{class_name} permissions: #{@permissions.inspect}, additional_properties:"\
|
|
83
|
+
" #{@additional_properties}>"
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# twilio_accounts
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module TwilioAccounts
|
|
7
|
+
# AccountsV1Safelist Model.
|
|
8
|
+
class AccountsV1Safelist < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The unique string that we created to identify the SafeList resource.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :sid
|
|
15
|
+
|
|
16
|
+
# The phone number or phone number 1k prefix in SafeList.
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :phone_number
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['sid'] = 'sid'
|
|
24
|
+
@_hash['phone_number'] = 'phone_number'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
%w[
|
|
31
|
+
sid
|
|
32
|
+
phone_number
|
|
33
|
+
]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# An array for nullable fields
|
|
37
|
+
def self.nullables
|
|
38
|
+
%w[
|
|
39
|
+
sid
|
|
40
|
+
phone_number
|
|
41
|
+
]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def initialize(sid: SKIP, phone_number: SKIP, additional_properties: nil)
|
|
45
|
+
# Add additional model properties to the instance
|
|
46
|
+
additional_properties = {} if additional_properties.nil?
|
|
47
|
+
|
|
48
|
+
@sid = sid unless sid == SKIP
|
|
49
|
+
@phone_number = phone_number unless phone_number == SKIP
|
|
50
|
+
@additional_properties = additional_properties
|
|
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
|
+
sid = hash.key?('sid') ? hash['sid'] : SKIP
|
|
59
|
+
phone_number = hash.key?('phone_number') ? hash['phone_number'] : SKIP
|
|
60
|
+
|
|
61
|
+
# Create a new hash for additional properties, removing known properties.
|
|
62
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
63
|
+
|
|
64
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
65
|
+
new_hash, proc { |value| value }
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
# Create object from extracted values.
|
|
69
|
+
AccountsV1Safelist.new(sid: sid,
|
|
70
|
+
phone_number: phone_number,
|
|
71
|
+
additional_properties: additional_properties)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Provides a human-readable string representation of the object.
|
|
75
|
+
def to_s
|
|
76
|
+
class_name = self.class.name.split('::').last
|
|
77
|
+
"<#{class_name} sid: #{@sid}, phone_number: #{@phone_number}, additional_properties:"\
|
|
78
|
+
" #{@additional_properties}>"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
82
|
+
def inspect
|
|
83
|
+
class_name = self.class.name.split('::').last
|
|
84
|
+
"<#{class_name} sid: #{@sid.inspect}, phone_number: #{@phone_number.inspect},"\
|
|
85
|
+
" additional_properties: #{@additional_properties}>"
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -0,0 +1,145 @@
|
|
|
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
|
+
# AccountsV1SecondaryAuthToken Model.
|
|
9
|
+
class AccountsV1SecondaryAuthToken < 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 date and time in UTC when the resource was created specified in [ISO
|
|
19
|
+
# 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
|
20
|
+
# @return [DateTime]
|
|
21
|
+
attr_accessor :date_created
|
|
22
|
+
|
|
23
|
+
# The date and time in UTC when the resource was last updated specified in
|
|
24
|
+
# [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
|
25
|
+
# @return [DateTime]
|
|
26
|
+
attr_accessor :date_updated
|
|
27
|
+
|
|
28
|
+
# The generated secondary Auth Token that can be used to authenticate future
|
|
29
|
+
# API requests.
|
|
30
|
+
# @return [String]
|
|
31
|
+
attr_accessor :secondary_auth_token
|
|
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['date_created'] = 'date_created'
|
|
42
|
+
@_hash['date_updated'] = 'date_updated'
|
|
43
|
+
@_hash['secondary_auth_token'] = 'secondary_auth_token'
|
|
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
|
+
date_created
|
|
53
|
+
date_updated
|
|
54
|
+
secondary_auth_token
|
|
55
|
+
url
|
|
56
|
+
]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# An array for nullable fields
|
|
60
|
+
def self.nullables
|
|
61
|
+
%w[
|
|
62
|
+
account_sid
|
|
63
|
+
date_created
|
|
64
|
+
date_updated
|
|
65
|
+
secondary_auth_token
|
|
66
|
+
url
|
|
67
|
+
]
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def initialize(account_sid: SKIP, date_created: SKIP, date_updated: SKIP,
|
|
71
|
+
secondary_auth_token: SKIP, url: SKIP,
|
|
72
|
+
additional_properties: nil)
|
|
73
|
+
# Add additional model properties to the instance
|
|
74
|
+
additional_properties = {} if additional_properties.nil?
|
|
75
|
+
|
|
76
|
+
@account_sid = account_sid unless account_sid == SKIP
|
|
77
|
+
@date_created = date_created unless date_created == SKIP
|
|
78
|
+
@date_updated = date_updated unless date_updated == SKIP
|
|
79
|
+
@secondary_auth_token = secondary_auth_token unless secondary_auth_token == SKIP
|
|
80
|
+
@url = url unless url == SKIP
|
|
81
|
+
@additional_properties = additional_properties
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Creates an instance of the object from a hash.
|
|
85
|
+
def self.from_hash(hash)
|
|
86
|
+
return nil unless hash
|
|
87
|
+
|
|
88
|
+
# Extract variables from the hash.
|
|
89
|
+
account_sid = hash.key?('account_sid') ? hash['account_sid'] : 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
|
+
secondary_auth_token =
|
|
101
|
+
hash.key?('secondary_auth_token') ? hash['secondary_auth_token'] : SKIP
|
|
102
|
+
url = hash.key?('url') ? hash['url'] : SKIP
|
|
103
|
+
|
|
104
|
+
# Create a new hash for additional properties, removing known properties.
|
|
105
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
106
|
+
|
|
107
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
108
|
+
new_hash, proc { |value| value }
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
# Create object from extracted values.
|
|
112
|
+
AccountsV1SecondaryAuthToken.new(account_sid: account_sid,
|
|
113
|
+
date_created: date_created,
|
|
114
|
+
date_updated: date_updated,
|
|
115
|
+
secondary_auth_token: secondary_auth_token,
|
|
116
|
+
url: url,
|
|
117
|
+
additional_properties: additional_properties)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def to_custom_date_created
|
|
121
|
+
DateTimeHelper.to_rfc3339(date_created)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def to_custom_date_updated
|
|
125
|
+
DateTimeHelper.to_rfc3339(date_updated)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Provides a human-readable string representation of the object.
|
|
129
|
+
def to_s
|
|
130
|
+
class_name = self.class.name.split('::').last
|
|
131
|
+
"<#{class_name} account_sid: #{@account_sid}, date_created: #{@date_created}, date_updated:"\
|
|
132
|
+
" #{@date_updated}, secondary_auth_token: #{@secondary_auth_token}, url: #{@url},"\
|
|
133
|
+
" additional_properties: #{@additional_properties}>"
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
137
|
+
def inspect
|
|
138
|
+
class_name = self.class.name.split('::').last
|
|
139
|
+
"<#{class_name} account_sid: #{@account_sid.inspect}, date_created:"\
|
|
140
|
+
" #{@date_created.inspect}, date_updated: #{@date_updated.inspect}, secondary_auth_token:"\
|
|
141
|
+
" #{@secondary_auth_token.inspect}, url: #{@url.inspect}, additional_properties:"\
|
|
142
|
+
" #{@additional_properties}>"
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# twilio_accounts
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module TwilioAccounts
|
|
7
|
+
# Base model.
|
|
8
|
+
# rubocop:disable all
|
|
9
|
+
class BaseModel < CoreLibrary::BaseModel
|
|
10
|
+
# Returns a Hash representation of the current object.
|
|
11
|
+
def to_hash
|
|
12
|
+
# validating the model being serialized
|
|
13
|
+
self.class.validate(self) if self.class.respond_to?(:validate)
|
|
14
|
+
|
|
15
|
+
hash = {}
|
|
16
|
+
instance_variables.each do |name|
|
|
17
|
+
value = instance_variable_get(name)
|
|
18
|
+
name = name[1..]
|
|
19
|
+
if name == 'additional_properties'
|
|
20
|
+
additional_properties = process_additional_properties(value, self.class.names)
|
|
21
|
+
hash.merge!(additional_properties)
|
|
22
|
+
else
|
|
23
|
+
key = self.class.names.key?(name) ? self.class.names[name] : name
|
|
24
|
+
optional_fields = self.class.optionals
|
|
25
|
+
nullable_fields = self.class.nullables
|
|
26
|
+
if value.nil?
|
|
27
|
+
next unless nullable_fields.include?(name)
|
|
28
|
+
|
|
29
|
+
if !optional_fields.include?(name) && !nullable_fields.include?(name)
|
|
30
|
+
raise ArgumentError,
|
|
31
|
+
"`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
hash[key] = nil
|
|
36
|
+
unless value.nil?
|
|
37
|
+
if respond_to?("to_custom_#{name}")
|
|
38
|
+
if (value.instance_of? Array) || (value.instance_of? Hash)
|
|
39
|
+
params = [hash, key]
|
|
40
|
+
hash[key] = send("to_custom_#{name}", *params)
|
|
41
|
+
else
|
|
42
|
+
hash[key] = send("to_custom_#{name}")
|
|
43
|
+
end
|
|
44
|
+
elsif respond_to?("to_union_type_#{name}")
|
|
45
|
+
hash[key] = send("to_union_type_#{name}")
|
|
46
|
+
elsif value.instance_of? Array
|
|
47
|
+
hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
|
48
|
+
elsif value.instance_of? Hash
|
|
49
|
+
hash[key] = {}
|
|
50
|
+
value.each do |k, v|
|
|
51
|
+
hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
|
|
52
|
+
end
|
|
53
|
+
else
|
|
54
|
+
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
hash
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Processes additional properties, ensuring no conflicts with existing properties.
|
|
63
|
+
def process_additional_properties(additional_properties, existing_prop_names)
|
|
64
|
+
hash = {}
|
|
65
|
+
additional_properties.each do |name, value|
|
|
66
|
+
check_for_conflict(name, existing_prop_names)
|
|
67
|
+
|
|
68
|
+
hash[name] = if value.is_a?(Array)
|
|
69
|
+
process_array(value)
|
|
70
|
+
elsif value.is_a?(Hash)
|
|
71
|
+
process_hash(value)
|
|
72
|
+
else
|
|
73
|
+
process_basic_value(value)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
hash
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Checks if an additional property conflicts with a model's existing property.
|
|
80
|
+
def check_for_conflict(name, existing_prop_names)
|
|
81
|
+
return unless existing_prop_names.key?(name)
|
|
82
|
+
|
|
83
|
+
raise ArgumentError, "An additional property key, '#{name}' conflicts with one of the model's properties"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Processes an array of values, recursively calling `to_hash` on BaseModel objects.
|
|
87
|
+
def process_array(value)
|
|
88
|
+
value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Processes a hash of values, recursively calling `to_hash` on BaseModel objects.
|
|
92
|
+
def process_hash(value)
|
|
93
|
+
value.transform_values do |v|
|
|
94
|
+
v.is_a?(BaseModel) ? v.to_hash : v
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Processes a basic value (non-array, non-hash).
|
|
99
|
+
def process_basic_value(value)
|
|
100
|
+
value.is_a?(BaseModel) ? value.to_hash : value
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Returns a JSON representation of the curent object.
|
|
104
|
+
def to_json(options = {})
|
|
105
|
+
hash = to_hash
|
|
106
|
+
hash.to_json(options)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
# rubocop:enable all
|
|
110
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# twilio_accounts
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module TwilioAccounts
|
|
7
|
+
# ListCredentialAwsResponse Model.
|
|
8
|
+
class ListCredentialAwsResponse < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [Array[AccountsV1CredentialCredentialAws]]
|
|
14
|
+
attr_accessor :credentials
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [Meta]
|
|
18
|
+
attr_accessor :meta
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['credentials'] = 'credentials'
|
|
24
|
+
@_hash['meta'] = 'meta'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
%w[
|
|
31
|
+
credentials
|
|
32
|
+
meta
|
|
33
|
+
]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# An array for nullable fields
|
|
37
|
+
def self.nullables
|
|
38
|
+
[]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def initialize(credentials: SKIP, meta: SKIP, additional_properties: nil)
|
|
42
|
+
# Add additional model properties to the instance
|
|
43
|
+
additional_properties = {} if additional_properties.nil?
|
|
44
|
+
|
|
45
|
+
@credentials = credentials unless credentials == SKIP
|
|
46
|
+
@meta = meta unless meta == SKIP
|
|
47
|
+
@additional_properties = additional_properties
|
|
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
|
+
# Parameter is an array, so we need to iterate through it
|
|
56
|
+
credentials = nil
|
|
57
|
+
unless hash['credentials'].nil?
|
|
58
|
+
credentials = []
|
|
59
|
+
hash['credentials'].each do |structure|
|
|
60
|
+
credentials << (AccountsV1CredentialCredentialAws.from_hash(structure) if structure)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
credentials = SKIP unless hash.key?('credentials')
|
|
65
|
+
meta = Meta.from_hash(hash['meta']) if hash['meta']
|
|
66
|
+
|
|
67
|
+
# Create a new hash for additional properties, removing known properties.
|
|
68
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
69
|
+
|
|
70
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
71
|
+
new_hash, proc { |value| value }
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# Create object from extracted values.
|
|
75
|
+
ListCredentialAwsResponse.new(credentials: credentials,
|
|
76
|
+
meta: meta,
|
|
77
|
+
additional_properties: additional_properties)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Provides a human-readable string representation of the object.
|
|
81
|
+
def to_s
|
|
82
|
+
class_name = self.class.name.split('::').last
|
|
83
|
+
"<#{class_name} credentials: #{@credentials}, meta: #{@meta}, additional_properties:"\
|
|
84
|
+
" #{@additional_properties}>"
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
88
|
+
def inspect
|
|
89
|
+
class_name = self.class.name.split('::').last
|
|
90
|
+
"<#{class_name} credentials: #{@credentials.inspect}, meta: #{@meta.inspect},"\
|
|
91
|
+
" additional_properties: #{@additional_properties}>"
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|