Class: Fugle::HTTP::Client Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

The Fugle HTTP Client

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initializeClient

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Client.

Since:

  • 0.1.0



16
17
18
# File 'lib/fugle/http/client.rb', line 16

def initialize
  @api = Fugle
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) {|res.body| ... } ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Yields:

  • (res.body)

Since:

  • 0.1.0



28
29
30
31
32
33
34
35
36
# File 'lib/fugle/http/client.rb', line 28

def method_missing(name, *args, &block)
  @api = find(name)
  return super if @api.nil?
  return self unless @api.is_a?(Class)

  res = fetch(@api.uri(*args))
  yield res.body if block_given?
  res
end

Instance Method Details

#respond_to_missing?(_name) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

Since:

  • 0.1.0



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

def respond_to_missing?(_name)
  super
end