Sha256: 0855221e4c72db58770a04c7c50a8d12e67ede8a7ff53760abb73c8202dd735e
Contents?: true
Size: 1017 Bytes
Versions: 8
Compression:
Stored size: 1017 Bytes
Contents
module Braintree class ExchangeRateQuoteGateway def initialize(gateway) @gateway = gateway end DEFINITION = <<-GRAPHQL mutation GenerateExchangeRateQuoteInput($input: GenerateExchangeRateQuoteInput!) { generateExchangeRateQuote(input: $input) { quotes { id baseAmount {value, currencyCode} quoteAmount {value, currencyCode} exchangeRate tradeRate expiresAt refreshesAt } } } GRAPHQL 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 end end
Version data entries
8 entries across 8 versions & 1 rubygems