twilio-ruby 5.24.0 → 5.25.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 077deab208a16373c55b6c378b6fb13b88c7bba67c5d77aa0669fb1ff7474aaf
4
- data.tar.gz: 82e664f4ce7e99fe023149c361346a6c766fe17e6169eef8310fa4bd857e1d30
3
+ metadata.gz: 21d71102d15c51b3dd3615c94d4c18f71434ae88589d7ebe550d15966ecf64de
4
+ data.tar.gz: be9136348b6575b582b33fd358667e781431fc8061d7d944f74ef9e54ae4747d
5
5
  SHA512:
6
- metadata.gz: 044d627a580368a9b835addc0b49ce97c15fc2dc6b133da974d0c960ab3ffb2933dcfebe741502df8a60bbe1ca2d6adff5ad4aa99a70e6065c34bbd2f9bd3bb1
7
- data.tar.gz: 784716a736dfcd236bc3551a2757d0e19dd17f44c1d82a24cebb5e34e1218c3607811fccec4720cc3126042369fe16f1b94f7b31887119ed238856ac5145d8f0
6
+ metadata.gz: aa92a41e8e18c76dcc8b0815ac64b95f373f642d28e30b55dac7141bcc774f2ec981bfb0d0a478760299b9704edfdc06f2513d0e32f197706b4624be7cb7f740
7
+ data.tar.gz: c4d8232223dddc756dbe4b934eddcbdcd174271ca3075ed1c39ae09c44bae02811dfea305d5e860645d990cb2316c42204a103df5f0af1a83a4e494253a55776
data/CHANGES.md CHANGED
@@ -1,6 +1,18 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2019-06-26] Version 5.25.0
5
+ ----------------------------
6
+ **Autopilot**
7
+ - Adds two new properties in Assistant i.e needs_model_build and development_stage
8
+
9
+ **Preview**
10
+ - Changed phone numbers from _URL|Path_ to `X-XCNAM-Sensitive` headers **(breaking change)**
11
+
12
+ **Verify**
13
+ - Add `MessagingConfiguration` resource to verify service
14
+
15
+
4
16
  [2019-06-12] Version 5.24.0
5
17
  ----------------------------
6
18
  **Autopilot**
data/README.md CHANGED
@@ -26,13 +26,13 @@ in-line code documentation here in the library.
26
26
  To install using [Bundler][bundler] grab the latest stable version:
27
27
 
28
28
  ```ruby
29
- gem 'twilio-ruby', '~> 5.24.0'
29
+ gem 'twilio-ruby', '~> 5.25.0'
30
30
  ```
31
31
 
32
32
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
33
33
 
34
34
  ```bash
35
- gem install twilio-ruby -v 5.24.0
35
+ gem install twilio-ruby -v 5.25.0
36
36
  ```
37
37
 
38
38
  To build and install the development branch yourself from the latest source:
@@ -243,8 +243,10 @@ module Twilio
243
243
  # @param [Hash] defaults A JSON object that defines the Assistant's [default
244
244
  # tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various
245
245
  # scenarios, including initiation actions and fallback tasks.
246
+ # @param [String] development_stage A string describing the state of the
247
+ # assistant.
246
248
  # @return [AssistantInstance] Updated AssistantInstance
247
- def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, style_sheet: :unset, defaults: :unset)
249
+ def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, style_sheet: :unset, defaults: :unset, development_stage: :unset)
248
250
  data = Twilio::Values.of({
249
251
  'FriendlyName' => friendly_name,
250
252
  'LogQueries' => log_queries,
@@ -253,6 +255,7 @@ module Twilio
253
255
  'CallbackEvents' => callback_events,
254
256
  'StyleSheet' => Twilio.serialize_object(style_sheet),
255
257
  'Defaults' => Twilio.serialize_object(defaults),
258
+ 'DevelopmentStage' => development_stage,
256
259
  })
257
260
 
258
261
  payload = @version.update(
@@ -432,6 +435,8 @@ module Twilio
432
435
  'latest_model_build_sid' => payload['latest_model_build_sid'],
433
436
  'links' => payload['links'],
434
437
  'log_queries' => payload['log_queries'],
438
+ 'development_stage' => payload['development_stage'],
439
+ 'needs_model_build' => payload['needs_model_build'],
435
440
  'sid' => payload['sid'],
436
441
  'unique_name' => payload['unique_name'],
437
442
  'url' => payload['url'],
@@ -497,6 +502,18 @@ module Twilio
497
502
  @properties['log_queries']
498
503
  end
499
504
 
505
+ ##
506
+ # @return [String] A string describing the state of the assistant.
507
+ def development_stage
508
+ @properties['development_stage']
509
+ end
510
+
511
+ ##
512
+ # @return [Boolean] Whether model needs to be rebuilt
513
+ def needs_model_build
514
+ @properties['needs_model_build']
515
+ end
516
+
500
517
  ##
501
518
  # @return [String] The unique string that identifies the resource
502
519
  def sid
@@ -551,8 +568,10 @@ module Twilio
551
568
  # @param [Hash] defaults A JSON object that defines the Assistant's [default
552
569
  # tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various
553
570
  # scenarios, including initiation actions and fallback tasks.
571
+ # @param [String] development_stage A string describing the state of the
572
+ # assistant.
554
573
  # @return [AssistantInstance] Updated AssistantInstance
555
- def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, style_sheet: :unset, defaults: :unset)
574
+ def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, style_sheet: :unset, defaults: :unset, development_stage: :unset)
556
575
  context.update(
557
576
  friendly_name: friendly_name,
558
577
  log_queries: log_queries,
@@ -561,6 +580,7 @@ module Twilio
561
580
  callback_events: callback_events,
562
581
  style_sheet: style_sheet,
563
582
  defaults: defaults,
583
+ development_stage: development_stage,
564
584
  )
565
585
  end
566
586
 
@@ -164,12 +164,10 @@ module Twilio
164
164
  # fax. See our [security](https://www.twilio.com/docs/security) page for
165
165
  # information on how to ensure the request for your media comes from Twilio.
166
166
  # @param [fax.Quality] quality The [Fax Quality
167
- # value](https://www.twilio.com/docs/api/fax/rest/faxes#fax-quality-values) that
168
- # describes the fax quality. Can be: `standard`, `fine`, or `superfine` and
169
- # defaults to `fine`.
167
+ # value](https://www.twilio.com/docs/api/fax/rest/faxes-resource#fax-quality-values) that describes the fax quality. Can be: `standard`, `fine`, or `superfine` and defaults to `fine`.
170
168
  # @param [String] status_callback The URL we should call using the `POST` method
171
- # to send status information to your application when the status of the fax
172
- # changes.
169
+ # to send [status
170
+ # information](https://www.twilio.com/docs/api/fax/rest/faxes-resource#fax-status-callback) to your application when the status of the fax changes.
173
171
  # @param [String] from The number the fax was sent from. Can be the phone number
174
172
  # in [E.164](https://www.twilio.com/docs/glossary/what-e164) format or the SIP
175
173
  # `from` value. The caller ID displayed to the recipient uses this value. If this
@@ -284,8 +282,8 @@ module Twilio
284
282
 
285
283
  ##
286
284
  # Update the FaxInstance
287
- # @param [fax.UpdateStatus] status The new status of the resource. Can be only
288
- # `canceled`. This may fail if transmission has already started.
285
+ # @param [fax.UpdateStatus] status The new
286
+ # [status](https://www.twilio.com/docs/api/fax/rest/faxes-resource#fax-status-values) of the resource. Can be only `canceled`. This may fail if transmission has already started.
289
287
  # @return [FaxInstance] Updated FaxInstance
290
288
  def update(status: :unset)
291
289
  data = Twilio::Values.of({'Status' => status, })
@@ -507,8 +505,8 @@ module Twilio
507
505
 
508
506
  ##
509
507
  # Update the FaxInstance
510
- # @param [fax.UpdateStatus] status The new status of the resource. Can be only
511
- # `canceled`. This may fail if transmission has already started.
508
+ # @param [fax.UpdateStatus] status The new
509
+ # [status](https://www.twilio.com/docs/api/fax/rest/faxes-resource#fax-status-values) of the resource. Can be only `canceled`. This may fail if transmission has already started.
512
510
  # @return [FaxInstance] Updated FaxInstance
513
511
  def update(status: :unset)
514
512
  context.update(status: status, )
@@ -0,0 +1,186 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Preview < Domain
12
+ class TrustedComms < Version
13
+ ##
14
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
15
+ class CpsList < ListResource
16
+ ##
17
+ # Initialize the CpsList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [CpsList] CpsList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+ end
26
+
27
+ ##
28
+ # Provide a user friendly representation
29
+ def to_s
30
+ '#<Twilio.Preview.TrustedComms.CpsList>'
31
+ end
32
+ end
33
+
34
+ ##
35
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
36
+ class CpsPage < Page
37
+ ##
38
+ # Initialize the CpsPage
39
+ # @param [Version] version Version that contains the resource
40
+ # @param [Response] response Response from the API
41
+ # @param [Hash] solution Path solution for the resource
42
+ # @return [CpsPage] CpsPage
43
+ def initialize(version, response, solution)
44
+ super(version, response)
45
+
46
+ # Path Solution
47
+ @solution = solution
48
+ end
49
+
50
+ ##
51
+ # Build an instance of CpsInstance
52
+ # @param [Hash] payload Payload response from the API
53
+ # @return [CpsInstance] CpsInstance
54
+ def get_instance(payload)
55
+ CpsInstance.new(@version, payload, )
56
+ end
57
+
58
+ ##
59
+ # Provide a user friendly representation
60
+ def to_s
61
+ '<Twilio.Preview.TrustedComms.CpsPage>'
62
+ end
63
+ end
64
+
65
+ ##
66
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
67
+ class CpsContext < InstanceContext
68
+ ##
69
+ # Initialize the CpsContext
70
+ # @param [Version] version Version that contains the resource
71
+ # @return [CpsContext] CpsContext
72
+ def initialize(version)
73
+ super(version)
74
+
75
+ # Path Solution
76
+ @solution = {}
77
+ @uri = "/CPS"
78
+ end
79
+
80
+ ##
81
+ # Fetch a CpsInstance
82
+ # @return [CpsInstance] Fetched CpsInstance
83
+ def fetch
84
+ params = Twilio::Values.of({})
85
+
86
+ payload = @version.fetch(
87
+ 'GET',
88
+ @uri,
89
+ params,
90
+ )
91
+
92
+ CpsInstance.new(@version, payload, )
93
+ end
94
+
95
+ ##
96
+ # Provide a user friendly representation
97
+ def to_s
98
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
99
+ "#<Twilio.Preview.TrustedComms.CpsContext #{context}>"
100
+ end
101
+
102
+ ##
103
+ # Provide a detailed, user friendly representation
104
+ def inspect
105
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
106
+ "#<Twilio.Preview.TrustedComms.CpsContext #{context}>"
107
+ end
108
+ end
109
+
110
+ ##
111
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
112
+ class CpsInstance < InstanceResource
113
+ ##
114
+ # Initialize the CpsInstance
115
+ # @param [Version] version Version that contains the resource
116
+ # @param [Hash] payload payload that contains response from Twilio
117
+ # @return [CpsInstance] CpsInstance
118
+ def initialize(version, payload)
119
+ super(version)
120
+
121
+ # Marshaled Properties
122
+ @properties = {
123
+ 'phone_number' => payload['phone_number'],
124
+ 'cps_url' => payload['cps_url'],
125
+ 'url' => payload['url'],
126
+ }
127
+
128
+ # Context
129
+ @instance_context = nil
130
+ @params = {}
131
+ end
132
+
133
+ ##
134
+ # Generate an instance context for the instance, the context is capable of
135
+ # performing various actions. All instance actions are proxied to the context
136
+ # @return [CpsContext] CpsContext for this CpsInstance
137
+ def context
138
+ unless @instance_context
139
+ @instance_context = CpsContext.new(@version, )
140
+ end
141
+ @instance_context
142
+ end
143
+
144
+ ##
145
+ # @return [String] Phone number passed.
146
+ def phone_number
147
+ @properties['phone_number']
148
+ end
149
+
150
+ ##
151
+ # @return [String] CPS URL of the phone number.
152
+ def cps_url
153
+ @properties['cps_url']
154
+ end
155
+
156
+ ##
157
+ # @return [String] The URL of this resource.
158
+ def url
159
+ @properties['url']
160
+ end
161
+
162
+ ##
163
+ # Fetch a CpsInstance
164
+ # @return [CpsInstance] Fetched CpsInstance
165
+ def fetch
166
+ context.fetch
167
+ end
168
+
169
+ ##
170
+ # Provide a user friendly representation
171
+ def to_s
172
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
173
+ "<Twilio.Preview.TrustedComms.CpsInstance #{values}>"
174
+ end
175
+
176
+ ##
177
+ # Provide a detailed, user friendly representation
178
+ def inspect
179
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
180
+ "<Twilio.Preview.TrustedComms.CpsInstance #{values}>"
181
+ end
182
+ end
183
+ end
184
+ end
185
+ end
186
+ end
@@ -79,14 +79,9 @@ module Twilio
79
79
 
80
80
  ##
81
81
  # Fetch a CurrentCallInstance
82
- # @param [String] from The originating Phone Number, given in E.164 format
83
- # (https://en.wikipedia.org/wiki/E.164). This phone number should be a Twilio
84
- # number, otherwise it will return an error with HTTP Status Code 400.
85
- # @param [String] to The terminating Phone Number, given in E.164 format
86
- # (https://en.wikipedia.org/wiki/E.164).
87
82
  # @return [CurrentCallInstance] Fetched CurrentCallInstance
88
- def fetch(from: :unset, to: :unset)
89
- params = Twilio::Values.of({'From' => from, 'To' => to, })
83
+ def fetch
84
+ params = Twilio::Values.of({})
90
85
 
91
86
  payload = @version.fetch(
92
87
  'GET',
@@ -243,14 +238,9 @@ module Twilio
243
238
 
244
239
  ##
245
240
  # Fetch a CurrentCallInstance
246
- # @param [String] from The originating Phone Number, given in E.164 format
247
- # (https://en.wikipedia.org/wiki/E.164). This phone number should be a Twilio
248
- # number, otherwise it will return an error with HTTP Status Code 400.
249
- # @param [String] to The terminating Phone Number, given in E.164 format
250
- # (https://en.wikipedia.org/wiki/E.164).
251
241
  # @return [CurrentCallInstance] Fetched CurrentCallInstance
252
- def fetch(from: :unset, to: :unset)
253
- context.fetch(from: from, to: to, )
242
+ def fetch
243
+ context.fetch
254
244
  end
255
245
 
256
246
  ##
@@ -18,6 +18,7 @@ module Twilio
18
18
  @devices = nil
19
19
  @phone_calls = nil
20
20
  @current_calls = nil
21
+ @cps = nil
21
22
  end
22
23
 
23
24
  ##
@@ -38,6 +39,12 @@ module Twilio
38
39
  @current_calls ||= CurrentCallContext.new self
39
40
  end
40
41
 
42
+ ##
43
+ # @return [Twilio::REST::Preview::TrustedComms::CpsContext]
44
+ def cps
45
+ @cps ||= CpsContext.new self
46
+ end
47
+
41
48
  ##
42
49
  # Provide a user friendly representation
43
50
  def to_s
@@ -204,6 +204,12 @@ module Twilio
204
204
  self.trusted_comms.current_calls()
205
205
  end
206
206
 
207
+ ##
208
+ # @return [Twilio::REST::Preview::TrustedComms::CpsInstance]
209
+ def cps
210
+ self.trusted_comms.cps()
211
+ end
212
+
207
213
  ##
208
214
  # Provide a user friendly representation
209
215
  def to_s
@@ -0,0 +1,395 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Verify < Domain
12
+ class V2 < Version
13
+ class ServiceContext < InstanceContext
14
+ ##
15
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
16
+ class MessagingConfigurationList < ListResource
17
+ ##
18
+ # Initialize the MessagingConfigurationList
19
+ # @param [Version] version Version that contains the resource
20
+ # @param [String] service_sid The SID of the
21
+ # [Service](https://www.twilio.com/docs/verify/api-beta/service-beta) that the
22
+ # resource is associated with.
23
+ # @return [MessagingConfigurationList] MessagingConfigurationList
24
+ def initialize(version, service_sid: nil)
25
+ super(version)
26
+
27
+ # Path Solution
28
+ @solution = {service_sid: service_sid}
29
+ @uri = "/Services/#{@solution[:service_sid]}/MessagingConfigurations"
30
+ end
31
+
32
+ ##
33
+ # Retrieve a single page of MessagingConfigurationInstance records from the API.
34
+ # Request is executed immediately.
35
+ # @param [String] country The
36
+ # [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of
37
+ # the country this configuration will be applied to. If this is a global
38
+ # configuration, Country will take the value `all`.
39
+ # @param [String] messaging_service_sid The SID of the [Messaging
40
+ # Service](https://www.twilio.com/docs/api/messaging/services) to be used to send
41
+ # SMS to the country of this configuration.
42
+ # @return [MessagingConfigurationInstance] Newly created MessagingConfigurationInstance
43
+ def create(country: nil, messaging_service_sid: nil)
44
+ data = Twilio::Values.of({'Country' => country, 'MessagingServiceSid' => messaging_service_sid, })
45
+
46
+ payload = @version.create(
47
+ 'POST',
48
+ @uri,
49
+ data: data
50
+ )
51
+
52
+ MessagingConfigurationInstance.new(@version, payload, service_sid: @solution[:service_sid], )
53
+ end
54
+
55
+ ##
56
+ # Lists MessagingConfigurationInstance records from the API as a list.
57
+ # Unlike stream(), this operation is eager and will load `limit` records into
58
+ # memory before returning.
59
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
60
+ # guarantees to never return more than limit. Default is no limit
61
+ # @param [Integer] page_size Number of records to fetch per request, when
62
+ # not set will use the default value of 50 records. If no page_size is defined
63
+ # but a limit is defined, stream() will attempt to read the limit with the most
64
+ # efficient page size, i.e. min(limit, 1000)
65
+ # @return [Array] Array of up to limit results
66
+ def list(limit: nil, page_size: nil)
67
+ self.stream(limit: limit, page_size: page_size).entries
68
+ end
69
+
70
+ ##
71
+ # Streams MessagingConfigurationInstance records from the API as an Enumerable.
72
+ # This operation lazily loads records as efficiently as possible until the limit
73
+ # is reached.
74
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
75
+ # guarantees to never return more than limit. Default is no limit.
76
+ # @param [Integer] page_size Number of records to fetch per request, when
77
+ # not set will use the default value of 50 records. If no page_size is defined
78
+ # but a limit is defined, stream() will attempt to read the limit with the most
79
+ # efficient page size, i.e. min(limit, 1000)
80
+ # @return [Enumerable] Enumerable that will yield up to limit results
81
+ def stream(limit: nil, page_size: nil)
82
+ limits = @version.read_limits(limit, page_size)
83
+
84
+ page = self.page(page_size: limits[:page_size], )
85
+
86
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
87
+ end
88
+
89
+ ##
90
+ # When passed a block, yields MessagingConfigurationInstance records from the API.
91
+ # This operation lazily loads records as efficiently as possible until the limit
92
+ # is reached.
93
+ def each
94
+ limits = @version.read_limits
95
+
96
+ page = self.page(page_size: limits[:page_size], )
97
+
98
+ @version.stream(page,
99
+ limit: limits[:limit],
100
+ page_limit: limits[:page_limit]).each {|x| yield x}
101
+ end
102
+
103
+ ##
104
+ # Retrieve a single page of MessagingConfigurationInstance records from the API.
105
+ # Request is executed immediately.
106
+ # @param [String] page_token PageToken provided by the API
107
+ # @param [Integer] page_number Page Number, this value is simply for client state
108
+ # @param [Integer] page_size Number of records to return, defaults to 50
109
+ # @return [Page] Page of MessagingConfigurationInstance
110
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
111
+ params = Twilio::Values.of({
112
+ 'PageToken' => page_token,
113
+ 'Page' => page_number,
114
+ 'PageSize' => page_size,
115
+ })
116
+ response = @version.page(
117
+ 'GET',
118
+ @uri,
119
+ params
120
+ )
121
+ MessagingConfigurationPage.new(@version, response, @solution)
122
+ end
123
+
124
+ ##
125
+ # Retrieve a single page of MessagingConfigurationInstance records from the API.
126
+ # Request is executed immediately.
127
+ # @param [String] target_url API-generated URL for the requested results page
128
+ # @return [Page] Page of MessagingConfigurationInstance
129
+ def get_page(target_url)
130
+ response = @version.domain.request(
131
+ 'GET',
132
+ target_url
133
+ )
134
+ MessagingConfigurationPage.new(@version, response, @solution)
135
+ end
136
+
137
+ ##
138
+ # Provide a user friendly representation
139
+ def to_s
140
+ '#<Twilio.Verify.V2.MessagingConfigurationList>'
141
+ end
142
+ end
143
+
144
+ ##
145
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
146
+ class MessagingConfigurationPage < Page
147
+ ##
148
+ # Initialize the MessagingConfigurationPage
149
+ # @param [Version] version Version that contains the resource
150
+ # @param [Response] response Response from the API
151
+ # @param [Hash] solution Path solution for the resource
152
+ # @return [MessagingConfigurationPage] MessagingConfigurationPage
153
+ def initialize(version, response, solution)
154
+ super(version, response)
155
+
156
+ # Path Solution
157
+ @solution = solution
158
+ end
159
+
160
+ ##
161
+ # Build an instance of MessagingConfigurationInstance
162
+ # @param [Hash] payload Payload response from the API
163
+ # @return [MessagingConfigurationInstance] MessagingConfigurationInstance
164
+ def get_instance(payload)
165
+ MessagingConfigurationInstance.new(@version, payload, service_sid: @solution[:service_sid], )
166
+ end
167
+
168
+ ##
169
+ # Provide a user friendly representation
170
+ def to_s
171
+ '<Twilio.Verify.V2.MessagingConfigurationPage>'
172
+ end
173
+ end
174
+
175
+ ##
176
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
177
+ class MessagingConfigurationContext < InstanceContext
178
+ ##
179
+ # Initialize the MessagingConfigurationContext
180
+ # @param [Version] version Version that contains the resource
181
+ # @param [String] service_sid The SID of the
182
+ # [Service](https://www.twilio.com/docs/verify/api-beta/service-beta) that the
183
+ # resource is associated with.
184
+ # @param [String] country The
185
+ # [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of
186
+ # the country this configuration will be applied to. If this is a global
187
+ # configuration, Country will take the value `all`.
188
+ # @return [MessagingConfigurationContext] MessagingConfigurationContext
189
+ def initialize(version, service_sid, country)
190
+ super(version)
191
+
192
+ # Path Solution
193
+ @solution = {service_sid: service_sid, country: country, }
194
+ @uri = "/Services/#{@solution[:service_sid]}/MessagingConfigurations/#{@solution[:country]}"
195
+ end
196
+
197
+ ##
198
+ # Update the MessagingConfigurationInstance
199
+ # @param [String] messaging_service_sid The SID of the [Messaging
200
+ # Service](https://www.twilio.com/docs/api/messaging/services) to be used to send
201
+ # SMS to the country of this configuration.
202
+ # @return [MessagingConfigurationInstance] Updated MessagingConfigurationInstance
203
+ def update(messaging_service_sid: nil)
204
+ data = Twilio::Values.of({'MessagingServiceSid' => messaging_service_sid, })
205
+
206
+ payload = @version.update(
207
+ 'POST',
208
+ @uri,
209
+ data: data,
210
+ )
211
+
212
+ MessagingConfigurationInstance.new(
213
+ @version,
214
+ payload,
215
+ service_sid: @solution[:service_sid],
216
+ country: @solution[:country],
217
+ )
218
+ end
219
+
220
+ ##
221
+ # Fetch a MessagingConfigurationInstance
222
+ # @return [MessagingConfigurationInstance] Fetched MessagingConfigurationInstance
223
+ def fetch
224
+ params = Twilio::Values.of({})
225
+
226
+ payload = @version.fetch(
227
+ 'GET',
228
+ @uri,
229
+ params,
230
+ )
231
+
232
+ MessagingConfigurationInstance.new(
233
+ @version,
234
+ payload,
235
+ service_sid: @solution[:service_sid],
236
+ country: @solution[:country],
237
+ )
238
+ end
239
+
240
+ ##
241
+ # Deletes the MessagingConfigurationInstance
242
+ # @return [Boolean] true if delete succeeds, true otherwise
243
+ def delete
244
+ @version.delete('delete', @uri)
245
+ end
246
+
247
+ ##
248
+ # Provide a user friendly representation
249
+ def to_s
250
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
251
+ "#<Twilio.Verify.V2.MessagingConfigurationContext #{context}>"
252
+ end
253
+
254
+ ##
255
+ # Provide a detailed, user friendly representation
256
+ def inspect
257
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
258
+ "#<Twilio.Verify.V2.MessagingConfigurationContext #{context}>"
259
+ end
260
+ end
261
+
262
+ ##
263
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
264
+ class MessagingConfigurationInstance < InstanceResource
265
+ ##
266
+ # Initialize the MessagingConfigurationInstance
267
+ # @param [Version] version Version that contains the resource
268
+ # @param [Hash] payload payload that contains response from Twilio
269
+ # @param [String] service_sid The SID of the
270
+ # [Service](https://www.twilio.com/docs/verify/api-beta/service-beta) that the
271
+ # resource is associated with.
272
+ # @param [String] country The
273
+ # [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of
274
+ # the country this configuration will be applied to. If this is a global
275
+ # configuration, Country will take the value `all`.
276
+ # @return [MessagingConfigurationInstance] MessagingConfigurationInstance
277
+ def initialize(version, payload, service_sid: nil, country: nil)
278
+ super(version)
279
+
280
+ # Marshaled Properties
281
+ @properties = {
282
+ 'account_sid' => payload['account_sid'],
283
+ 'service_sid' => payload['service_sid'],
284
+ 'country' => payload['country'],
285
+ 'messaging_service_sid' => payload['messaging_service_sid'],
286
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
287
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
288
+ 'url' => payload['url'],
289
+ }
290
+
291
+ # Context
292
+ @instance_context = nil
293
+ @params = {'service_sid' => service_sid, 'country' => country || @properties['country'], }
294
+ end
295
+
296
+ ##
297
+ # Generate an instance context for the instance, the context is capable of
298
+ # performing various actions. All instance actions are proxied to the context
299
+ # @return [MessagingConfigurationContext] MessagingConfigurationContext for this MessagingConfigurationInstance
300
+ def context
301
+ unless @instance_context
302
+ @instance_context = MessagingConfigurationContext.new(
303
+ @version,
304
+ @params['service_sid'],
305
+ @params['country'],
306
+ )
307
+ end
308
+ @instance_context
309
+ end
310
+
311
+ ##
312
+ # @return [String] The SID of the Account that created the resource
313
+ def account_sid
314
+ @properties['account_sid']
315
+ end
316
+
317
+ ##
318
+ # @return [String] The SID of the Service that the resource is associated with
319
+ def service_sid
320
+ @properties['service_sid']
321
+ end
322
+
323
+ ##
324
+ # @return [String] The ISO-3166-1 country code of the country or `all`.
325
+ def country
326
+ @properties['country']
327
+ end
328
+
329
+ ##
330
+ # @return [String] The SID of the Messaging Service used for this configuration.
331
+ def messaging_service_sid
332
+ @properties['messaging_service_sid']
333
+ end
334
+
335
+ ##
336
+ # @return [Time] The RFC 2822 date and time in GMT when the resource was created
337
+ def date_created
338
+ @properties['date_created']
339
+ end
340
+
341
+ ##
342
+ # @return [Time] The RFC 2822 date and time in GMT when the resource was last updated
343
+ def date_updated
344
+ @properties['date_updated']
345
+ end
346
+
347
+ ##
348
+ # @return [String] The URL of this resource.
349
+ def url
350
+ @properties['url']
351
+ end
352
+
353
+ ##
354
+ # Update the MessagingConfigurationInstance
355
+ # @param [String] messaging_service_sid The SID of the [Messaging
356
+ # Service](https://www.twilio.com/docs/api/messaging/services) to be used to send
357
+ # SMS to the country of this configuration.
358
+ # @return [MessagingConfigurationInstance] Updated MessagingConfigurationInstance
359
+ def update(messaging_service_sid: nil)
360
+ context.update(messaging_service_sid: messaging_service_sid, )
361
+ end
362
+
363
+ ##
364
+ # Fetch a MessagingConfigurationInstance
365
+ # @return [MessagingConfigurationInstance] Fetched MessagingConfigurationInstance
366
+ def fetch
367
+ context.fetch
368
+ end
369
+
370
+ ##
371
+ # Deletes the MessagingConfigurationInstance
372
+ # @return [Boolean] true if delete succeeds, true otherwise
373
+ def delete
374
+ context.delete
375
+ end
376
+
377
+ ##
378
+ # Provide a user friendly representation
379
+ def to_s
380
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
381
+ "<Twilio.Verify.V2.MessagingConfigurationInstance #{values}>"
382
+ end
383
+
384
+ ##
385
+ # Provide a detailed, user friendly representation
386
+ def inspect
387
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
388
+ "<Twilio.Verify.V2.MessagingConfigurationInstance #{values}>"
389
+ end
390
+ end
391
+ end
392
+ end
393
+ end
394
+ end
395
+ end