Class: Braintree::TransactionLineItemGateway

Inherits:
Object
  • Object
show all
Defined in:
lib/braintree/transaction_line_item_gateway.rb

Instance Method Summary collapse

Constructor Details

#initialize(gateway) ⇒ TransactionLineItemGateway

Returns a new instance of TransactionLineItemGateway.



3
4
5
6
7
# File 'lib/braintree/transaction_line_item_gateway.rb', line 3

def initialize(gateway)
  @gateway = gateway
  @config = gateway.config
  @config.assert_has_access_token_or_keys
end

Instance Method Details

#find_all(transaction_id) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/braintree/transaction_line_item_gateway.rb', line 9

def find_all(transaction_id)
  raise ArgumentError, "transaction_id cannot be blank" if transaction_id.nil? || transaction_id.strip.to_s == ""
  response = @config.http.get("#{@config.base_merchant_path}/transactions/#{transaction_id}/line_items")
  response[:line_items].map do |line_item_params|
    TransactionLineItem._new(@gateway, line_item_params)
  end
rescue NotFoundError
  raise NotFoundError, "transaction with id #{transaction_id.inspect} not found"
end