twilio-ruby 5.52.0 → 5.67.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/pr-lint.yml +15 -0
  3. data/.github/workflows/test-and-deploy.yml +129 -0
  4. data/.gitignore +5 -1
  5. data/.rubocop.yml +1 -1
  6. data/.rubocop_todo.yml +91 -28
  7. data/CHANGES.md +563 -0
  8. data/Gemfile +1 -0
  9. data/Makefile +8 -11
  10. data/README.md +13 -6
  11. data/examples/examples.rb +1 -1
  12. data/lib/rack/twilio_webhook_authentication.rb +25 -1
  13. data/lib/twilio-ruby/http/http_client.rb +20 -4
  14. data/lib/twilio-ruby/http.rb +5 -0
  15. data/lib/twilio-ruby/jwt/access_token.rb +13 -0
  16. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +23 -23
  17. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +5 -5
  18. data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +8 -8
  19. data/lib/twilio-ruby/rest/api/v2010/account/call/siprec.rb +674 -0
  20. data/lib/twilio-ruby/rest/api/v2010/account/call/stream.rb +674 -0
  21. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +68 -14
  22. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +12 -8
  23. data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +1 -1
  24. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +11 -4
  25. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +11 -4
  26. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +11 -4
  27. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +17 -10
  28. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +18 -5
  29. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +34 -7
  30. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +11 -11
  31. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +11 -11
  32. data/lib/twilio-ruby/rest/bulkexports/v1/export/day.rb +0 -8
  33. data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +0 -6
  34. data/lib/twilio-ruby/rest/bulkexports/v1/export/job.rb +0 -8
  35. data/lib/twilio-ruby/rest/bulkexports/v1/export.rb +0 -8
  36. data/lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb +0 -8
  37. data/lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb +10 -4
  38. data/lib/twilio-ruby/rest/chat/v3/channel.rb +275 -0
  39. data/lib/twilio-ruby/rest/chat/v3.rb +48 -0
  40. data/lib/twilio-ruby/rest/chat.rb +16 -0
  41. data/lib/twilio-ruby/rest/client.rb +21 -12
  42. data/lib/twilio-ruby/rest/conversations/v1/address_configuration.rb +454 -0
  43. data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +12 -5
  44. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +7 -0
  45. data/lib/twilio-ruby/rest/conversations/v1/participant_conversation.rb +312 -0
  46. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb +18 -2
  47. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb +269 -0
  48. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +8 -0
  49. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +12 -5
  50. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +7 -0
  51. data/lib/twilio-ruby/rest/conversations/v1/service/participant_conversation.rb +324 -0
  52. data/lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb +466 -0
  53. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +44 -0
  54. data/lib/twilio-ruby/rest/conversations/v1/service.rb +23 -0
  55. data/lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb +442 -0
  56. data/lib/twilio-ruby/rest/conversations/v1/user.rb +35 -0
  57. data/lib/twilio-ruby/rest/conversations/v1.rb +24 -0
  58. data/lib/twilio-ruby/rest/conversations.rb +15 -0
  59. data/lib/twilio-ruby/rest/events/v1/event_type.rb +12 -5
  60. data/lib/twilio-ruby/rest/events/v1/sink.rb +41 -5
  61. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +28 -0
  62. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +55 -34
  63. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.rb +236 -0
  64. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.rb +330 -0
  65. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb +384 -0
  66. data/lib/twilio-ruby/rest/flex_api/v1/interaction.rb +233 -0
  67. data/lib/twilio-ruby/rest/flex_api/v1.rb +16 -0
  68. data/lib/twilio-ruby/rest/flex_api.rb +9 -0
  69. data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +258 -0
  70. data/lib/twilio-ruby/rest/{fax → frontline_api}/v1.rb +11 -11
  71. data/lib/twilio-ruby/rest/{fax.rb → frontline_api.rb} +11 -11
  72. data/lib/twilio-ruby/rest/insights/v1/annotation.rb +271 -0
  73. data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +434 -0
  74. data/lib/twilio-ruby/rest/insights/v1/conference/conference_participant.rb +474 -0
  75. data/lib/twilio-ruby/rest/insights/v1/conference.rb +512 -0
  76. data/lib/twilio-ruby/rest/insights/v1/setting.rb +215 -0
  77. data/lib/twilio-ruby/rest/insights/v1.rb +46 -0
  78. data/lib/twilio-ruby/rest/insights.rb +28 -0
  79. data/lib/twilio-ruby/rest/lookups/v2/phone_number.rb +268 -0
  80. data/lib/twilio-ruby/rest/lookups/v2.rb +45 -0
  81. data/lib/twilio-ruby/rest/lookups.rb +7 -0
  82. data/lib/twilio-ruby/rest/media/v1/media_processor.rb +397 -0
  83. data/lib/twilio-ruby/rest/media/v1/media_recording.rb +406 -0
  84. data/lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb +221 -0
  85. data/lib/twilio-ruby/rest/media/v1/player_streamer.rb +403 -0
  86. data/lib/twilio-ruby/rest/media/v1.rb +76 -0
  87. data/lib/twilio-ruby/rest/media.rb +65 -0
  88. data/lib/twilio-ruby/rest/{fax/v1/fax/fax_media.rb → messaging/v1/brand_registration/brand_vetting.rb} +134 -95
  89. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +127 -2
  90. data/lib/twilio-ruby/rest/messaging/v1/external_campaign.rb +7 -0
  91. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb +187 -20
  92. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person_usecase.rb +6 -2
  93. data/lib/twilio-ruby/rest/messaging/v1/service.rb +37 -5
  94. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.rb +268 -0
  95. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/replace_items.rb +188 -0
  96. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +128 -26
  97. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +7 -0
  98. data/lib/twilio-ruby/rest/pricing/v2/country.rb +280 -0
  99. data/lib/twilio-ruby/rest/pricing/v2/number.rb +225 -0
  100. data/lib/twilio-ruby/rest/pricing/v2.rb +37 -0
  101. data/lib/twilio-ruby/rest/pricing.rb +19 -0
  102. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +1 -1
  103. data/lib/twilio-ruby/rest/serverless/v1/service.rb +7 -0
  104. data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +1 -1
  105. data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +1 -1
  106. data/lib/twilio-ruby/rest/supersim/v1/esim_profile.rb +372 -0
  107. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +44 -55
  108. data/lib/twilio-ruby/rest/supersim/v1/{command.rb → ip_command.rb} +132 -84
  109. data/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb +231 -0
  110. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +30 -1
  111. data/lib/twilio-ruby/rest/supersim/v1/sms_command.rb +1 -1
  112. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +23 -9
  113. data/lib/twilio-ruby/rest/supersim/v1.rb +23 -7
  114. data/lib/twilio-ruby/rest/supersim.rb +15 -6
  115. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +7 -0
  116. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +7 -3
  117. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb +6 -2
  118. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +7 -3
  119. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +23 -11
  120. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb +4 -2
  121. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb +4 -2
  122. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +38 -22
  123. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +19 -3
  124. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +155 -10
  125. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb +12 -9
  126. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +74 -22
  127. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +34 -15
  128. data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +66 -31
  129. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +7 -3
  130. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +25 -7
  131. data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +24 -5
  132. data/lib/twilio-ruby/rest/verify/v2/service.rb +40 -11
  133. data/lib/twilio-ruby/rest/verify/v2/template.rb +206 -0
  134. data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +89 -21
  135. data/lib/twilio-ruby/rest/verify/v2/verification_attempts_summary.rb +234 -0
  136. data/lib/twilio-ruby/rest/verify/v2.rb +14 -0
  137. data/lib/twilio-ruby/rest/verify.rb +14 -2
  138. data/lib/twilio-ruby/rest/video/v1/composition.rb +21 -8
  139. data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +0 -8
  140. data/lib/twilio-ruby/rest/video/v1/recording.rb +21 -0
  141. data/lib/twilio-ruby/rest/video/v1/room/recording.rb +7 -0
  142. data/lib/twilio-ruby/rest/video/v1/room.rb +62 -5
  143. data/lib/twilio-ruby/rest/voice/v1/archived_call.rb +184 -0
  144. data/lib/twilio-ruby/rest/voice/v1.rb +21 -0
  145. data/lib/twilio-ruby/rest/voice.rb +8 -0
  146. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +3 -3
  147. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +16 -26
  148. data/lib/twilio-ruby/rest.rb +13 -0
  149. data/lib/twilio-ruby/twiml/voice_response.rb +727 -87
  150. data/lib/twilio-ruby/version.rb +1 -1
  151. data/lib/twilio-ruby.rb +6 -16
  152. data/sonar-project.properties +13 -0
  153. data/twilio-ruby.gemspec +1 -2
  154. metadata +59 -32
  155. data/.travis.yml +0 -45
  156. data/lib/twilio-ruby/rest/fax/v1/fax.rb +0 -536
  157. /data/lib/twilio-ruby/framework/{domain.rb → rest/domain.rb} +0 -0
  158. /data/lib/twilio-ruby/framework/{error.rb → rest/error.rb} +0 -0
  159. /data/lib/twilio-ruby/framework/{helper.rb → rest/helper.rb} +0 -0
  160. /data/lib/twilio-ruby/framework/{obsolete_client.rb → rest/obsolete_client.rb} +0 -0
  161. /data/lib/twilio-ruby/framework/{page.rb → rest/page.rb} +0 -0
  162. /data/lib/twilio-ruby/framework/{resource.rb → rest/resource.rb} +0 -0
  163. /data/lib/twilio-ruby/framework/{version.rb → rest/version.rb} +0 -0
@@ -34,12 +34,14 @@ module Twilio
34
34
  # status changes.
35
35
  # @param [String] regulation_sid The unique string of a regulation that is
36
36
  # associated to the Bundle resource.
37
- # @param [String] iso_country The ISO country code of the Bundle's phone number
38
- # country ownership request.
39
- # @param [bundle.EndUserType] end_user_type The type of End User of the Bundle
40
- # resource.
37
+ # @param [String] iso_country The {ISO country
38
+ # code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] of the Bundle's phone
39
+ # number country ownership request.
40
+ # @param [bundle.EndUserType] end_user_type The {type of End
41
+ # User}[https://www.twilio.com/docs/phone-numbers/regulatory/api/end-user-types]
42
+ # of the Bundle resource.
41
43
  # @param [String] number_type The type of phone number of the Bundle's ownership
42
- # request.
44
+ # request. Can be `local`, `mobile`, `national`, or `toll free`.
43
45
  # @return [BundleInstance] Created BundleInstance
44
46
  def create(friendly_name: nil, email: nil, status_callback: :unset, regulation_sid: :unset, iso_country: :unset, end_user_type: :unset, number_type: :unset)
45
47
  data = Twilio::Values.of({
@@ -62,14 +64,28 @@ module Twilio
62
64
  # Unlike stream(), this operation is eager and will load `limit` records into
63
65
  # memory before returning.
64
66
  # @param [bundle.Status] status The verification status of the Bundle resource.
67
+ # Please refer to {Bundle
68
+ # Statuses}[https://www.twilio.com/docs/phone-numbers/regulatory/api/bundles#bundle-statuses]
69
+ # for more details.
65
70
  # @param [String] friendly_name The string that you assigned to describe the
66
- # resource.
67
- # @param [String] regulation_sid The unique string of a regulation that is
68
- # associated to the Bundle resource.
69
- # @param [String] iso_country The ISO country code of the Bundle's phone number
70
- # country ownership request.
71
+ # resource. The column can contain 255 variable characters.
72
+ # @param [String] regulation_sid The unique string of a {Regulation
73
+ # resource}[https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations]
74
+ # that is associated to the Bundle resource.
75
+ # @param [String] iso_country The 2-digit {ISO country
76
+ # code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] of the Bundle's phone
77
+ # number country ownership request.
71
78
  # @param [String] number_type The type of phone number of the Bundle's ownership
72
- # request.
79
+ # request. Can be `local`, `mobile`, `national`, or `tollfree`.
80
+ # @param [Boolean] has_valid_until_date Indicates that the Bundle is a valid
81
+ # Bundle until a specified expiration date.
82
+ # @param [bundle.SortBy] sort_by Can be `valid-until` or `date-updated`. Defaults
83
+ # to `date-created`.
84
+ # @param [bundle.SortDirection] sort_direction Default is `DESC`. Can be `ASC` or
85
+ # `DESC`.
86
+ # @param [Time] valid_until_date_before Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well.
87
+ # @param [Time] valid_until_date Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well.
88
+ # @param [Time] valid_until_date_after Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well.
73
89
  # @param [Integer] limit Upper limit for the number of records to return. stream()
74
90
  # guarantees to never return more than limit. Default is no limit
75
91
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -77,13 +93,19 @@ module Twilio
77
93
  # but a limit is defined, stream() will attempt to read the limit with the most
78
94
  # efficient page size, i.e. min(limit, 1000)
79
95
  # @return [Array] Array of up to limit results
80
- def list(status: :unset, friendly_name: :unset, regulation_sid: :unset, iso_country: :unset, number_type: :unset, limit: nil, page_size: nil)
96
+ def list(status: :unset, friendly_name: :unset, regulation_sid: :unset, iso_country: :unset, number_type: :unset, has_valid_until_date: :unset, sort_by: :unset, sort_direction: :unset, valid_until_date_before: :unset, valid_until_date: :unset, valid_until_date_after: :unset, limit: nil, page_size: nil)
81
97
  self.stream(
82
98
  status: status,
83
99
  friendly_name: friendly_name,
84
100
  regulation_sid: regulation_sid,
85
101
  iso_country: iso_country,
86
102
  number_type: number_type,
103
+ has_valid_until_date: has_valid_until_date,
104
+ sort_by: sort_by,
105
+ sort_direction: sort_direction,
106
+ valid_until_date_before: valid_until_date_before,
107
+ valid_until_date: valid_until_date,
108
+ valid_until_date_after: valid_until_date_after,
87
109
  limit: limit,
88
110
  page_size: page_size
89
111
  ).entries
@@ -94,14 +116,28 @@ module Twilio
94
116
  # This operation lazily loads records as efficiently as possible until the limit
95
117
  # is reached.
96
118
  # @param [bundle.Status] status The verification status of the Bundle resource.
119
+ # Please refer to {Bundle
120
+ # Statuses}[https://www.twilio.com/docs/phone-numbers/regulatory/api/bundles#bundle-statuses]
121
+ # for more details.
97
122
  # @param [String] friendly_name The string that you assigned to describe the
98
- # resource.
99
- # @param [String] regulation_sid The unique string of a regulation that is
100
- # associated to the Bundle resource.
101
- # @param [String] iso_country The ISO country code of the Bundle's phone number
102
- # country ownership request.
123
+ # resource. The column can contain 255 variable characters.
124
+ # @param [String] regulation_sid The unique string of a {Regulation
125
+ # resource}[https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations]
126
+ # that is associated to the Bundle resource.
127
+ # @param [String] iso_country The 2-digit {ISO country
128
+ # code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] of the Bundle's phone
129
+ # number country ownership request.
103
130
  # @param [String] number_type The type of phone number of the Bundle's ownership
104
- # request.
131
+ # request. Can be `local`, `mobile`, `national`, or `tollfree`.
132
+ # @param [Boolean] has_valid_until_date Indicates that the Bundle is a valid
133
+ # Bundle until a specified expiration date.
134
+ # @param [bundle.SortBy] sort_by Can be `valid-until` or `date-updated`. Defaults
135
+ # to `date-created`.
136
+ # @param [bundle.SortDirection] sort_direction Default is `DESC`. Can be `ASC` or
137
+ # `DESC`.
138
+ # @param [Time] valid_until_date_before Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well.
139
+ # @param [Time] valid_until_date Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well.
140
+ # @param [Time] valid_until_date_after Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well.
105
141
  # @param [Integer] limit Upper limit for the number of records to return. stream()
106
142
  # guarantees to never return more than limit. Default is no limit.
107
143
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -109,7 +145,7 @@ module Twilio
109
145
  # but a limit is defined, stream() will attempt to read the limit with the most
110
146
  # efficient page size, i.e. min(limit, 1000)
111
147
  # @return [Enumerable] Enumerable that will yield up to limit results
112
- def stream(status: :unset, friendly_name: :unset, regulation_sid: :unset, iso_country: :unset, number_type: :unset, limit: nil, page_size: nil)
148
+ def stream(status: :unset, friendly_name: :unset, regulation_sid: :unset, iso_country: :unset, number_type: :unset, has_valid_until_date: :unset, sort_by: :unset, sort_direction: :unset, valid_until_date_before: :unset, valid_until_date: :unset, valid_until_date_after: :unset, limit: nil, page_size: nil)
113
149
  limits = @version.read_limits(limit, page_size)
114
150
 
115
151
  page = self.page(
@@ -118,6 +154,12 @@ module Twilio
118
154
  regulation_sid: regulation_sid,
119
155
  iso_country: iso_country,
120
156
  number_type: number_type,
157
+ has_valid_until_date: has_valid_until_date,
158
+ sort_by: sort_by,
159
+ sort_direction: sort_direction,
160
+ valid_until_date_before: valid_until_date_before,
161
+ valid_until_date: valid_until_date,
162
+ valid_until_date_after: valid_until_date_after,
121
163
  page_size: limits[:page_size],
122
164
  )
123
165
 
@@ -142,25 +184,45 @@ module Twilio
142
184
  # Retrieve a single page of BundleInstance records from the API.
143
185
  # Request is executed immediately.
144
186
  # @param [bundle.Status] status The verification status of the Bundle resource.
187
+ # Please refer to {Bundle
188
+ # Statuses}[https://www.twilio.com/docs/phone-numbers/regulatory/api/bundles#bundle-statuses]
189
+ # for more details.
145
190
  # @param [String] friendly_name The string that you assigned to describe the
146
- # resource.
147
- # @param [String] regulation_sid The unique string of a regulation that is
148
- # associated to the Bundle resource.
149
- # @param [String] iso_country The ISO country code of the Bundle's phone number
150
- # country ownership request.
191
+ # resource. The column can contain 255 variable characters.
192
+ # @param [String] regulation_sid The unique string of a {Regulation
193
+ # resource}[https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations]
194
+ # that is associated to the Bundle resource.
195
+ # @param [String] iso_country The 2-digit {ISO country
196
+ # code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] of the Bundle's phone
197
+ # number country ownership request.
151
198
  # @param [String] number_type The type of phone number of the Bundle's ownership
152
- # request.
199
+ # request. Can be `local`, `mobile`, `national`, or `tollfree`.
200
+ # @param [Boolean] has_valid_until_date Indicates that the Bundle is a valid
201
+ # Bundle until a specified expiration date.
202
+ # @param [bundle.SortBy] sort_by Can be `valid-until` or `date-updated`. Defaults
203
+ # to `date-created`.
204
+ # @param [bundle.SortDirection] sort_direction Default is `DESC`. Can be `ASC` or
205
+ # `DESC`.
206
+ # @param [Time] valid_until_date_before Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well.
207
+ # @param [Time] valid_until_date Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well.
208
+ # @param [Time] valid_until_date_after Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well.
153
209
  # @param [String] page_token PageToken provided by the API
154
210
  # @param [Integer] page_number Page Number, this value is simply for client state
155
211
  # @param [Integer] page_size Number of records to return, defaults to 50
156
212
  # @return [Page] Page of BundleInstance
157
- def page(status: :unset, friendly_name: :unset, regulation_sid: :unset, iso_country: :unset, number_type: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
213
+ def page(status: :unset, friendly_name: :unset, regulation_sid: :unset, iso_country: :unset, number_type: :unset, has_valid_until_date: :unset, sort_by: :unset, sort_direction: :unset, valid_until_date_before: :unset, valid_until_date: :unset, valid_until_date_after: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
158
214
  params = Twilio::Values.of({
159
215
  'Status' => status,
160
216
  'FriendlyName' => friendly_name,
161
217
  'RegulationSid' => regulation_sid,
162
218
  'IsoCountry' => iso_country,
163
219
  'NumberType' => number_type,
220
+ 'HasValidUntilDate' => has_valid_until_date,
221
+ 'SortBy' => sort_by,
222
+ 'SortDirection' => sort_direction,
223
+ 'ValidUntilDate<' => Twilio.serialize_iso8601_datetime(valid_until_date_before),
224
+ 'ValidUntilDate' => Twilio.serialize_iso8601_datetime(valid_until_date),
225
+ 'ValidUntilDate>' => Twilio.serialize_iso8601_datetime(valid_until_date_after),
164
226
  'PageToken' => page_token,
165
227
  'Page' => page_number,
166
228
  'PageSize' => page_size,
@@ -237,6 +299,8 @@ module Twilio
237
299
  # Dependents
238
300
  @evaluations = nil
239
301
  @item_assignments = nil
302
+ @bundle_copies = nil
303
+ @replace_items = nil
240
304
  end
241
305
 
242
306
  ##
@@ -314,6 +378,30 @@ module Twilio
314
378
  @item_assignments
315
379
  end
316
380
 
381
+ ##
382
+ # Access the bundle_copies
383
+ # @return [BundleCopyList]
384
+ # @return [BundleCopyContext]
385
+ def bundle_copies
386
+ unless @bundle_copies
387
+ @bundle_copies = BundleCopyList.new(@version, bundle_sid: @solution[:sid], )
388
+ end
389
+
390
+ @bundle_copies
391
+ end
392
+
393
+ ##
394
+ # Access the replace_items
395
+ # @return [ReplaceItemsList]
396
+ # @return [ReplaceItemsContext]
397
+ def replace_items
398
+ unless @replace_items
399
+ @replace_items = ReplaceItemsList.new(@version, bundle_sid: @solution[:sid], )
400
+ end
401
+
402
+ @replace_items
403
+ end
404
+
317
405
  ##
318
406
  # Provide a user friendly representation
319
407
  def to_s
@@ -491,6 +579,20 @@ module Twilio
491
579
  context.item_assignments
492
580
  end
493
581
 
582
+ ##
583
+ # Access the bundle_copies
584
+ # @return [bundle_copies] bundle_copies
585
+ def bundle_copies
586
+ context.bundle_copies
587
+ end
588
+
589
+ ##
590
+ # Access the replace_items
591
+ # @return [replace_items] replace_items
592
+ def replace_items
593
+ context.replace_items
594
+ end
595
+
494
596
  ##
495
597
  # Provide a user friendly representation
496
598
  def to_s
@@ -242,6 +242,7 @@ module Twilio
242
242
  'friendly_name' => payload['friendly_name'],
243
243
  'mime_type' => payload['mime_type'],
244
244
  'status' => payload['status'],
245
+ 'failure_reason' => payload['failure_reason'],
245
246
  'type' => payload['type'],
246
247
  'attributes' => payload['attributes'],
247
248
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
@@ -295,6 +296,12 @@ module Twilio
295
296
  @properties['status']
296
297
  end
297
298
 
299
+ ##
300
+ # @return [String] The failure reason of the Supporting Document Resource.
301
+ def failure_reason
302
+ @properties['failure_reason']
303
+ end
304
+
298
305
  ##
299
306
  # @return [String] The type of the Supporting Document
300
307
  def type
@@ -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