class Braintree::ExchangeRateQuoteGateway

Constants

DEFINITION

Public Class Methods

new(gateway) click to toggle source
# File lib/braintree/exchange_rate_quote_gateway.rb, line 3
def initialize(gateway)
  @gateway = gateway
end

Public Instance Methods

generate(params) click to toggle source
# File lib/braintree/exchange_rate_quote_gateway.rb, line 23
def generate(params)
  response = @gateway.config.graphql_client.query(DEFINITION, {input: params})

  if response.has_key?(:data) && response[:data][:generateExchangeRateQuote]
    response[:data][:generateExchangeRateQuote]
  elsif response[:errors]
    ErrorResult.new(@gateway, response[:errors])
  else
    raise UnexpectedError, "expected :generateExchangeRateQuote or :api_error_response in GraphQL response"
  end
end