Module: Congress

Extended by:
Congress
Included in:
Congress
Defined in:
lib/congress.rb,
lib/congress/client.rb,
lib/congress/request.rb,
lib/congress/version.rb,
lib/congress/connection.rb

Defined Under Namespace

Modules: Connection, Request Classes: Client

Constant Summary collapse

VERSION =
'0.2.3'

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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

Delegate to Congress::Client



17
18
19
20
# File 'lib/congress.rb', line 17

def method_missing(method, *args, &block)
  return super unless new.respond_to?(method)
  new.send(method, *args, &block)
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



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

def key
  @key
end

Instance Method Details

#new(key = key) {|_self| ... } ⇒ Congress::Client

Alias for Congress::Client.new

Yields:

  • (_self)

Yield Parameters:

  • _self (Congress)

    the object that the method was called on

Returns:



10
11
12
13
14
# File 'lib/congress.rb', line 10

def new(key = key)
  yield self if block_given?
  return @client if instance_variable_defined?(:@client) && @client.key == key
  @client = Congress::Client.new(key)
end

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

Returns:

  • (Boolean)


23
# File 'lib/congress.rb', line 23

def respond_to?(method, include_private = false) new.respond_to?(method, include_private) end

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

Returns:

  • (Boolean)


26
# File 'lib/congress.rb', line 26

def respond_to_missing?(method_name, include_private = false) new.respond_to?(method_name, include_private) end