Class: Kobana::Client

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

Defined Under Namespace

Classes: ResourceProxy

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_token: nil, environment: :sandbox, custom_headers: {}, debug: false, **extra_config) ⇒ Client

Returns a new instance of Client.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/kobana/client.rb', line 7

def initialize(api_token: nil, environment: :sandbox, custom_headers: {}, debug: false, **extra_config)
  @configuration = Configuration.new
  @configuration.api_token = api_token
  @configuration.environment = environment
  @configuration.custom_headers = custom_headers
  @configuration.debug = debug

  # Allow any additional configuration options
  extra_config.each do |key, value|
    @configuration.public_send("#{key}=", value) if @configuration.respond_to?("#{key}=")
  end
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



5
6
7
# File 'lib/kobana/client.rb', line 5

def configuration
  @configuration
end

Instance Method Details

#configure {|@configuration| ... } ⇒ Object

Yields:



20
21
22
# File 'lib/kobana/client.rb', line 20

def configure
  yield(@configuration) if block_given?
end