Class: Braintree::DiscountGateway

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

Instance Method Summary collapse

Constructor Details

#initialize(gateway) ⇒ DiscountGateway

Returns a new instance of DiscountGateway.



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

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

Instance Method Details

#allObject



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

def all
  response = @config.http.get("#{@config.base_merchant_path}/discounts")
  attributes_collection = response[:discounts]
  attributes_collection.map do |attributes|
    Discount._new(attributes)
  end
end