Sha256: 52dd43ce7f1800b09163c115df61eeb0ea508fda9acd5746138c901f9860ba48

Contents?: true

Size: 1.18 KB

Versions: 15

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

module Mock
  module Twilio
    module Decorators
      module Api2010
        class ConferencesParticipantsCreate
          class << self
            def decorate(body, request)
              body["date_updated"] = Time.current.rfc2822 if body["date_updated"]
              body["date_created"] = Time.current.rfc2822 if body["date_created"]
              body["account_sid"] = ::Twilio.account_sid if body["account_sid"]
              body["label"] = "Mock Customer" if body["label"]
              body["status"] = "initiated" if body["status"]

              parse_call_sid(body, request) if body["call_sid"]
              parse_conference_sid(body, request) if body["conference_sid"]

              body
            end

            def parse_call_sid(body, request)
              prefix = "CA"
              call_sid = prefix + SecureRandom.hex(16)
              body["call_sid"] = call_sid
            end

            def parse_conference_sid(body, request)
              uri = URI(request.url)
              conference_sid = uri.path.split('/')[5]
              body["conference_sid"] = conference_sid
            end
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mock-twilio-1.4 lib/mock/twilio/decorators/api_2010/conferences_participants_create.rb
mock-twilio-1.3.2 lib/mock/twilio/decorators/api_2010/conferences_participants_create.rb
mock-twilio-1.3.1 lib/mock/twilio/decorators/api_2010/conferences_participants_create.rb
mock-twilio-1.3.0 lib/mock/twilio/decorators/api_2010/conferences_participants_create.rb
mock-twilio-1.2.0 lib/mock/twilio/decorators/api_2010/conferences_participants_create.rb
mock-twilio-1.1.0 lib/mock/twilio/decorators/api_2010/conferences_participants_create.rb
mock-twilio-1.0.0 lib/mock/twilio/decorators/api_2010/conferences_participants_create.rb
mock-twilio-0.8.0 lib/mock/twilio/decorators/api_2010/conferences_participants_create.rb
mock-twilio-0.7.2 lib/mock/twilio/decorators/api_2010/conferences_participants_create.rb
mock-twilio-0.7.1 lib/mock/twilio/decorators/api_2010/conferences_participants_create.rb
mock-twilio-0.7.0 lib/mock/twilio/decorators/api_2010/conferences_participants_create.rb
mock-twilio-0.6.0 lib/mock/twilio/decorators/api_2010/conferences_participants_create.rb
mock-twilio-0.5.0 lib/mock/twilio/decorators/api_2010/conferences_participants_create.rb
mock-twilio-0.4.0 lib/mock/twilio/decorators/api_2010/conferences_participants_create.rb
mock-twilio-0.3.0 lib/mock/twilio/decorators/api_2010/conferences_participants_create.rb