twilio-ruby 5.58.0 → 5.58.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90245670a85b148807ee4a2be28da950b65530413eef56cf403e16708222a5d4
4
- data.tar.gz: e279a65d127e4b629c904a9de0081c03effd7fa76ec73aa945bb52a8f4d32806
3
+ metadata.gz: 22891108a10e24af4975960e154bc78ba330d7094eef18a7850db14d1b19f55c
4
+ data.tar.gz: 84157f208866fec1713f624928ac607f29d69e69efb60fbe7778bddce4b0e768
5
5
  SHA512:
6
- metadata.gz: f4cf12efd6b9c6b1a8dd4d3239c369e1592cb920e1c2c68451e5e835dcb43a1aa2d914b2fc6eaadd4daa65c09c980278d2fa6fd09723db8ecede21023bc38108
7
- data.tar.gz: f92a04a5901154ccdb52b8a79dce167019b61177e90cc050774a2f1bfcb6a3b466b73fe92639363bdc43a697845423fd9d4d00e9ff1cad9fe34c9ae27329c831
6
+ metadata.gz: c93a2f24c7a14a6f594fca8c3425510763a5ddf3d47edcda7bf24dc7d2a3bd8b39c8e8d5ca07fae9ef92194d44d36f93060f56022c83ecca6dbd91ef2d7688e8
7
+ data.tar.gz: d3547e481e40e1802f78377797f44ff38401b0e4026c049590dfc9e94a611af79def1bdd5c1b130197e1057a78bccee386dc211f00af3f73bb7ce058bb7cfdfc
data/CHANGES.md CHANGED
@@ -1,6 +1,31 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2021-08-25] Version 5.58.1
5
+ ---------------------------
6
+ **Api**
7
+ - Add Programmabled Voice SIP Refer call transfers (`calls-transfers`) to usage records
8
+ - Add Flex Voice Usage category (`flex-usage`) to usage records
9
+
10
+ **Conversations**
11
+ - Add `Order` query parameter to Message resource read operation
12
+
13
+ **Insights**
14
+ - Added `partial` to enum processing_state_request
15
+ - Added abnormal session filter in Call Summaries
16
+
17
+ **Messaging**
18
+ - Add brand_registration_sid as an optional query param for us_app_to_person_usecase api
19
+
20
+ **Pricing**
21
+ - add trunking_numbers resource (v2)
22
+ - add trunking_country resource (v2)
23
+
24
+ **Verify**
25
+ - Changed to private beta the `TemplateSid` optional parameter on Verification creation.
26
+ - Added the optional parameter `Order` to the list Challenges endpoint to define the list order.
27
+
28
+
4
29
  [2021-08-11] Version 5.58.0
5
30
  ---------------------------
6
31
  **Library - Chore**
data/README.md CHANGED
@@ -35,13 +35,13 @@ This library supports the following Ruby implementations:
35
35
  To install using [Bundler][bundler] grab the latest stable version:
36
36
 
37
37
  ```ruby
38
- gem 'twilio-ruby', '~> 5.58.0'
38
+ gem 'twilio-ruby', '~> 5.58.1'
39
39
  ```
40
40
 
41
41
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
42
42
 
43
43
  ```bash
44
- gem install twilio-ruby -v 5.58.0
44
+ gem install twilio-ruby -v 5.58.1
45
45
  ```
46
46
 
47
47
  To build and install the development branch yourself from the latest source:
@@ -63,6 +63,8 @@ module Twilio
63
63
  # Lists MessageInstance records from the API as a list.
64
64
  # Unlike stream(), this operation is eager and will load `limit` records into
65
65
  # memory before returning.
66
+ # @param [message.OrderType] order The sort order of the returned messages. Can
67
+ # be: `asc` (ascending) or `desc` (descending), with `asc` as the default.
66
68
  # @param [Integer] limit Upper limit for the number of records to return. stream()
67
69
  # guarantees to never return more than limit. Default is no limit
68
70
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -70,14 +72,16 @@ module Twilio
70
72
  # but a limit is defined, stream() will attempt to read the limit with the most
71
73
  # efficient page size, i.e. min(limit, 1000)
72
74
  # @return [Array] Array of up to limit results
73
- def list(limit: nil, page_size: nil)
74
- self.stream(limit: limit, page_size: page_size).entries
75
+ def list(order: :unset, limit: nil, page_size: nil)
76
+ self.stream(order: order, limit: limit, page_size: page_size).entries
75
77
  end
76
78
 
77
79
  ##
78
80
  # Streams MessageInstance records from the API as an Enumerable.
79
81
  # This operation lazily loads records as efficiently as possible until the limit
80
82
  # is reached.
83
+ # @param [message.OrderType] order The sort order of the returned messages. Can
84
+ # be: `asc` (ascending) or `desc` (descending), with `asc` as the default.
81
85
  # @param [Integer] limit Upper limit for the number of records to return. stream()
82
86
  # guarantees to never return more than limit. Default is no limit.
83
87
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -85,10 +89,10 @@ module Twilio
85
89
  # but a limit is defined, stream() will attempt to read the limit with the most
86
90
  # efficient page size, i.e. min(limit, 1000)
87
91
  # @return [Enumerable] Enumerable that will yield up to limit results
88
- def stream(limit: nil, page_size: nil)
92
+ def stream(order: :unset, limit: nil, page_size: nil)
89
93
  limits = @version.read_limits(limit, page_size)
90
94
 
91
- page = self.page(page_size: limits[:page_size], )
95
+ page = self.page(order: order, page_size: limits[:page_size], )
92
96
 
93
97
  @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
94
98
  end
@@ -110,12 +114,15 @@ module Twilio
110
114
  ##
111
115
  # Retrieve a single page of MessageInstance records from the API.
112
116
  # Request is executed immediately.
117
+ # @param [message.OrderType] order The sort order of the returned messages. Can
118
+ # be: `asc` (ascending) or `desc` (descending), with `asc` as the default.
113
119
  # @param [String] page_token PageToken provided by the API
114
120
  # @param [Integer] page_number Page Number, this value is simply for client state
115
121
  # @param [Integer] page_size Number of records to return, defaults to 50
116
122
  # @return [Page] Page of MessageInstance
117
- def page(page_token: :unset, page_number: :unset, page_size: :unset)
123
+ def page(order: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
118
124
  params = Twilio::Values.of({
125
+ 'Order' => order,
119
126
  'PageToken' => page_token,
120
127
  'Page' => page_number,
121
128
  'PageSize' => page_size,
@@ -72,6 +72,8 @@ module Twilio
72
72
  # Lists MessageInstance records from the API as a list.
73
73
  # Unlike stream(), this operation is eager and will load `limit` records into
74
74
  # memory before returning.
75
+ # @param [message.OrderType] order The sort order of the returned messages. Can
76
+ # be: `asc` (ascending) or `desc` (descending), with `asc` as the default.
75
77
  # @param [Integer] limit Upper limit for the number of records to return. stream()
76
78
  # guarantees to never return more than limit. Default is no limit
77
79
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -79,14 +81,16 @@ module Twilio
79
81
  # but a limit is defined, stream() will attempt to read the limit with the most
80
82
  # efficient page size, i.e. min(limit, 1000)
81
83
  # @return [Array] Array of up to limit results
82
- def list(limit: nil, page_size: nil)
83
- self.stream(limit: limit, page_size: page_size).entries
84
+ def list(order: :unset, limit: nil, page_size: nil)
85
+ self.stream(order: order, limit: limit, page_size: page_size).entries
84
86
  end
85
87
 
86
88
  ##
87
89
  # Streams MessageInstance records from the API as an Enumerable.
88
90
  # This operation lazily loads records as efficiently as possible until the limit
89
91
  # is reached.
92
+ # @param [message.OrderType] order The sort order of the returned messages. Can
93
+ # be: `asc` (ascending) or `desc` (descending), with `asc` as the default.
90
94
  # @param [Integer] limit Upper limit for the number of records to return. stream()
91
95
  # guarantees to never return more than limit. Default is no limit.
92
96
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -94,10 +98,10 @@ module Twilio
94
98
  # but a limit is defined, stream() will attempt to read the limit with the most
95
99
  # efficient page size, i.e. min(limit, 1000)
96
100
  # @return [Enumerable] Enumerable that will yield up to limit results
97
- def stream(limit: nil, page_size: nil)
101
+ def stream(order: :unset, limit: nil, page_size: nil)
98
102
  limits = @version.read_limits(limit, page_size)
99
103
 
100
- page = self.page(page_size: limits[:page_size], )
104
+ page = self.page(order: order, page_size: limits[:page_size], )
101
105
 
102
106
  @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
103
107
  end
@@ -119,12 +123,15 @@ module Twilio
119
123
  ##
120
124
  # Retrieve a single page of MessageInstance records from the API.
121
125
  # Request is executed immediately.
126
+ # @param [message.OrderType] order The sort order of the returned messages. Can
127
+ # be: `asc` (ascending) or `desc` (descending), with `asc` as the default.
122
128
  # @param [String] page_token PageToken provided by the API
123
129
  # @param [Integer] page_number Page Number, this value is simply for client state
124
130
  # @param [Integer] page_size Number of records to return, defaults to 50
125
131
  # @return [Page] Page of MessageInstance
126
- def page(page_token: :unset, page_number: :unset, page_size: :unset)
132
+ def page(order: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
127
133
  params = Twilio::Values.of({
134
+ 'Order' => order,
128
135
  'PageToken' => page_token,
129
136
  'Page' => page_number,
130
137
  'PageSize' => page_size,
@@ -45,6 +45,7 @@ module Twilio
45
45
  # processing_state
46
46
  # @param [call_summaries.SortBy] sort_by The sort_by
47
47
  # @param [String] subaccount The subaccount
48
+ # @param [Boolean] abnormal_session The abnormal_session
48
49
  # @param [Integer] limit Upper limit for the number of records to return. stream()
49
50
  # guarantees to never return more than limit. Default is no limit
50
51
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -52,7 +53,7 @@ module Twilio
52
53
  # but a limit is defined, stream() will attempt to read the limit with the most
53
54
  # efficient page size, i.e. min(limit, 1000)
54
55
  # @return [Array] Array of up to limit results
55
- def list(from: :unset, to: :unset, from_carrier: :unset, to_carrier: :unset, from_country_code: :unset, to_country_code: :unset, branded: :unset, verified_caller: :unset, has_tag: :unset, start_time: :unset, end_time: :unset, call_type: :unset, call_state: :unset, direction: :unset, processing_state: :unset, sort_by: :unset, subaccount: :unset, limit: nil, page_size: nil)
56
+ def list(from: :unset, to: :unset, from_carrier: :unset, to_carrier: :unset, from_country_code: :unset, to_country_code: :unset, branded: :unset, verified_caller: :unset, has_tag: :unset, start_time: :unset, end_time: :unset, call_type: :unset, call_state: :unset, direction: :unset, processing_state: :unset, sort_by: :unset, subaccount: :unset, abnormal_session: :unset, limit: nil, page_size: nil)
56
57
  self.stream(
57
58
  from: from,
58
59
  to: to,
@@ -71,6 +72,7 @@ module Twilio
71
72
  processing_state: processing_state,
72
73
  sort_by: sort_by,
73
74
  subaccount: subaccount,
75
+ abnormal_session: abnormal_session,
74
76
  limit: limit,
75
77
  page_size: page_size
76
78
  ).entries
@@ -98,6 +100,7 @@ module Twilio
98
100
  # processing_state
99
101
  # @param [call_summaries.SortBy] sort_by The sort_by
100
102
  # @param [String] subaccount The subaccount
103
+ # @param [Boolean] abnormal_session The abnormal_session
101
104
  # @param [Integer] limit Upper limit for the number of records to return. stream()
102
105
  # guarantees to never return more than limit. Default is no limit.
103
106
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -105,7 +108,7 @@ module Twilio
105
108
  # but a limit is defined, stream() will attempt to read the limit with the most
106
109
  # efficient page size, i.e. min(limit, 1000)
107
110
  # @return [Enumerable] Enumerable that will yield up to limit results
108
- def stream(from: :unset, to: :unset, from_carrier: :unset, to_carrier: :unset, from_country_code: :unset, to_country_code: :unset, branded: :unset, verified_caller: :unset, has_tag: :unset, start_time: :unset, end_time: :unset, call_type: :unset, call_state: :unset, direction: :unset, processing_state: :unset, sort_by: :unset, subaccount: :unset, limit: nil, page_size: nil)
111
+ def stream(from: :unset, to: :unset, from_carrier: :unset, to_carrier: :unset, from_country_code: :unset, to_country_code: :unset, branded: :unset, verified_caller: :unset, has_tag: :unset, start_time: :unset, end_time: :unset, call_type: :unset, call_state: :unset, direction: :unset, processing_state: :unset, sort_by: :unset, subaccount: :unset, abnormal_session: :unset, limit: nil, page_size: nil)
109
112
  limits = @version.read_limits(limit, page_size)
110
113
 
111
114
  page = self.page(
@@ -126,6 +129,7 @@ module Twilio
126
129
  processing_state: processing_state,
127
130
  sort_by: sort_by,
128
131
  subaccount: subaccount,
132
+ abnormal_session: abnormal_session,
129
133
  page_size: limits[:page_size],
130
134
  )
131
135
 
@@ -167,11 +171,12 @@ module Twilio
167
171
  # processing_state
168
172
  # @param [call_summaries.SortBy] sort_by The sort_by
169
173
  # @param [String] subaccount The subaccount
174
+ # @param [Boolean] abnormal_session The abnormal_session
170
175
  # @param [String] page_token PageToken provided by the API
171
176
  # @param [Integer] page_number Page Number, this value is simply for client state
172
177
  # @param [Integer] page_size Number of records to return, defaults to 50
173
178
  # @return [Page] Page of CallSummariesInstance
174
- def page(from: :unset, to: :unset, from_carrier: :unset, to_carrier: :unset, from_country_code: :unset, to_country_code: :unset, branded: :unset, verified_caller: :unset, has_tag: :unset, start_time: :unset, end_time: :unset, call_type: :unset, call_state: :unset, direction: :unset, processing_state: :unset, sort_by: :unset, subaccount: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
179
+ def page(from: :unset, to: :unset, from_carrier: :unset, to_carrier: :unset, from_country_code: :unset, to_country_code: :unset, branded: :unset, verified_caller: :unset, has_tag: :unset, start_time: :unset, end_time: :unset, call_type: :unset, call_state: :unset, direction: :unset, processing_state: :unset, sort_by: :unset, subaccount: :unset, abnormal_session: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
175
180
  params = Twilio::Values.of({
176
181
  'From' => Twilio.serialize_list(from) { |e| e },
177
182
  'To' => Twilio.serialize_list(to) { |e| e },
@@ -190,6 +195,7 @@ module Twilio
190
195
  'ProcessingState' => processing_state,
191
196
  'SortBy' => sort_by,
192
197
  'Subaccount' => subaccount,
198
+ 'AbnormalSession' => abnormal_session,
193
199
  'PageToken' => page_token,
194
200
  'Page' => page_number,
195
201
  'PageSize' => page_size,
@@ -30,9 +30,13 @@ module Twilio
30
30
 
31
31
  ##
32
32
  # Fetch the UsAppToPersonUsecaseInstance
33
+ # @param [String] brand_registration_sid The unique string to identify the A2P
34
+ # brand.
33
35
  # @return [UsAppToPersonUsecaseInstance] Fetched UsAppToPersonUsecaseInstance
34
- def fetch
35
- payload = @version.fetch('GET', @uri)
36
+ def fetch(brand_registration_sid: :unset)
37
+ params = Twilio::Values.of({'BrandRegistrationSid' => brand_registration_sid, })
38
+
39
+ payload = @version.fetch('GET', @uri, params: params)
36
40
 
37
41
  UsAppToPersonUsecaseInstance.new(
38
42
  @version,
@@ -0,0 +1,280 @@
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 Pricing < Domain
12
+ class V2 < Version
13
+ class CountryList < ListResource
14
+ ##
15
+ # Initialize the CountryList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [CountryList] CountryList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ @uri = "/Trunking/Countries"
24
+ end
25
+
26
+ ##
27
+ # Lists CountryInstance records from the API as a list.
28
+ # Unlike stream(), this operation is eager and will load `limit` records into
29
+ # memory before returning.
30
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
31
+ # guarantees to never return more than limit. Default is no limit
32
+ # @param [Integer] page_size Number of records to fetch per request, when
33
+ # not set will use the default value of 50 records. If no page_size is defined
34
+ # but a limit is defined, stream() will attempt to read the limit with the most
35
+ # efficient page size, i.e. min(limit, 1000)
36
+ # @return [Array] Array of up to limit results
37
+ def list(limit: nil, page_size: nil)
38
+ self.stream(limit: limit, page_size: page_size).entries
39
+ end
40
+
41
+ ##
42
+ # Streams CountryInstance records from the API as an Enumerable.
43
+ # This operation lazily loads records as efficiently as possible until the limit
44
+ # is reached.
45
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
46
+ # guarantees to never return more than limit. Default is no limit.
47
+ # @param [Integer] page_size Number of records to fetch per request, when
48
+ # not set will use the default value of 50 records. If no page_size is defined
49
+ # but a limit is defined, stream() will attempt to read the limit with the most
50
+ # efficient page size, i.e. min(limit, 1000)
51
+ # @return [Enumerable] Enumerable that will yield up to limit results
52
+ def stream(limit: nil, page_size: nil)
53
+ limits = @version.read_limits(limit, page_size)
54
+
55
+ page = self.page(page_size: limits[:page_size], )
56
+
57
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
58
+ end
59
+
60
+ ##
61
+ # When passed a block, yields CountryInstance records from the API.
62
+ # This operation lazily loads records as efficiently as possible until the limit
63
+ # is reached.
64
+ def each
65
+ limits = @version.read_limits
66
+
67
+ page = self.page(page_size: limits[:page_size], )
68
+
69
+ @version.stream(page,
70
+ limit: limits[:limit],
71
+ page_limit: limits[:page_limit]).each {|x| yield x}
72
+ end
73
+
74
+ ##
75
+ # Retrieve a single page of CountryInstance records from the API.
76
+ # Request is executed immediately.
77
+ # @param [String] page_token PageToken provided by the API
78
+ # @param [Integer] page_number Page Number, this value is simply for client state
79
+ # @param [Integer] page_size Number of records to return, defaults to 50
80
+ # @return [Page] Page of CountryInstance
81
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
82
+ params = Twilio::Values.of({
83
+ 'PageToken' => page_token,
84
+ 'Page' => page_number,
85
+ 'PageSize' => page_size,
86
+ })
87
+
88
+ response = @version.page('GET', @uri, params: params)
89
+
90
+ CountryPage.new(@version, response, @solution)
91
+ end
92
+
93
+ ##
94
+ # Retrieve a single page of CountryInstance records from the API.
95
+ # Request is executed immediately.
96
+ # @param [String] target_url API-generated URL for the requested results page
97
+ # @return [Page] Page of CountryInstance
98
+ def get_page(target_url)
99
+ response = @version.domain.request(
100
+ 'GET',
101
+ target_url
102
+ )
103
+ CountryPage.new(@version, response, @solution)
104
+ end
105
+
106
+ ##
107
+ # Provide a user friendly representation
108
+ def to_s
109
+ '#<Twilio.Pricing.V2.CountryList>'
110
+ end
111
+ end
112
+
113
+ class CountryPage < Page
114
+ ##
115
+ # Initialize the CountryPage
116
+ # @param [Version] version Version that contains the resource
117
+ # @param [Response] response Response from the API
118
+ # @param [Hash] solution Path solution for the resource
119
+ # @return [CountryPage] CountryPage
120
+ def initialize(version, response, solution)
121
+ super(version, response)
122
+
123
+ # Path Solution
124
+ @solution = solution
125
+ end
126
+
127
+ ##
128
+ # Build an instance of CountryInstance
129
+ # @param [Hash] payload Payload response from the API
130
+ # @return [CountryInstance] CountryInstance
131
+ def get_instance(payload)
132
+ CountryInstance.new(@version, payload, )
133
+ end
134
+
135
+ ##
136
+ # Provide a user friendly representation
137
+ def to_s
138
+ '<Twilio.Pricing.V2.CountryPage>'
139
+ end
140
+ end
141
+
142
+ class CountryContext < InstanceContext
143
+ ##
144
+ # Initialize the CountryContext
145
+ # @param [Version] version Version that contains the resource
146
+ # @param [String] iso_country The {ISO country
147
+ # code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] of the origin-based
148
+ # voice pricing information to fetch.
149
+ # @return [CountryContext] CountryContext
150
+ def initialize(version, iso_country)
151
+ super(version)
152
+
153
+ # Path Solution
154
+ @solution = {iso_country: iso_country, }
155
+ @uri = "/Trunking/Countries/#{@solution[:iso_country]}"
156
+ end
157
+
158
+ ##
159
+ # Fetch the CountryInstance
160
+ # @return [CountryInstance] Fetched CountryInstance
161
+ def fetch
162
+ payload = @version.fetch('GET', @uri)
163
+
164
+ CountryInstance.new(@version, payload, iso_country: @solution[:iso_country], )
165
+ end
166
+
167
+ ##
168
+ # Provide a user friendly representation
169
+ def to_s
170
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
171
+ "#<Twilio.Pricing.V2.CountryContext #{context}>"
172
+ end
173
+
174
+ ##
175
+ # Provide a detailed, user friendly representation
176
+ def inspect
177
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
178
+ "#<Twilio.Pricing.V2.CountryContext #{context}>"
179
+ end
180
+ end
181
+
182
+ class CountryInstance < InstanceResource
183
+ ##
184
+ # Initialize the CountryInstance
185
+ # @param [Version] version Version that contains the resource
186
+ # @param [Hash] payload payload that contains response from Twilio
187
+ # @param [String] iso_country The {ISO country
188
+ # code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] of the origin-based
189
+ # voice pricing information to fetch.
190
+ # @return [CountryInstance] CountryInstance
191
+ def initialize(version, payload, iso_country: nil)
192
+ super(version)
193
+
194
+ # Marshaled Properties
195
+ @properties = {
196
+ 'country' => payload['country'],
197
+ 'iso_country' => payload['iso_country'],
198
+ 'terminating_prefix_prices' => payload['terminating_prefix_prices'],
199
+ 'originating_call_prices' => payload['originating_call_prices'],
200
+ 'price_unit' => payload['price_unit'],
201
+ 'url' => payload['url'],
202
+ }
203
+
204
+ # Context
205
+ @instance_context = nil
206
+ @params = {'iso_country' => iso_country || @properties['iso_country'], }
207
+ end
208
+
209
+ ##
210
+ # Generate an instance context for the instance, the context is capable of
211
+ # performing various actions. All instance actions are proxied to the context
212
+ # @return [CountryContext] CountryContext for this CountryInstance
213
+ def context
214
+ unless @instance_context
215
+ @instance_context = CountryContext.new(@version, @params['iso_country'], )
216
+ end
217
+ @instance_context
218
+ end
219
+
220
+ ##
221
+ # @return [String] The name of the country
222
+ def country
223
+ @properties['country']
224
+ end
225
+
226
+ ##
227
+ # @return [String] The ISO country code
228
+ def iso_country
229
+ @properties['iso_country']
230
+ end
231
+
232
+ ##
233
+ # @return [Array[String]] The list of TerminatingPrefixPrice records
234
+ def terminating_prefix_prices
235
+ @properties['terminating_prefix_prices']
236
+ end
237
+
238
+ ##
239
+ # @return [Array[String]] The list of OriginatingCallPrice records
240
+ def originating_call_prices
241
+ @properties['originating_call_prices']
242
+ end
243
+
244
+ ##
245
+ # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy)
246
+ def price_unit
247
+ @properties['price_unit']
248
+ end
249
+
250
+ ##
251
+ # @return [String] The absolute URL of the resource
252
+ def url
253
+ @properties['url']
254
+ end
255
+
256
+ ##
257
+ # Fetch the CountryInstance
258
+ # @return [CountryInstance] Fetched CountryInstance
259
+ def fetch
260
+ context.fetch
261
+ end
262
+
263
+ ##
264
+ # Provide a user friendly representation
265
+ def to_s
266
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
267
+ "<Twilio.Pricing.V2.CountryInstance #{values}>"
268
+ end
269
+
270
+ ##
271
+ # Provide a detailed, user friendly representation
272
+ def inspect
273
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
274
+ "<Twilio.Pricing.V2.CountryInstance #{values}>"
275
+ end
276
+ end
277
+ end
278
+ end
279
+ end
280
+ end
@@ -0,0 +1,225 @@
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 Pricing < Domain
12
+ class V2 < Version
13
+ class NumberList < ListResource
14
+ ##
15
+ # Initialize the NumberList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [NumberList] NumberList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ end
24
+
25
+ ##
26
+ # Provide a user friendly representation
27
+ def to_s
28
+ '#<Twilio.Pricing.V2.NumberList>'
29
+ end
30
+ end
31
+
32
+ class NumberPage < Page
33
+ ##
34
+ # Initialize the NumberPage
35
+ # @param [Version] version Version that contains the resource
36
+ # @param [Response] response Response from the API
37
+ # @param [Hash] solution Path solution for the resource
38
+ # @return [NumberPage] NumberPage
39
+ def initialize(version, response, solution)
40
+ super(version, response)
41
+
42
+ # Path Solution
43
+ @solution = solution
44
+ end
45
+
46
+ ##
47
+ # Build an instance of NumberInstance
48
+ # @param [Hash] payload Payload response from the API
49
+ # @return [NumberInstance] NumberInstance
50
+ def get_instance(payload)
51
+ NumberInstance.new(@version, payload, )
52
+ end
53
+
54
+ ##
55
+ # Provide a user friendly representation
56
+ def to_s
57
+ '<Twilio.Pricing.V2.NumberPage>'
58
+ end
59
+ end
60
+
61
+ class NumberContext < InstanceContext
62
+ ##
63
+ # Initialize the NumberContext
64
+ # @param [Version] version Version that contains the resource
65
+ # @param [String] destination_number The destination phone number, in
66
+ # {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, for which to
67
+ # fetch the origin-based voice pricing information. E.164 format consists of a +
68
+ # followed by the country code and subscriber number.
69
+ # @return [NumberContext] NumberContext
70
+ def initialize(version, destination_number)
71
+ super(version)
72
+
73
+ # Path Solution
74
+ @solution = {destination_number: destination_number, }
75
+ @uri = "/Trunking/Numbers/#{CGI.escape(@solution[:destination_number]).gsub("+", "%20")}"
76
+ end
77
+
78
+ ##
79
+ # Fetch the NumberInstance
80
+ # @param [String] origination_number The origination phone number, in
81
+ # {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, for which to
82
+ # fetch the origin-based voice pricing information. E.164 format consists of a +
83
+ # followed by the country code and subscriber number.
84
+ # @return [NumberInstance] Fetched NumberInstance
85
+ def fetch(origination_number: :unset)
86
+ params = Twilio::Values.of({'OriginationNumber' => origination_number, })
87
+
88
+ payload = @version.fetch('GET', @uri, params: params)
89
+
90
+ NumberInstance.new(@version, payload, destination_number: @solution[:destination_number], )
91
+ end
92
+
93
+ ##
94
+ # Provide a user friendly representation
95
+ def to_s
96
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
97
+ "#<Twilio.Pricing.V2.NumberContext #{context}>"
98
+ end
99
+
100
+ ##
101
+ # Provide a detailed, user friendly representation
102
+ def inspect
103
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
104
+ "#<Twilio.Pricing.V2.NumberContext #{context}>"
105
+ end
106
+ end
107
+
108
+ class NumberInstance < InstanceResource
109
+ ##
110
+ # Initialize the NumberInstance
111
+ # @param [Version] version Version that contains the resource
112
+ # @param [Hash] payload payload that contains response from Twilio
113
+ # @param [String] destination_number The destination phone number, in
114
+ # {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, for which to
115
+ # fetch the origin-based voice pricing information. E.164 format consists of a +
116
+ # followed by the country code and subscriber number.
117
+ # @return [NumberInstance] NumberInstance
118
+ def initialize(version, payload, destination_number: nil)
119
+ super(version)
120
+
121
+ # Marshaled Properties
122
+ @properties = {
123
+ 'destination_number' => payload['destination_number'],
124
+ 'origination_number' => payload['origination_number'],
125
+ 'country' => payload['country'],
126
+ 'iso_country' => payload['iso_country'],
127
+ 'terminating_prefix_prices' => payload['terminating_prefix_prices'],
128
+ 'originating_call_price' => payload['originating_call_price'],
129
+ 'price_unit' => payload['price_unit'],
130
+ 'url' => payload['url'],
131
+ }
132
+
133
+ # Context
134
+ @instance_context = nil
135
+ @params = {'destination_number' => destination_number || @properties['destination_number'], }
136
+ end
137
+
138
+ ##
139
+ # Generate an instance context for the instance, the context is capable of
140
+ # performing various actions. All instance actions are proxied to the context
141
+ # @return [NumberContext] NumberContext for this NumberInstance
142
+ def context
143
+ unless @instance_context
144
+ @instance_context = NumberContext.new(@version, @params['destination_number'], )
145
+ end
146
+ @instance_context
147
+ end
148
+
149
+ ##
150
+ # @return [String] The destination phone number, in E.164 format
151
+ def destination_number
152
+ @properties['destination_number']
153
+ end
154
+
155
+ ##
156
+ # @return [String] The origination phone number, in E.164 format
157
+ def origination_number
158
+ @properties['origination_number']
159
+ end
160
+
161
+ ##
162
+ # @return [String] The name of the country
163
+ def country
164
+ @properties['country']
165
+ end
166
+
167
+ ##
168
+ # @return [String] The ISO country code
169
+ def iso_country
170
+ @properties['iso_country']
171
+ end
172
+
173
+ ##
174
+ # @return [Array[String]] The terminating_prefix_prices
175
+ def terminating_prefix_prices
176
+ @properties['terminating_prefix_prices']
177
+ end
178
+
179
+ ##
180
+ # @return [String] The OriginatingCallPrice record
181
+ def originating_call_price
182
+ @properties['originating_call_price']
183
+ end
184
+
185
+ ##
186
+ # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy)
187
+ def price_unit
188
+ @properties['price_unit']
189
+ end
190
+
191
+ ##
192
+ # @return [String] The absolute URL of the resource
193
+ def url
194
+ @properties['url']
195
+ end
196
+
197
+ ##
198
+ # Fetch the NumberInstance
199
+ # @param [String] origination_number The origination phone number, in
200
+ # {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, for which to
201
+ # fetch the origin-based voice pricing information. E.164 format consists of a +
202
+ # followed by the country code and subscriber number.
203
+ # @return [NumberInstance] Fetched NumberInstance
204
+ def fetch(origination_number: :unset)
205
+ context.fetch(origination_number: origination_number, )
206
+ end
207
+
208
+ ##
209
+ # Provide a user friendly representation
210
+ def to_s
211
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
212
+ "<Twilio.Pricing.V2.NumberInstance #{values}>"
213
+ end
214
+
215
+ ##
216
+ # Provide a detailed, user friendly representation
217
+ def inspect
218
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
219
+ "<Twilio.Pricing.V2.NumberInstance #{values}>"
220
+ end
221
+ end
222
+ end
223
+ end
224
+ end
225
+ end
@@ -15,9 +15,46 @@ module Twilio
15
15
  def initialize(domain)
16
16
  super
17
17
  @version = 'v2'
18
+ @countries = nil
19
+ @numbers = nil
18
20
  @voice = nil
19
21
  end
20
22
 
23
+ ##
24
+ # @param [String] iso_country The {ISO country
25
+ # code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] of the origin-based
26
+ # voice pricing information to fetch.
27
+ # @return [Twilio::REST::Pricing::V2::CountryContext] if iso_country was passed.
28
+ # @return [Twilio::REST::Pricing::V2::CountryList]
29
+ def countries(iso_country=:unset)
30
+ if iso_country.nil?
31
+ raise ArgumentError, 'iso_country cannot be nil'
32
+ end
33
+ if iso_country == :unset
34
+ @countries ||= CountryList.new self
35
+ else
36
+ CountryContext.new(self, iso_country)
37
+ end
38
+ end
39
+
40
+ ##
41
+ # @param [String] destination_number The destination phone number, in
42
+ # {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, for which to
43
+ # fetch the origin-based voice pricing information. E.164 format consists of a +
44
+ # followed by the country code and subscriber number.
45
+ # @return [Twilio::REST::Pricing::V2::NumberContext] if destination_number was passed.
46
+ # @return [Twilio::REST::Pricing::V2::NumberList]
47
+ def numbers(destination_number=:unset)
48
+ if destination_number.nil?
49
+ raise ArgumentError, 'destination_number cannot be nil'
50
+ end
51
+ if destination_number == :unset
52
+ @numbers ||= NumberList.new self
53
+ else
54
+ NumberContext.new(self, destination_number)
55
+ end
56
+ end
57
+
21
58
  ##
22
59
  # @return [Twilio::REST::Pricing::V2::VoiceContext]
23
60
  def voice
@@ -53,6 +53,25 @@ module Twilio
53
53
  self.v2.voice()
54
54
  end
55
55
 
56
+ ##
57
+ # @param [String] iso_country The {ISO country
58
+ # code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2].
59
+ # @return [Twilio::REST::Pricing::V2::CountryInstance] if iso_country was passed.
60
+ # @return [Twilio::REST::Pricing::V2::CountryList]
61
+ def countries(iso_country=:unset)
62
+ self.v2.countries(iso_country)
63
+ end
64
+
65
+ ##
66
+ # @param [String] destination_number The destination phone number in
67
+ # {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, which consists
68
+ # of a + followed by the country code and subscriber number.
69
+ # @return [Twilio::REST::Pricing::V2::NumberInstance] if destination_number was passed.
70
+ # @return [Twilio::REST::Pricing::V2::NumberList]
71
+ def numbers(destination_number=:unset)
72
+ self.v2.numbers(destination_number)
73
+ end
74
+
56
75
  ##
57
76
  # Provide a user friendly representation
58
77
  def to_s
@@ -81,6 +81,9 @@ module Twilio
81
81
  # @param [String] factor_sid The unique SID identifier of the Factor.
82
82
  # @param [challenge.ChallengeStatuses] status The Status of the Challenges to
83
83
  # fetch. One of `pending`, `expired`, `approved` or `denied`.
84
+ # @param [challenge.ListOrders] order The desired sort order of the Challenges
85
+ # list. One of `asc` or `desc` for ascending and descending respectively. Defaults
86
+ # to `asc`.
84
87
  # @param [Integer] limit Upper limit for the number of records to return. stream()
85
88
  # guarantees to never return more than limit. Default is no limit
86
89
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -88,8 +91,14 @@ module Twilio
88
91
  # but a limit is defined, stream() will attempt to read the limit with the most
89
92
  # efficient page size, i.e. min(limit, 1000)
90
93
  # @return [Array] Array of up to limit results
91
- def list(factor_sid: :unset, status: :unset, limit: nil, page_size: nil)
92
- self.stream(factor_sid: factor_sid, status: status, limit: limit, page_size: page_size).entries
94
+ def list(factor_sid: :unset, status: :unset, order: :unset, limit: nil, page_size: nil)
95
+ self.stream(
96
+ factor_sid: factor_sid,
97
+ status: status,
98
+ order: order,
99
+ limit: limit,
100
+ page_size: page_size
101
+ ).entries
93
102
  end
94
103
 
95
104
  ##
@@ -99,6 +108,9 @@ module Twilio
99
108
  # @param [String] factor_sid The unique SID identifier of the Factor.
100
109
  # @param [challenge.ChallengeStatuses] status The Status of the Challenges to
101
110
  # fetch. One of `pending`, `expired`, `approved` or `denied`.
111
+ # @param [challenge.ListOrders] order The desired sort order of the Challenges
112
+ # list. One of `asc` or `desc` for ascending and descending respectively. Defaults
113
+ # to `asc`.
102
114
  # @param [Integer] limit Upper limit for the number of records to return. stream()
103
115
  # guarantees to never return more than limit. Default is no limit.
104
116
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -106,10 +118,15 @@ module Twilio
106
118
  # but a limit is defined, stream() will attempt to read the limit with the most
107
119
  # efficient page size, i.e. min(limit, 1000)
108
120
  # @return [Enumerable] Enumerable that will yield up to limit results
109
- def stream(factor_sid: :unset, status: :unset, limit: nil, page_size: nil)
121
+ def stream(factor_sid: :unset, status: :unset, order: :unset, limit: nil, page_size: nil)
110
122
  limits = @version.read_limits(limit, page_size)
111
123
 
112
- page = self.page(factor_sid: factor_sid, status: status, page_size: limits[:page_size], )
124
+ page = self.page(
125
+ factor_sid: factor_sid,
126
+ status: status,
127
+ order: order,
128
+ page_size: limits[:page_size],
129
+ )
113
130
 
114
131
  @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
115
132
  end
@@ -134,14 +151,18 @@ module Twilio
134
151
  # @param [String] factor_sid The unique SID identifier of the Factor.
135
152
  # @param [challenge.ChallengeStatuses] status The Status of the Challenges to
136
153
  # fetch. One of `pending`, `expired`, `approved` or `denied`.
154
+ # @param [challenge.ListOrders] order The desired sort order of the Challenges
155
+ # list. One of `asc` or `desc` for ascending and descending respectively. Defaults
156
+ # to `asc`.
137
157
  # @param [String] page_token PageToken provided by the API
138
158
  # @param [Integer] page_number Page Number, this value is simply for client state
139
159
  # @param [Integer] page_size Number of records to return, defaults to 50
140
160
  # @return [Page] Page of ChallengeInstance
141
- def page(factor_sid: :unset, status: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
161
+ def page(factor_sid: :unset, status: :unset, order: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
142
162
  params = Twilio::Values.of({
143
163
  'FactorSid' => factor_sid,
144
164
  'Status' => status,
165
+ 'Order' => order,
145
166
  'PageToken' => page_token,
146
167
  'Page' => page_number,
147
168
  'PageSize' => page_size,
@@ -64,9 +64,8 @@ module Twilio
64
64
  # Hash}[https://developers.google.com/identity/sms-retriever/verify#computing_your_apps_hash_string]
65
65
  # to be appended at the end of your verification SMS body. Applies only to SMS.
66
66
  # Example SMS body: `<#> Your AppName verification code is: 1234 He42w354ol9`.
67
- # @param [String] template_sid The SID of the custom template to be used.
68
67
  # @return [VerificationInstance] Created VerificationInstance
69
- def create(to: nil, channel: nil, custom_friendly_name: :unset, custom_message: :unset, send_digits: :unset, locale: :unset, custom_code: :unset, amount: :unset, payee: :unset, rate_limits: :unset, channel_configuration: :unset, app_hash: :unset, template_sid: :unset)
68
+ def create(to: nil, channel: nil, custom_friendly_name: :unset, custom_message: :unset, send_digits: :unset, locale: :unset, custom_code: :unset, amount: :unset, payee: :unset, rate_limits: :unset, channel_configuration: :unset, app_hash: :unset)
70
69
  data = Twilio::Values.of({
71
70
  'To' => to,
72
71
  'Channel' => channel,
@@ -80,7 +79,6 @@ module Twilio
80
79
  'RateLimits' => Twilio.serialize_object(rate_limits),
81
80
  'ChannelConfiguration' => Twilio.serialize_object(channel_configuration),
82
81
  'AppHash' => app_hash,
83
- 'TemplateSid' => template_sid,
84
82
  })
85
83
 
86
84
  payload = @version.create('POST', @uri, data: data)
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '5.58.0'
2
+ VERSION = '5.58.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twilio-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.58.0
4
+ version: 5.58.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Twilio API Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-11 00:00:00.000000000 Z
11
+ date: 2021-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -575,6 +575,8 @@ files:
575
575
  - lib/twilio-ruby/rest/pricing/v1/voice/country.rb
576
576
  - lib/twilio-ruby/rest/pricing/v1/voice/number.rb
577
577
  - lib/twilio-ruby/rest/pricing/v2.rb
578
+ - lib/twilio-ruby/rest/pricing/v2/country.rb
579
+ - lib/twilio-ruby/rest/pricing/v2/number.rb
578
580
  - lib/twilio-ruby/rest/pricing/v2/voice.rb
579
581
  - lib/twilio-ruby/rest/pricing/v2/voice/country.rb
580
582
  - lib/twilio-ruby/rest/pricing/v2/voice/number.rb