diff --git a/CHANGES.md b/CHANGES.md index 0146797b3..2cd6e64d7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,28 @@ twilio-ruby changelog ===================== +[2021-06-30] Version 5.56.0 +--------------------------- +**Library - Feature** +- [PR #559](https://github.com/twilio/twilio-ruby/pull/559): Add `Twilio::HTTP::Client#configure_connection`. Thanks to [@darwinShopify](https://github.com/darwinShopify)! +- [PR #558](https://github.com/twilio/twilio-ruby/pull/558): Autoload Twilio::REST and Twilio::HTTP. Thanks to [@gmcgibbon](https://github.com/gmcgibbon)! + +**Conversations** +- Read-only Conversation Email Binding property `binding` + +**Supersim** +- Add Billing Period resource for the Super Sim Pilot +- Add List endpoint to Billing Period resource for Super Sim Pilot +- Add Fetch endpoint to Billing Period resource for Super Sim Pilot + +**Taskrouter** +- Update `transcribe` & `transcription_configuration` form params in Reservation update endpoint to have private visibility **(breaking change)** +- Add `transcribe` & `transcription_configuration` form params to Reservation update endpoint + +**Twiml** +- Add `modify` event to `statusCallbackEvent` for ``. + + [2021-06-16] Version 5.55.0 --------------------------- **Api** diff --git a/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb b/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb index be8b48eaf..eb8286ee3 100644 --- a/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +++ b/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb @@ -107,8 +107,8 @@ def initialize(version, account_sid: nil, conference_sid: nil) # `POST`. # @param [Array[String]] conference_status_callback_event The conference state # changes that should generate a call to `conference_status_callback`. Can be: - # `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`, and `announcement`. - # Separate multiple values with a space. Defaults to `start end`. + # `start`, `end`, `join`, `leave`, `mute`, `hold`, `modify`, `speaker`, and + # `announcement`. Separate multiple values with a space. Defaults to `start end`. # @param [String] recording_channels The recording channels for the final # recording. Can be: `mono` or `dual` and the default is `mono`. # @param [String] recording_status_callback The URL that we should call using the @@ -130,13 +130,14 @@ def initialize(version, account_sid: nil, conference_sid: nil) # `POST` and defaults to `POST`. # @param [Array[String]] recording_status_callback_event The recording state # changes that should generate a call to `recording_status_callback`. Can be: - # `in-progress`, `completed`, and `failed`. Separate multiple values with a space. - # The default value is `in-progress completed failed`. + # `started`, `in-progress`, `paused`, `resumed`, `stopped`, `completed`, `failed`, + # and `absent`. Separate multiple values with a space, ex: `'in-progress completed + # failed'`. # @param [Array[String]] conference_recording_status_callback_event The conference # recording state changes that generate a call to - # `conference_recording_status_callback`. Can be: `in-progress`, `completed`, and - # `failed`. Separate multiple values with a space. The default value is - # `in-progress completed failed`. + # `conference_recording_status_callback`. Can be: `in-progress`, `completed`, + # `failed`, and `absent`. Separate multiple values with a space, ex: `'in-progress + # completed failed'` # @param [Boolean] coaching Whether the participant is coaching another call. Can # be: `true` or `false`. If not present, defaults to `false` unless # `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined. diff --git a/lib/twilio-ruby/rest/api/v2010/account/message.rb b/lib/twilio-ruby/rest/api/v2010/account/message.rb index 5e884093d..e8af5f604 100644 --- a/lib/twilio-ruby/rest/api/v2010/account/message.rb +++ b/lib/twilio-ruby/rest/api/v2010/account/message.rb @@ -330,7 +330,7 @@ def fetch # @param [String] body The text of the message you want to send. Can be up to # 1,600 characters long. # @return [MessageInstance] Updated MessageInstance - def update(body: nil) + def update(body: :unset) data = Twilio::Values.of({'Body' => body, }) payload = @version.update('POST', @uri, data: data) @@ -580,7 +580,7 @@ def fetch # @param [String] body The text of the message you want to send. Can be up to # 1,600 characters long. # @return [MessageInstance] Updated MessageInstance - def update(body: nil) + def update(body: :unset) context.update(body: body, ) end diff --git a/lib/twilio-ruby/rest/conversations/v1/conversation.rb b/lib/twilio-ruby/rest/conversations/v1/conversation.rb index fa8bffa0a..e28473a1d 100644 --- a/lib/twilio-ruby/rest/conversations/v1/conversation.rb +++ b/lib/twilio-ruby/rest/conversations/v1/conversation.rb @@ -362,6 +362,7 @@ def initialize(version, payload, sid: nil) 'timers' => payload['timers'], 'url' => payload['url'], 'links' => payload['links'], + 'bindings' => payload['bindings'], } # Context @@ -458,6 +459,12 @@ def links @properties['links'] end + ## + # @return [Hash] The bindings + def bindings + @properties['bindings'] + end + ## # Update the ConversationInstance # @param [String] friendly_name The human-readable name of this conversation, diff --git a/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb b/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb index 291785659..0aaa04a86 100644 --- a/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +++ b/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb @@ -394,6 +394,7 @@ def initialize(version, payload, chat_service_sid: nil, sid: nil) 'timers' => payload['timers'], 'url' => payload['url'], 'links' => payload['links'], + 'bindings' => payload['bindings'], } # Context @@ -490,6 +491,12 @@ def links @properties['links'] end + ## + # @return [Hash] The bindings + def bindings + @properties['bindings'] + end + ## # Update the ConversationInstance # @param [String] friendly_name The human-readable name of this conversation, diff --git a/lib/twilio-ruby/rest/supersim/v1/sim.rb b/lib/twilio-ruby/rest/supersim/v1/sim.rb index 0f1fc3ce7..655caf192 100644 --- a/lib/twilio-ruby/rest/supersim/v1/sim.rb +++ b/lib/twilio-ruby/rest/supersim/v1/sim.rb @@ -200,6 +200,9 @@ def initialize(version, sid) # Path Solution @solution = {sid: sid, } @uri = "/Sims/#{@solution[:sid]}" + + # Dependents + @billing_periods = nil end ## @@ -246,6 +249,18 @@ def update(unique_name: :unset, status: :unset, fleet: :unset, callback_url: :un SimInstance.new(@version, payload, sid: @solution[:sid], ) end + ## + # Access the billing_periods + # @return [BillingPeriodList] + # @return [BillingPeriodContext] + def billing_periods + unless @billing_periods + @billing_periods = BillingPeriodList.new(@version, sim_sid: @solution[:sid], ) + end + + @billing_periods + end + ## # Provide a user friendly representation def to_s @@ -284,6 +299,7 @@ def initialize(version, payload, sid: nil) 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 'url' => payload['url'], + 'links' => payload['links'], } # Context @@ -356,6 +372,12 @@ def url @properties['url'] end + ## + # @return [String] The links + def links + @properties['links'] + end + ## # Fetch the SimInstance # @return [SimInstance] Fetched SimInstance @@ -394,6 +416,13 @@ def update(unique_name: :unset, status: :unset, fleet: :unset, callback_url: :un ) end + ## + # Access the billing_periods + # @return [billing_periods] billing_periods + def billing_periods + context.billing_periods + end + ## # Provide a user friendly representation def to_s diff --git a/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb b/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb new file mode 100644 index 000000000..dcf8c549f --- /dev/null +++ b/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb @@ -0,0 +1,231 @@ +## +# This code was generated by +# \ / _ _ _| _ _ +# | (_)\/(_)(_|\/| |(/_ v1.0.0 +# / / +# +# frozen_string_literal: true + +module Twilio + module REST + class Supersim < Domain + class V1 < Version + class SimContext < InstanceContext + class BillingPeriodList < ListResource + ## + # Initialize the BillingPeriodList + # @param [Version] version Version that contains the resource + # @param [String] sim_sid The SID of the Super SIM the Billing Period belongs to. + # @return [BillingPeriodList] BillingPeriodList + def initialize(version, sim_sid: nil) + super(version) + + # Path Solution + @solution = {sim_sid: sim_sid} + @uri = "/Sims/#{@solution[:sim_sid]}/BillingPeriods" + end + + ## + # Lists BillingPeriodInstance records from the API as a list. + # Unlike stream(), this operation is eager and will load `limit` records into + # memory before returning. + # @param [Integer] limit Upper limit for the number of records to return. stream() + # guarantees to never return more than limit. Default is no limit + # @param [Integer] page_size Number of records to fetch per request, when + # not set will use the default value of 50 records. If no page_size is defined + # but a limit is defined, stream() will attempt to read the limit with the most + # efficient page size, i.e. min(limit, 1000) + # @return [Array] Array of up to limit results + def list(limit: nil, page_size: nil) + self.stream(limit: limit, page_size: page_size).entries + end + + ## + # Streams BillingPeriodInstance records from the API as an Enumerable. + # This operation lazily loads records as efficiently as possible until the limit + # is reached. + # @param [Integer] limit Upper limit for the number of records to return. stream() + # guarantees to never return more than limit. Default is no limit. + # @param [Integer] page_size Number of records to fetch per request, when + # not set will use the default value of 50 records. If no page_size is defined + # but a limit is defined, stream() will attempt to read the limit with the most + # efficient page size, i.e. min(limit, 1000) + # @return [Enumerable] Enumerable that will yield up to limit results + def stream(limit: nil, page_size: nil) + limits = @version.read_limits(limit, page_size) + + page = self.page(page_size: limits[:page_size], ) + + @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) + end + + ## + # When passed a block, yields BillingPeriodInstance records from the API. + # This operation lazily loads records as efficiently as possible until the limit + # is reached. + def each + limits = @version.read_limits + + page = self.page(page_size: limits[:page_size], ) + + @version.stream(page, + limit: limits[:limit], + page_limit: limits[:page_limit]).each {|x| yield x} + end + + ## + # Retrieve a single page of BillingPeriodInstance records from the API. + # Request is executed immediately. + # @param [String] page_token PageToken provided by the API + # @param [Integer] page_number Page Number, this value is simply for client state + # @param [Integer] page_size Number of records to return, defaults to 50 + # @return [Page] Page of BillingPeriodInstance + def page(page_token: :unset, page_number: :unset, page_size: :unset) + params = Twilio::Values.of({ + 'PageToken' => page_token, + 'Page' => page_number, + 'PageSize' => page_size, + }) + + response = @version.page('GET', @uri, params: params) + + BillingPeriodPage.new(@version, response, @solution) + end + + ## + # Retrieve a single page of BillingPeriodInstance records from the API. + # Request is executed immediately. + # @param [String] target_url API-generated URL for the requested results page + # @return [Page] Page of BillingPeriodInstance + def get_page(target_url) + response = @version.domain.request( + 'GET', + target_url + ) + BillingPeriodPage.new(@version, response, @solution) + end + + ## + # Provide a user friendly representation + def to_s + '#' + end + end + + class BillingPeriodPage < Page + ## + # Initialize the BillingPeriodPage + # @param [Version] version Version that contains the resource + # @param [Response] response Response from the API + # @param [Hash] solution Path solution for the resource + # @return [BillingPeriodPage] BillingPeriodPage + def initialize(version, response, solution) + super(version, response) + + # Path Solution + @solution = solution + end + + ## + # Build an instance of BillingPeriodInstance + # @param [Hash] payload Payload response from the API + # @return [BillingPeriodInstance] BillingPeriodInstance + def get_instance(payload) + BillingPeriodInstance.new(@version, payload, sim_sid: @solution[:sim_sid], ) + end + + ## + # Provide a user friendly representation + def to_s + '' + end + end + + class BillingPeriodInstance < InstanceResource + ## + # Initialize the BillingPeriodInstance + # @param [Version] version Version that contains the resource + # @param [Hash] payload payload that contains response from Twilio + # @param [String] sim_sid The SID of the Super SIM the Billing Period belongs to. + # @return [BillingPeriodInstance] BillingPeriodInstance + def initialize(version, payload, sim_sid: nil) + super(version) + + # Marshaled Properties + @properties = { + 'sid' => payload['sid'], + 'account_sid' => payload['account_sid'], + 'sim_sid' => payload['sim_sid'], + 'start_time' => Twilio.deserialize_iso8601_datetime(payload['start_time']), + 'end_time' => Twilio.deserialize_iso8601_datetime(payload['end_time']), + 'period_type' => payload['period_type'], + 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), + 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), + } + end + + ## + # @return [String] The SID of the Billing Period + def sid + @properties['sid'] + end + + ## + # @return [String] The SID of the Account the Super SIM belongs to + def account_sid + @properties['account_sid'] + end + + ## + # @return [String] The SID of the Super SIM the Billing Period belongs to + def sim_sid + @properties['sim_sid'] + end + + ## + # @return [Time] The start time of the Billing Period + def start_time + @properties['start_time'] + end + + ## + # @return [Time] The end time of the Billing Period + def end_time + @properties['end_time'] + end + + ## + # @return [billing_period.BpType] The type of the Billing Period + def period_type + @properties['period_type'] + end + + ## + # @return [Time] The ISO 8601 date and time in GMT when the resource was created + def date_created + @properties['date_created'] + end + + ## + # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated + def date_updated + @properties['date_updated'] + end + + ## + # Provide a user friendly representation + def to_s + "" + end + + ## + # Provide a detailed, user friendly representation + def inspect + "" + end + end + end + end + end + end +end \ No newline at end of file diff --git a/spec/integration/api/v2010/account/message_spec.rb b/spec/integration/api/v2010/account/message_spec.rb index 3d8a3392d..1fd6a91ab 100644 --- a/spec/integration/api/v2010/account/message_spec.rb +++ b/spec/integration/api/v2010/account/message_spec.rb @@ -493,15 +493,13 @@ expect { @client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .messages('MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(body: 'body') + .messages('MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update() }.to raise_exception(Twilio::REST::TwilioError) - values = {'Body' => 'body', } expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json', - data: values, ))).to eq(true) end @@ -538,7 +536,45 @@ )) actual = @client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .messages('MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(body: 'body') + .messages('MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update() + + expect(actual).to_not eq(nil) + end + + it "receives cancel_message responses" do + @holodeck.mock(Twilio::Response.new( + 200, + %q[ + { + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "api_version": "2010-04-01", + "body": "", + "date_created": "Fri, 24 May 2019 17:18:27 +0000", + "date_sent": "Fri, 24 May 2019 17:18:28 +0000", + "date_updated": "Fri, 24 May 2019 17:18:28 +0000", + "direction": "outbound-api", + "error_code": 30007, + "error_message": "Carrier violation", + "from": "+12019235161", + "messaging_service_sid": "MGdeadbeefdeadbeefdeadbeefdeadbeef", + "num_media": "0", + "num_segments": "1", + "price": "-0.00750", + "price_unit": "USD", + "sid": "SMb7c0a2ce80504485a6f653a7110836f5", + "status": "canceled", + "subresource_uris": { + "media": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMb7c0a2ce80504485a6f653a7110836f5/Media.json", + "feedback": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMb7c0a2ce80504485a6f653a7110836f5/Feedback.json" + }, + "to": "+18182008801", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMb7c0a2ce80504485a6f653a7110836f5.json" + } + ] + )) + + actual = @client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ + .messages('MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update() expect(actual).to_not eq(nil) end diff --git a/spec/integration/conversations/v1/conversation_spec.rb b/spec/integration/conversations/v1/conversation_spec.rb index 74e9efa84..78f79b70b 100644 --- a/spec/integration/conversations/v1/conversation_spec.rb +++ b/spec/integration/conversations/v1/conversation_spec.rb @@ -44,6 +44,7 @@ "date_inactive": "2015-12-16T22:19:38Z", "date_closed": "2015-12-16T22:28:38Z" }, + "bindings": {}, "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "participants": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants", @@ -75,6 +76,7 @@ "date_updated": "2020-07-01T22:18:37Z", "state": "active", "timers": {}, + "bindings": {}, "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "participants": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants", @@ -125,6 +127,7 @@ "date_inactive": "2015-12-16T22:19:38Z", "date_closed": "2015-12-16T22:28:38Z" }, + "bindings": {}, "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "participants": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants", @@ -200,6 +203,7 @@ "date_inactive": "2015-12-16T22:19:38Z", "date_closed": "2015-12-16T22:28:38Z" }, + "bindings": {}, "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "participants": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants", @@ -250,6 +254,7 @@ "date_inactive": "2015-12-16T22:19:38Z", "date_closed": "2015-12-16T22:28:38Z" }, + "bindings": {}, "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "participants": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants", diff --git a/spec/integration/conversations/v1/service/conversation_spec.rb b/spec/integration/conversations/v1/service/conversation_spec.rb index d21765937..2db79bf40 100644 --- a/spec/integration/conversations/v1/service/conversation_spec.rb +++ b/spec/integration/conversations/v1/service/conversation_spec.rb @@ -45,6 +45,7 @@ "date_inactive": "2015-12-16T22:19:38Z", "date_closed": "2015-12-16T22:28:38Z" }, + "bindings": {}, "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "participants": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants", @@ -77,6 +78,7 @@ "date_updated": "2020-07-01T22:18:37Z", "state": "active", "timers": {}, + "bindings": {}, "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "participants": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants", @@ -129,6 +131,7 @@ "date_inactive": "2015-12-16T22:19:38Z", "date_closed": "2015-12-16T22:28:38Z" }, + "bindings": {}, "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "participants": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants", @@ -208,6 +211,7 @@ "date_inactive": "2015-12-16T22:19:38Z", "date_closed": "2015-12-16T22:28:38Z" }, + "bindings": {}, "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "participants": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants", @@ -260,6 +264,7 @@ "date_inactive": "2015-12-16T22:19:38Z", "date_closed": "2015-12-16T22:28:38Z" }, + "bindings": {}, "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "participants": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants", diff --git a/spec/integration/supersim/v1/sim/billing_period_spec.rb b/spec/integration/supersim/v1/sim/billing_period_spec.rb new file mode 100644 index 000000000..db1f378b2 --- /dev/null +++ b/spec/integration/supersim/v1/sim/billing_period_spec.rb @@ -0,0 +1,123 @@ +## +# This code was generated by +# \ / _ _ _| _ _ +# | (_)\/(_)(_|\/| |(/_ v1.0.0 +# / / +# +# frozen_string_literal: true + +require 'spec_helper.rb' + +describe 'BillingPeriod' do + it "can read" do + @holodeck.mock(Twilio::Response.new(500, '')) + + expect { + @client.supersim.v1.sims('HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ + .billing_periods.list() + }.to raise_exception(Twilio::REST::TwilioError) + + expect( + @holodeck.has_request?(Holodeck::Request.new( + method: 'get', + url: 'https://supersim.twilio.com/v1/Sims/HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/BillingPeriods', + ))).to eq(true) + end + + it "receives read_empty responses" do + @holodeck.mock(Twilio::Response.new( + 200, + %q[ + { + "billing_periods": [], + "meta": { + "page": 0, + "page_size": 50, + "first_page_url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods?PageSize=50&Page=0", + "previous_page_url": null, + "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods?PageSize=50&Page=0", + "next_page_url": null, + "key": "billing_periods" + } + } + ] + )) + + actual = @client.supersim.v1.sims('HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ + .billing_periods.list() + + expect(actual).to_not eq(nil) + end + + it "receives read_full_active_period responses" do + @holodeck.mock(Twilio::Response.new( + 200, + %q[ + { + "billing_periods": [ + { + "sid": "HBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "sim_sid": "HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "period_type": "active", + "start_time": "2021-06-09T13:18:15Z", + "end_time": "2021-07-09T13:18:15Z", + "date_created": "2021-06-09T13:18:16Z", + "date_updated": "2021-06-09T13:18:16Z" + } + ], + "meta": { + "page": 0, + "page_size": 50, + "first_page_url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods?PageSize=50&Page=0", + "previous_page_url": null, + "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods?PageSize=50&Page=0", + "next_page_url": null, + "key": "billing_periods" + } + } + ] + )) + + actual = @client.supersim.v1.sims('HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ + .billing_periods.list() + + expect(actual).to_not eq(nil) + end + + it "receives read_full_ready_period responses" do + @holodeck.mock(Twilio::Response.new( + 200, + %q[ + { + "billing_periods": [ + { + "sid": "HBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "sim_sid": "HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "period_type": "ready", + "start_time": "2021-06-09T13:18:15Z", + "end_time": "2021-07-09T13:18:15Z", + "date_created": "2021-06-09T13:18:16Z", + "date_updated": "2021-06-09T13:18:16Z" + } + ], + "meta": { + "page": 0, + "page_size": 50, + "first_page_url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods?PageSize=50&Page=0", + "previous_page_url": null, + "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods?PageSize=50&Page=0", + "next_page_url": null, + "key": "billing_periods" + } + } + ] + )) + + actual = @client.supersim.v1.sims('HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ + .billing_periods.list() + + expect(actual).to_not eq(nil) + end +end \ No newline at end of file diff --git a/spec/integration/supersim/v1/sim_spec.rb b/spec/integration/supersim/v1/sim_spec.rb index cc4a7e246..52310dfef 100644 --- a/spec/integration/supersim/v1/sim_spec.rb +++ b/spec/integration/supersim/v1/sim_spec.rb @@ -38,7 +38,10 @@ "iccid": "89883070000123456789", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", - "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "billing_periods": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods" + } } ] )) @@ -75,7 +78,10 @@ "iccid": "89883070000123456789", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", - "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "billing_periods": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods" + } } ] )) @@ -112,7 +118,10 @@ "iccid": "89883070000123456789", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", - "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "billing_periods": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods" + } } ] )) @@ -135,7 +144,10 @@ "iccid": "89883070000123456789", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", - "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "billing_periods": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods" + } } ] )) @@ -158,7 +170,10 @@ "iccid": "89883070000123456789", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", - "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "billing_periods": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods" + } } ] )) @@ -181,7 +196,10 @@ "iccid": "89883070000123456789", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", - "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "billing_periods": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods" + } } ] )) @@ -204,7 +222,10 @@ "iccid": "89883070000123456789", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", - "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "billing_periods": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods" + } } ] )) @@ -276,7 +297,10 @@ "iccid": "89883070000123456789", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", - "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "billing_periods": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods" + } } ] } @@ -312,7 +336,10 @@ "iccid": "89883070000123456789", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", - "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "billing_periods": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods" + } } ] } @@ -348,7 +375,10 @@ "iccid": "89883070000123456789", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", - "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "url": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "billing_periods": "https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods" + } } ] } diff --git a/spec/integration/video/v1/room_spec.rb b/spec/integration/video/v1/room_spec.rb index 3fd2f446b..24e3e90ba 100644 --- a/spec/integration/video/v1/room_spec.rb +++ b/spec/integration/video/v1/room_spec.rb @@ -40,7 +40,7 @@ "max_concurrent_published_tracks": 0, "duration": 0, "status_callback_method": "POST", - "status_callback": "", + "status_callback": null, "record_participants_on_connect": false, "video_codecs": [ "VP8" @@ -93,7 +93,7 @@ "max_participants": 10, "duration": 0, "status_callback_method": "POST", - "status_callback": "", + "status_callback": null, "record_participants_on_connect": false, "video_codecs": [ "VP8" @@ -132,7 +132,7 @@ "max_concurrent_published_tracks": 0, "duration": 0, "status_callback_method": "POST", - "status_callback": "", + "status_callback": null, "record_participants_on_connect": false, "video_codecs": [ "VP8" @@ -171,7 +171,7 @@ "max_concurrent_published_tracks": 170, "duration": 0, "status_callback_method": "POST", - "status_callback": "", + "status_callback": null, "record_participants_on_connect": false, "video_codecs": [ "VP8" @@ -210,7 +210,7 @@ "max_concurrent_published_tracks": 170, "duration": 0, "status_callback_method": "POST", - "status_callback": "", + "status_callback": null, "record_participants_on_connect": false, "video_codecs": [ "VP8" @@ -249,7 +249,7 @@ "max_concurrent_published_tracks": 16, "duration": 0, "status_callback_method": "POST", - "status_callback": "", + "status_callback": null, "record_participants_on_connect": false, "video_codecs": [ "VP8" @@ -393,7 +393,7 @@ "max_participants": 10, "max_concurrent_published_tracks": 10, "status_callback_method": "POST", - "status_callback": "", + "status_callback": null, "record_participants_on_connect": false, "video_codecs": [ "VP8"