twilio-ruby 7.8.6 → 7.8.8
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 +4 -4
- data/CHANGES.md +23 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/base/client_base.rb +28 -1
- data/lib/twilio-ruby/rest/content/v1/content.rb +677 -1
- data/lib/twilio-ruby/rest/iam/v1/o_auth_app.rb +462 -0
- data/lib/twilio-ruby/rest/iam/v1.rb +15 -0
- data/lib/twilio-ruby/rest/messaging/v1/domain_validate_dn.rb +208 -0
- data/lib/twilio-ruby/rest/messaging/v1.rb +15 -0
- data/lib/twilio-ruby/rest/numbers/v2/application.rb +378 -0
- data/lib/twilio-ruby/rest/numbers/v2.rb +15 -0
- data/lib/twilio-ruby/rest/oauth/v2/token.rb +6 -1
- data/lib/twilio-ruby/rest/trusthub/v1/compliance_tollfree_inquiries.rb +3 -0
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +5 -2
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
6
|
+
#
|
|
7
|
+
# Twilio - Messaging
|
|
8
|
+
# This is the public Twilio REST API.
|
|
9
|
+
#
|
|
10
|
+
# NOTE: This class is auto generated by OpenAPI Generator.
|
|
11
|
+
# https://openapi-generator.tech
|
|
12
|
+
# Do not edit the class manually.
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
module Twilio
|
|
17
|
+
module REST
|
|
18
|
+
class Messaging < MessagingBase
|
|
19
|
+
class V1 < Version
|
|
20
|
+
class DomainValidateDnList < ListResource
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
# Initialize the DomainValidateDnList
|
|
24
|
+
# @param [Version] version Version that contains the resource
|
|
25
|
+
# @return [DomainValidateDnList] DomainValidateDnList
|
|
26
|
+
def initialize(version)
|
|
27
|
+
super(version)
|
|
28
|
+
# Path Solution
|
|
29
|
+
@solution = { }
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# Provide a user friendly representation
|
|
37
|
+
def to_s
|
|
38
|
+
'#<Twilio.Messaging.V1.DomainValidateDnList>'
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class DomainValidateDnContext < InstanceContext
|
|
44
|
+
##
|
|
45
|
+
# Initialize the DomainValidateDnContext
|
|
46
|
+
# @param [Version] version Version that contains the resource
|
|
47
|
+
# @param [String] domain_sid Unique string used to identify the domain.
|
|
48
|
+
# @return [DomainValidateDnContext] DomainValidateDnContext
|
|
49
|
+
def initialize(version, domain_sid)
|
|
50
|
+
super(version)
|
|
51
|
+
|
|
52
|
+
# Path Solution
|
|
53
|
+
@solution = { domain_sid: domain_sid, }
|
|
54
|
+
@uri = "/LinkShortening/Domains/#{@solution[:domain_sid]}/ValidateDns"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
##
|
|
59
|
+
# Fetch the DomainValidateDnInstance
|
|
60
|
+
# @return [DomainValidateDnInstance] Fetched DomainValidateDnInstance
|
|
61
|
+
def fetch
|
|
62
|
+
|
|
63
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
payload = @version.fetch('GET', @uri, headers: headers)
|
|
70
|
+
DomainValidateDnInstance.new(
|
|
71
|
+
@version,
|
|
72
|
+
payload,
|
|
73
|
+
domain_sid: @solution[:domain_sid],
|
|
74
|
+
)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
##
|
|
79
|
+
# Provide a user friendly representation
|
|
80
|
+
def to_s
|
|
81
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
82
|
+
"#<Twilio.Messaging.V1.DomainValidateDnContext #{context}>"
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
##
|
|
86
|
+
# Provide a detailed, user friendly representation
|
|
87
|
+
def inspect
|
|
88
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
89
|
+
"#<Twilio.Messaging.V1.DomainValidateDnContext #{context}>"
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
class DomainValidateDnPage < Page
|
|
94
|
+
##
|
|
95
|
+
# Initialize the DomainValidateDnPage
|
|
96
|
+
# @param [Version] version Version that contains the resource
|
|
97
|
+
# @param [Response] response Response from the API
|
|
98
|
+
# @param [Hash] solution Path solution for the resource
|
|
99
|
+
# @return [DomainValidateDnPage] DomainValidateDnPage
|
|
100
|
+
def initialize(version, response, solution)
|
|
101
|
+
super(version, response)
|
|
102
|
+
|
|
103
|
+
# Path Solution
|
|
104
|
+
@solution = solution
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
##
|
|
108
|
+
# Build an instance of DomainValidateDnInstance
|
|
109
|
+
# @param [Hash] payload Payload response from the API
|
|
110
|
+
# @return [DomainValidateDnInstance] DomainValidateDnInstance
|
|
111
|
+
def get_instance(payload)
|
|
112
|
+
DomainValidateDnInstance.new(@version, payload)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
##
|
|
116
|
+
# Provide a user friendly representation
|
|
117
|
+
def to_s
|
|
118
|
+
'<Twilio.Messaging.V1.DomainValidateDnPage>'
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
class DomainValidateDnInstance < InstanceResource
|
|
122
|
+
##
|
|
123
|
+
# Initialize the DomainValidateDnInstance
|
|
124
|
+
# @param [Version] version Version that contains the resource
|
|
125
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
126
|
+
# @param [String] account_sid The SID of the
|
|
127
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this DomainValidateDn
|
|
128
|
+
# resource.
|
|
129
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
|
130
|
+
# @return [DomainValidateDnInstance] DomainValidateDnInstance
|
|
131
|
+
def initialize(version, payload , domain_sid: nil)
|
|
132
|
+
super(version)
|
|
133
|
+
|
|
134
|
+
# Marshaled Properties
|
|
135
|
+
@properties = {
|
|
136
|
+
'domain_sid' => payload['domain_sid'],
|
|
137
|
+
'is_valid' => payload['is_valid'],
|
|
138
|
+
'reason' => payload['reason'],
|
|
139
|
+
'url' => payload['url'],
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
# Context
|
|
143
|
+
@instance_context = nil
|
|
144
|
+
@params = { 'domain_sid' => domain_sid || @properties['domain_sid'] , }
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
##
|
|
148
|
+
# Generate an instance context for the instance, the context is capable of
|
|
149
|
+
# performing various actions. All instance actions are proxied to the context
|
|
150
|
+
# @return [DomainValidateDnContext] CallContext for this CallInstance
|
|
151
|
+
def context
|
|
152
|
+
unless @instance_context
|
|
153
|
+
@instance_context = DomainValidateDnContext.new(@version , @params['domain_sid'])
|
|
154
|
+
end
|
|
155
|
+
@instance_context
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
##
|
|
159
|
+
# @return [String] The unique string that we created to identify the Domain resource.
|
|
160
|
+
def domain_sid
|
|
161
|
+
@properties['domain_sid']
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
##
|
|
165
|
+
# @return [Boolean]
|
|
166
|
+
def is_valid
|
|
167
|
+
@properties['is_valid']
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
##
|
|
171
|
+
# @return [String]
|
|
172
|
+
def reason
|
|
173
|
+
@properties['reason']
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
##
|
|
177
|
+
# @return [String]
|
|
178
|
+
def url
|
|
179
|
+
@properties['url']
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
##
|
|
183
|
+
# Fetch the DomainValidateDnInstance
|
|
184
|
+
# @return [DomainValidateDnInstance] Fetched DomainValidateDnInstance
|
|
185
|
+
def fetch
|
|
186
|
+
|
|
187
|
+
context.fetch
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
##
|
|
191
|
+
# Provide a user friendly representation
|
|
192
|
+
def to_s
|
|
193
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
194
|
+
"<Twilio.Messaging.V1.DomainValidateDnInstance #{values}>"
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
##
|
|
198
|
+
# Provide a detailed, user friendly representation
|
|
199
|
+
def inspect
|
|
200
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
201
|
+
"<Twilio.Messaging.V1.DomainValidateDnInstance #{values}>"
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
end
|
|
@@ -26,6 +26,7 @@ module Twilio
|
|
|
26
26
|
@domain_certs = nil
|
|
27
27
|
@domain_config = nil
|
|
28
28
|
@domain_config_messaging_service = nil
|
|
29
|
+
@domain_validate_dns = nil
|
|
29
30
|
@external_campaign = nil
|
|
30
31
|
@linkshortening_messaging_service = nil
|
|
31
32
|
@linkshortening_messaging_service_domain_association = nil
|
|
@@ -97,6 +98,20 @@ module Twilio
|
|
|
97
98
|
end
|
|
98
99
|
end
|
|
99
100
|
##
|
|
101
|
+
# @param [String] domain_sid Unique string used to identify the domain.
|
|
102
|
+
# @return [Twilio::REST::Messaging::V1::DomainValidateDnContext] if domainSid was passed.
|
|
103
|
+
# @return [Twilio::REST::Messaging::V1::DomainValidateDnList]
|
|
104
|
+
def domain_validate_dns(domain_sid=:unset)
|
|
105
|
+
if domain_sid.nil?
|
|
106
|
+
raise ArgumentError, 'domain_sid cannot be nil'
|
|
107
|
+
end
|
|
108
|
+
if domain_sid == :unset
|
|
109
|
+
@domain_validate_dns ||= DomainValidateDnList.new self
|
|
110
|
+
else
|
|
111
|
+
DomainValidateDnContext.new(self, domain_sid)
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
##
|
|
100
115
|
# @return [Twilio::REST::Messaging::V1::ExternalCampaignList]
|
|
101
116
|
def external_campaign
|
|
102
117
|
@external_campaign ||= ExternalCampaignList.new self
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
6
|
+
#
|
|
7
|
+
# Twilio - Numbers
|
|
8
|
+
# This is the public Twilio REST API.
|
|
9
|
+
#
|
|
10
|
+
# NOTE: This class is auto generated by OpenAPI Generator.
|
|
11
|
+
# https://openapi-generator.tech
|
|
12
|
+
# Do not edit the class manually.
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
module Twilio
|
|
17
|
+
module REST
|
|
18
|
+
class Numbers < NumbersBase
|
|
19
|
+
class V2 < Version
|
|
20
|
+
class ApplicationList < ListResource
|
|
21
|
+
|
|
22
|
+
class CreateShortCodeApplicationRequest
|
|
23
|
+
# @param [friendly_name]: [String] The friendly name for the short code application.
|
|
24
|
+
# @param [iso_country]: [String] The ISO country code.
|
|
25
|
+
# @param [business_information]: [ApplicationList.CreateShortCodeApplicationRequestBusinessInformation]
|
|
26
|
+
# @param [setup]: [ApplicationList.CreateShortCodeApplicationRequestSetup]
|
|
27
|
+
attr_accessor :friendly_name, :iso_country, :business_information, :setup
|
|
28
|
+
def initialize(payload)
|
|
29
|
+
@friendly_name = payload["friendly_name"]
|
|
30
|
+
@iso_country = payload["iso_country"]
|
|
31
|
+
@business_information = payload["business_information"]
|
|
32
|
+
@setup = payload["setup"]
|
|
33
|
+
end
|
|
34
|
+
def to_json(options = {})
|
|
35
|
+
{
|
|
36
|
+
"friendly_name": @friendly_name,
|
|
37
|
+
"iso_country": @iso_country,
|
|
38
|
+
"business_information": @business_information,
|
|
39
|
+
"setup": @setup,
|
|
40
|
+
}.to_json(options)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class CreateShortCodeApplicationRequestBusinessInformation
|
|
45
|
+
# @param [customer_facing_profile]: [String] The Compliance Profile SID for the customer-facing business profile.
|
|
46
|
+
attr_accessor :customer_facing_profile
|
|
47
|
+
def initialize(payload)
|
|
48
|
+
@customer_facing_profile = payload["customer_facing_profile"]
|
|
49
|
+
end
|
|
50
|
+
def to_json(options = {})
|
|
51
|
+
{
|
|
52
|
+
"customer_facing_profile": @customer_facing_profile,
|
|
53
|
+
}.to_json(options)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
class CreateShortCodeApplicationRequestSetup
|
|
58
|
+
# @param [charges_apply]: [Boolean]
|
|
59
|
+
attr_accessor :charges_apply
|
|
60
|
+
def initialize(payload)
|
|
61
|
+
@charges_apply = payload["charges_apply"]
|
|
62
|
+
end
|
|
63
|
+
def to_json(options = {})
|
|
64
|
+
{
|
|
65
|
+
"charges_apply": @charges_apply,
|
|
66
|
+
}.to_json(options)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
##
|
|
72
|
+
# Initialize the ApplicationList
|
|
73
|
+
# @param [Version] version Version that contains the resource
|
|
74
|
+
# @return [ApplicationList] ApplicationList
|
|
75
|
+
def initialize(version)
|
|
76
|
+
super(version)
|
|
77
|
+
# Path Solution
|
|
78
|
+
@solution = { }
|
|
79
|
+
@uri = "/ShortCodes/Applications"
|
|
80
|
+
|
|
81
|
+
end
|
|
82
|
+
##
|
|
83
|
+
# Create the ApplicationInstance
|
|
84
|
+
# @param [CreateShortCodeApplicationRequest] create_short_code_application_request
|
|
85
|
+
# @return [ApplicationInstance] Created ApplicationInstance
|
|
86
|
+
def create(create_short_code_application_request: nil
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
90
|
+
headers['Content-Type'] = 'application/json'
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
payload = @version.create('POST', @uri, headers: headers, data: create_short_code_application_request.to_json)
|
|
96
|
+
ApplicationInstance.new(
|
|
97
|
+
@version,
|
|
98
|
+
payload,
|
|
99
|
+
)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
##
|
|
104
|
+
# Lists ApplicationInstance records from the API as a list.
|
|
105
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
|
106
|
+
# memory before returning.
|
|
107
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
108
|
+
# guarantees to never return more than limit. Default is no limit
|
|
109
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
110
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
111
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
112
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
113
|
+
# @return [Array] Array of up to limit results
|
|
114
|
+
def list(limit: nil, page_size: nil)
|
|
115
|
+
self.stream(
|
|
116
|
+
limit: limit,
|
|
117
|
+
page_size: page_size
|
|
118
|
+
).entries
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
##
|
|
122
|
+
# Streams Instance records from the API as an Enumerable.
|
|
123
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
124
|
+
# is reached.
|
|
125
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
126
|
+
# guarantees to never return more than limit. Default is no limit
|
|
127
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
128
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
129
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
130
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
131
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
|
132
|
+
def stream(limit: nil, page_size: nil)
|
|
133
|
+
limits = @version.read_limits(limit, page_size)
|
|
134
|
+
|
|
135
|
+
page = self.page(
|
|
136
|
+
page_size: limits[:page_size], )
|
|
137
|
+
|
|
138
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
##
|
|
142
|
+
# When passed a block, yields ApplicationInstance records from the API.
|
|
143
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
144
|
+
# is reached.
|
|
145
|
+
def each
|
|
146
|
+
limits = @version.read_limits
|
|
147
|
+
|
|
148
|
+
page = self.page(page_size: limits[:page_size], )
|
|
149
|
+
|
|
150
|
+
@version.stream(page,
|
|
151
|
+
limit: limits[:limit],
|
|
152
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
##
|
|
156
|
+
# Retrieve a single page of ApplicationInstance records from the API.
|
|
157
|
+
# Request is executed immediately.
|
|
158
|
+
# @param [String] page_token PageToken provided by the API
|
|
159
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
|
160
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
|
161
|
+
# @return [Page] Page of ApplicationInstance
|
|
162
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
|
163
|
+
params = Twilio::Values.of({
|
|
164
|
+
'PageToken' => page_token,
|
|
165
|
+
'Page' => page_number,
|
|
166
|
+
'PageSize' => page_size,
|
|
167
|
+
})
|
|
168
|
+
headers = Twilio::Values.of({})
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
response = @version.page('GET', @uri, params: params, headers: headers)
|
|
173
|
+
|
|
174
|
+
ApplicationPage.new(@version, response, @solution)
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
##
|
|
178
|
+
# Retrieve a single page of ApplicationInstance records from the API.
|
|
179
|
+
# Request is executed immediately.
|
|
180
|
+
# @param [String] target_url API-generated URL for the requested results page
|
|
181
|
+
# @return [Page] Page of ApplicationInstance
|
|
182
|
+
def get_page(target_url)
|
|
183
|
+
response = @version.domain.request(
|
|
184
|
+
'GET',
|
|
185
|
+
target_url
|
|
186
|
+
)
|
|
187
|
+
ApplicationPage.new(@version, response, @solution)
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
# Provide a user friendly representation
|
|
193
|
+
def to_s
|
|
194
|
+
'#<Twilio.Numbers.V2.ApplicationList>'
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
class ApplicationContext < InstanceContext
|
|
200
|
+
##
|
|
201
|
+
# Initialize the ApplicationContext
|
|
202
|
+
# @param [Version] version Version that contains the resource
|
|
203
|
+
# @param [String] sid The unique string that identifies the Short Code Application resource.
|
|
204
|
+
# @return [ApplicationContext] ApplicationContext
|
|
205
|
+
def initialize(version, sid)
|
|
206
|
+
super(version)
|
|
207
|
+
|
|
208
|
+
# Path Solution
|
|
209
|
+
@solution = { sid: sid, }
|
|
210
|
+
@uri = "/ShortCodes/Applications/#{@solution[:sid]}"
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
end
|
|
214
|
+
##
|
|
215
|
+
# Fetch the ApplicationInstance
|
|
216
|
+
# @return [ApplicationInstance] Fetched ApplicationInstance
|
|
217
|
+
def fetch
|
|
218
|
+
|
|
219
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
payload = @version.fetch('GET', @uri, headers: headers)
|
|
226
|
+
ApplicationInstance.new(
|
|
227
|
+
@version,
|
|
228
|
+
payload,
|
|
229
|
+
sid: @solution[:sid],
|
|
230
|
+
)
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
##
|
|
235
|
+
# Provide a user friendly representation
|
|
236
|
+
def to_s
|
|
237
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
238
|
+
"#<Twilio.Numbers.V2.ApplicationContext #{context}>"
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
##
|
|
242
|
+
# Provide a detailed, user friendly representation
|
|
243
|
+
def inspect
|
|
244
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
245
|
+
"#<Twilio.Numbers.V2.ApplicationContext #{context}>"
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
class ApplicationPage < Page
|
|
250
|
+
##
|
|
251
|
+
# Initialize the ApplicationPage
|
|
252
|
+
# @param [Version] version Version that contains the resource
|
|
253
|
+
# @param [Response] response Response from the API
|
|
254
|
+
# @param [Hash] solution Path solution for the resource
|
|
255
|
+
# @return [ApplicationPage] ApplicationPage
|
|
256
|
+
def initialize(version, response, solution)
|
|
257
|
+
super(version, response)
|
|
258
|
+
|
|
259
|
+
# Path Solution
|
|
260
|
+
@solution = solution
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
##
|
|
264
|
+
# Build an instance of ApplicationInstance
|
|
265
|
+
# @param [Hash] payload Payload response from the API
|
|
266
|
+
# @return [ApplicationInstance] ApplicationInstance
|
|
267
|
+
def get_instance(payload)
|
|
268
|
+
ApplicationInstance.new(@version, payload)
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
##
|
|
272
|
+
# Provide a user friendly representation
|
|
273
|
+
def to_s
|
|
274
|
+
'<Twilio.Numbers.V2.ApplicationPage>'
|
|
275
|
+
end
|
|
276
|
+
end
|
|
277
|
+
class ApplicationInstance < InstanceResource
|
|
278
|
+
##
|
|
279
|
+
# Initialize the ApplicationInstance
|
|
280
|
+
# @param [Version] version Version that contains the resource
|
|
281
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
282
|
+
# @param [String] account_sid The SID of the
|
|
283
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this Application
|
|
284
|
+
# resource.
|
|
285
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
|
286
|
+
# @return [ApplicationInstance] ApplicationInstance
|
|
287
|
+
def initialize(version, payload , sid: nil)
|
|
288
|
+
super(version)
|
|
289
|
+
|
|
290
|
+
# Marshaled Properties
|
|
291
|
+
@properties = {
|
|
292
|
+
'sid' => payload['sid'],
|
|
293
|
+
'bundle_sid' => payload['bundle_sid'],
|
|
294
|
+
'application_requirements_sid' => payload['application_requirements_sid'],
|
|
295
|
+
'friendly_name' => payload['friendly_name'],
|
|
296
|
+
'iso_country' => payload['iso_country'],
|
|
297
|
+
'state' => payload['state'],
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
# Context
|
|
301
|
+
@instance_context = nil
|
|
302
|
+
@params = { 'sid' => sid || @properties['sid'] , }
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
##
|
|
306
|
+
# Generate an instance context for the instance, the context is capable of
|
|
307
|
+
# performing various actions. All instance actions are proxied to the context
|
|
308
|
+
# @return [ApplicationContext] CallContext for this CallInstance
|
|
309
|
+
def context
|
|
310
|
+
unless @instance_context
|
|
311
|
+
@instance_context = ApplicationContext.new(@version , @params['sid'])
|
|
312
|
+
end
|
|
313
|
+
@instance_context
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
##
|
|
317
|
+
# @return [String] The unique identifier of the Short Code Application.
|
|
318
|
+
def sid
|
|
319
|
+
@properties['sid']
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
##
|
|
323
|
+
# @return [String] The Bundle SID for regulatory compliance.
|
|
324
|
+
def bundle_sid
|
|
325
|
+
@properties['bundle_sid']
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
##
|
|
329
|
+
# @return [String] The Application Requirements SID.
|
|
330
|
+
def application_requirements_sid
|
|
331
|
+
@properties['application_requirements_sid']
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
##
|
|
335
|
+
# @return [String] The friendly name of the application.
|
|
336
|
+
def friendly_name
|
|
337
|
+
@properties['friendly_name']
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
##
|
|
341
|
+
# @return [String] The ISO country code.
|
|
342
|
+
def iso_country
|
|
343
|
+
@properties['iso_country']
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
##
|
|
347
|
+
# @return [String] The state of the application.
|
|
348
|
+
def state
|
|
349
|
+
@properties['state']
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
##
|
|
353
|
+
# Fetch the ApplicationInstance
|
|
354
|
+
# @return [ApplicationInstance] Fetched ApplicationInstance
|
|
355
|
+
def fetch
|
|
356
|
+
|
|
357
|
+
context.fetch
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
##
|
|
361
|
+
# Provide a user friendly representation
|
|
362
|
+
def to_s
|
|
363
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
364
|
+
"<Twilio.Numbers.V2.ApplicationInstance #{values}>"
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
##
|
|
368
|
+
# Provide a detailed, user friendly representation
|
|
369
|
+
def inspect
|
|
370
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
371
|
+
"<Twilio.Numbers.V2.ApplicationInstance #{values}>"
|
|
372
|
+
end
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
end
|
|
376
|
+
end
|
|
377
|
+
end
|
|
378
|
+
end
|
|
@@ -21,6 +21,7 @@ module Twilio
|
|
|
21
21
|
def initialize(domain)
|
|
22
22
|
super
|
|
23
23
|
@version = 'v2'
|
|
24
|
+
@applications = nil
|
|
24
25
|
@authorization_documents = nil
|
|
25
26
|
@bulk_hosted_number_orders = nil
|
|
26
27
|
@bundle_clone = nil
|
|
@@ -28,6 +29,20 @@ module Twilio
|
|
|
28
29
|
@regulatory_compliance = nil
|
|
29
30
|
end
|
|
30
31
|
|
|
32
|
+
##
|
|
33
|
+
# @param [String] sid The unique string that identifies the Short Code Application resource.
|
|
34
|
+
# @return [Twilio::REST::Numbers::V2::ApplicationContext] if sid was passed.
|
|
35
|
+
# @return [Twilio::REST::Numbers::V2::ApplicationList]
|
|
36
|
+
def applications(sid=:unset)
|
|
37
|
+
if sid.nil?
|
|
38
|
+
raise ArgumentError, 'sid cannot be nil'
|
|
39
|
+
end
|
|
40
|
+
if sid == :unset
|
|
41
|
+
@applications ||= ApplicationList.new self
|
|
42
|
+
else
|
|
43
|
+
ApplicationContext.new(self, sid)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
31
46
|
##
|
|
32
47
|
# @param [String] sid A 34 character string that uniquely identifies this AuthorizationDocument.
|
|
33
48
|
# @return [Twilio::REST::Numbers::V2::AuthorizationDocumentContext] if sid was passed.
|
|
@@ -32,6 +32,7 @@ module Twilio
|
|
|
32
32
|
end
|
|
33
33
|
##
|
|
34
34
|
# Create the TokenInstance
|
|
35
|
+
# @param [String] account_sid Optional Account SID to perform on behalf of requests.
|
|
35
36
|
# @param [String] grant_type Grant type is a credential representing resource owner's authorization which can be used by client to obtain access token.
|
|
36
37
|
# @param [String] client_id A 34 character string that uniquely identifies this OAuth App.
|
|
37
38
|
# @param [String] client_secret The credential for confidential OAuth App.
|
|
@@ -42,6 +43,7 @@ module Twilio
|
|
|
42
43
|
# @param [String] scope The scope of token
|
|
43
44
|
# @return [TokenInstance] Created TokenInstance
|
|
44
45
|
def create(
|
|
46
|
+
account_sid: :unset,
|
|
45
47
|
grant_type: :unset,
|
|
46
48
|
client_id: :unset,
|
|
47
49
|
client_secret: :unset,
|
|
@@ -52,6 +54,9 @@ module Twilio
|
|
|
52
54
|
scope: :unset
|
|
53
55
|
)
|
|
54
56
|
|
|
57
|
+
params = Twilio::Values.of({
|
|
58
|
+
'account_sid' => account_sid,
|
|
59
|
+
})
|
|
55
60
|
data = Twilio::Values.of({
|
|
56
61
|
'grant_type' => grant_type,
|
|
57
62
|
'client_id' => client_id,
|
|
@@ -69,7 +74,7 @@ module Twilio
|
|
|
69
74
|
|
|
70
75
|
|
|
71
76
|
|
|
72
|
-
payload = @version.create('POST', @uri, data: data, headers: headers)
|
|
77
|
+
payload = @version.create('POST', @uri, params: params, data: data, headers: headers)
|
|
73
78
|
TokenInstance.new(
|
|
74
79
|
@version,
|
|
75
80
|
payload,
|