Class: Infurarb::Connection
- Inherits:
-
Object
- Object
- Infurarb::Connection
- Defined in:
- lib/infurarb/connection.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#network ⇒ Object
readonly
Returns the value of attribute network.
Instance Method Summary collapse
-
#initialize(api_key:, network:) ⇒ Connection
constructor
A new instance of Connection.
- #method_missing(method_name, *params) ⇒ Object
- #respond_to_missing? ⇒ Boolean
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_key ⇒ Object (readonly)
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/infurarb/connection.rb', line 5 def api_key @api_key end |
#network ⇒ Object (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
11 12 13 |
# File 'lib/infurarb/connection.rb', line 11 def respond_to_missing? true end |