Class: Teller::Client

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

Constant Summary collapse

URL =
"https://api.teller.io".freeze

Instance Method Summary collapse

Constructor Details

#initialize(overrides = {}) ⇒ Client

Returns a new instance of Client.



5
6
7
8
9
10
11
12
# File 'lib/teller/client.rb', line 5

def initialize(overrides={})
  config = Teller::Config.dup
  config.setup(overrides)
  
  client = Teller::API.new(config)
  entrypoint = client.get(URL)
  @target = Teller::Resource.new(entrypoint, client)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/teller/client.rb', line 14

def method_missing(method, *args, &block)
  if @target.respond_to?(method)
    @target.send(method, *args, &block)
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/teller/client.rb', line 22

def respond_to_missing?(method, include_private = false)
  @target.respond_to?(method)
end