Sha256: a4ec931011436976a497e5430200e8cb83aa003c1575fab7c0a219acab45e2cf

Contents?: true

Size: 700 Bytes

Versions: 7

Compression:

Stored size: 700 Bytes

Contents

module Octobat
  class BalanceTransaction < APIResource
    extend Octobat::APIOperations::List
    
    def url
      puts parent_obj
      !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

7 entries across 7 versions & 1 rubygems

Version Path
octobat-2.0.11 lib/octobat/balance_transaction.rb
octobat-2.0.10 lib/octobat/balance_transaction.rb
octobat-2.0.9 lib/octobat/balance_transaction.rb
octobat-2.0.8 lib/octobat/balance_transaction.rb
octobat-2.0.7 lib/octobat/balance_transaction.rb
octobat-2.0.6 lib/octobat/balance_transaction.rb
octobat-2.0.5 lib/octobat/balance_transaction.rb