Sha256: 909f8c121be141d52cc52aad83618ee2efe0c47dcfabd0468c7e93bb1e5160fa

Contents?: true

Size: 678 Bytes

Versions: 15

Compression:

Stored size: 678 Bytes

Contents

module Octobat
  class BalanceTransaction < APIResource
    extend Octobat::APIOperations::List
    
    def url
      !parent_obj.nil? ? parentize_url : super
    end
    
    def parentize_url
      if parent_obj.include?(:payout)
        "#{Payout.url}/#{CGI.escape(parent_obj[:payout])}/balance_transactions/#{CGI.escape(id)}"
      else
        url
      end
    end
    
    def self.url
      if @parent_resource.include?(:payout)
        "#{Payout.url}/#{CGI.escape(@parent_resource[:payout])}/balance_transactions"
      end
    end

    def self.set_parent_resource(filters)
      @parent_resource = filters.select{|k, v| [:payout].include?(k)}
    end
    
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
octobat-2.0.27 lib/octobat/balance_transaction.rb
octobat-2.0.26 lib/octobat/balance_transaction.rb
octobat-2.0.25 lib/octobat/balance_transaction.rb
octobat-2.0.24 lib/octobat/balance_transaction.rb
octobat-2.0.23 lib/octobat/balance_transaction.rb
octobat-2.0.22 lib/octobat/balance_transaction.rb
octobat-2.0.21 lib/octobat/balance_transaction.rb
octobat-2.0.20 lib/octobat/balance_transaction.rb
octobat-2.0.19 lib/octobat/balance_transaction.rb
octobat-2.0.18 lib/octobat/balance_transaction.rb
octobat-2.0.17 lib/octobat/balance_transaction.rb
octobat-2.0.16 lib/octobat/balance_transaction.rb
octobat-2.0.15 lib/octobat/balance_transaction.rb
octobat-2.0.14 lib/octobat/balance_transaction.rb
octobat-2.0.12 lib/octobat/balance_transaction.rb