Sha256: 367e33ae95df9611226cbb66af72814fcf27636322557eee94c638431ae6d657

Contents?: true

Size: 613 Bytes

Versions: 10

Compression:

Stored size: 613 Bytes

Contents

require_relative '../resource'

module Tickethub
  class Supplier::Charge < Resource
    path '/supplier/charges'

    attribute :amount, type: :money
    attribute :tax, type: :money

    association :context, -> (endpoint, attributes) {
      case attributes['object']
        when 'Refund'     then Supplier::Refund.call(endpoint, attributes)
        when 'Payment'    then Supplier::Payment.call(endpoint, attributes)
        when 'Adjustment' then Supplier::Adjustment.call(endpoint, attributes)
      end
    }

    attribute :updated_at, type: :datetime
    attribute :created_at, type: :datetime
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tickethub-0.3.100 lib/tickethub/supplier/charge.rb
tickethub-0.3.99 lib/tickethub/supplier/charge.rb
tickethub-0.3.98 lib/tickethub/supplier/charge.rb
tickethub-0.3.97 lib/tickethub/supplier/charge.rb
tickethub-0.3.96 lib/tickethub/supplier/charge.rb
tickethub-0.3.95 lib/tickethub/supplier/charge.rb
tickethub-0.3.94 lib/tickethub/supplier/charge.rb
tickethub-0.3.93 lib/tickethub/supplier/charge.rb
tickethub-0.3.92 lib/tickethub/supplier/charge.rb
tickethub-0.3.91 lib/tickethub/supplier/charge.rb