Class: VoiceML::CallPayment

Inherits:
Object
  • Object
show all
Defined in:
lib/voiceml/models/payments.rb

Overview

A Twilio-compatible CallPayment resource — the REST companion to the ‘<Pay>` TwiML verb.

The response shape mirrors Twilio’s deliberately-minimal payload — runtime configuration (ChargeAmount, PaymentConnector, ValidCardTypes, etc.) is captured server-side and not echoed back. Tenant-side BYO is binding: the account must have ‘pay_enabled = true` AND a `stripe_secret_key` set, or the call fails 403.

Constant Summary collapse

ATTRIBUTES =
%w[
  sid account_sid call_sid api_version
  date_created date_updated uri
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ CallPayment

Returns a new instance of CallPayment.



20
21
22
23
24
25
# File 'lib/voiceml/models/payments.rb', line 20

def initialize(attrs = {})
  ATTRIBUTES.each do |field|
    value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
    instance_variable_set("@#{field}", value)
  end
end

Class Method Details

.from_hash(hash) ⇒ Object



27
28
29
30
31
# File 'lib/voiceml/models/payments.rb', line 27

def self.from_hash(hash)
  return nil if hash.nil?

  new(hash)
end