Sha256: 464463fd9b7bcbe64109826e0d100702f1b5947f0163216a773ccd836b753c36

Contents?: true

Size: 1.66 KB

Versions: 2

Compression:

Stored size: 1.66 KB

Contents

module BluepanClient
  class Client

    HOSTS = {
      production: "https://api.bluepan.net",
      staging: "https://api.bluepan.net", # There is no staging server, yet
    }

    include Virtus.model
    attribute :host, String, default: HOSTS.fetch(:staging)
    attribute :api_token, String
    attribute :api_secret, String

    def get_cities(provinceseq)
      request = GetCitiesRequest.new(attributes.merge(provinceseq: provinceseq))
      raw_response = request.()
      GetCitiesResponse.new(raw_response: raw_response)
    end

    def get_provinces
      request = GetProvincesRequest.new(attributes)
      raw_response = request.()
      GetProvincesResponse.new(raw_response: raw_response)
    end

    def get_strategies
      request = GetStrategiesRequest.new(attributes)
      raw_response = request.()
      GetStrategiesResponse.new(raw_response: raw_response)
    end

    def create_recipient(args)
      request = CreateRecipientRequest.new(attributes.merge(args))
      raw_response = request.()
      CreateRecipientResponse.new(raw_response: raw_response)
    end

    def get_recipient(id)
      request = GetRecipientRequest.new(attributes.merge(recipientseq: id))
      raw_response = request.()
      GetRecipientResponse.new(raw_response: raw_response)
    end

    def create_remittance(args)
      request = CreateRemittanceRequest.new(attributes.merge(args))
      raw_response = request.()
      CreateRemittanceResponse.new(raw_response: raw_response)
    end

    def get_exchange_rates
      request = GetExchangeRatesRequest.new(attributes)
      raw_response = request.()
      GetExchangeRatesResponse.new(raw_response: raw_response)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bluepan_client-1.0.0 lib/bluepan_client/client.rb
bluepan_client-0.4.0 lib/bluepan_client/client.rb