Class: Infurarb::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/infurarb/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key:, network:) ⇒ Connection

Returns a new instance of Connection.



6
7
8
9
# File 'lib/infurarb/connection.rb', line 6

def initialize(api_key:, network:)
  @api_key = api_key
  @network = network
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *params) ⇒ Object



15
16
17
18
19
# File 'lib/infurarb/connection.rb', line 15

def method_missing(method_name, *params)
  return super unless Request::RPC_METHODS.include?(method_name)

  Request.new(endpoint: endpoint, method_name: method_name, params: params).call
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



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

def api_key
  @api_key
end

#networkObject (readonly)

Returns the value of attribute network.



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

def network
  @network
end

Instance Method Details

#respond_to_missing?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/infurarb/connection.rb', line 11

def respond_to_missing?
  true
end