Sha256: a3b0d086c826994bbe5cd63f338f357c62cf0831cf4e068e23b21fc66f3ac2b7

Contents?: true

Size: 1.47 KB

Versions: 3

Compression:

Stored size: 1.47 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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bluepan_client-0.3.0 lib/bluepan_client/client.rb
bluepan_client-0.2.0 lib/bluepan_client/client.rb
bluepan_client-0.1.0 lib/bluepan_client/client.rb