Sha256: 43acb1cdb3681a7275952eca17eccbefdc3e4adeeccda8f0599e2398dfb3c8cd

Contents?: true

Size: 528 Bytes

Versions: 13

Compression:

Stored size: 528 Bytes

Contents

# frozen_string_literal: true

module CoinsPaid
  module API
    module Requester
      extend self

      def call(api, data)
        request_data = api::Request.new(data)
        Transport.post(api::PATH, request_data.to_hash)
          .yield_self { |response| parse(response) }
          .yield_self { |parsed_response| api::Response.new(parsed_response) }
      end

      private

      def parse(response)
        response.transform_keys { |key| key.to_s == 'id' ? :external_id : key.to_sym }
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
coins_paid_api-2.2.0 lib/coins_paid/api/requester.rb
coins_paid_api-2.1.0 lib/coins_paid/api/requester.rb
coins_paid_api-2.0.0 lib/coins_paid/api/requester.rb
coins_paid_api-1.3.0 lib/coins_paid/api/requester.rb
coins_paid_api-1.2.0 lib/coins_paid/api/requester.rb
coins_paid_api-1.1.0 lib/coins_paid/api/requester.rb
coins_paid_api-1.0.7 lib/coins_paid/api/requester.rb
coins_paid_api-1.0.6 lib/coins_paid/api/requester.rb
coins_paid_api-1.0.5 lib/coins_paid/api/requester.rb
coins_paid_api-1.0.4 lib/coins_paid/api/requester.rb
coins_paid_api-1.0.3 lib/coins_paid/api/requester.rb
coins_paid_api-1.0.2 lib/coins_paid/api/requester.rb
coins_paid_api-1.0.1 lib/coins_paid/api/requester.rb