Class: Bambora::Rest::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/bambora/rest/client.rb

Overview

A basic client for making REST requests.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ Client

Initialze a client that makes REST requests.

Examples:

rest_client = Bambora::Rest::Client.new(
  base_url: ENV.fetch('BAMBORA_BASE_URL'),
  merchant_id: ENV.fetch('BAMBORA_MERCHANT_ID'),
  sub_merchant_id: ENV.fetch('BAMBORA_SUB_MERCHANT_ID'),
)

Yields:

  • (_self)

Yield Parameters:



21
22
23
24
25
26
# File 'lib/bambora/rest/client.rb', line 21

def initialize(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
  yield(self) if block_given?
end

Instance Attribute Details

#base_urlObject (readonly)

Returns the value of attribute base_url.



11
12
13
# File 'lib/bambora/rest/client.rb', line 11

def base_url
  @base_url
end

#merchant_idObject (readonly)

Returns the value of attribute merchant_id.



11
12
13
# File 'lib/bambora/rest/client.rb', line 11

def merchant_id
  @merchant_id
end

#sub_merchant_idObject (readonly)

Returns the value of attribute sub_merchant_id.



11
12
13
# File 'lib/bambora/rest/client.rb', line 11

def sub_merchant_id
  @sub_merchant_id
end