Class: XRPC::BaseLexicon
- Inherits:
-
Object
- Object
- XRPC::BaseLexicon
- Defined in:
- lib/xrpc/lexicon.rb
Instance Attribute Summary collapse
-
#args_list ⇒ Object
Returns the value of attribute args_list.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#lexicon ⇒ Object
Returns the value of attribute lexicon.
-
#server ⇒ Object
Returns the value of attribute server.
Instance Method Summary collapse
- #call(*args, **kwargs) ⇒ Object
-
#initialize(lexicon, args_list, server, headers: { "Content-Type" => "application/json" }) ⇒ BaseLexicon
constructor
A new instance of BaseLexicon.
- #make_request(payload) ⇒ Object
Constructor Details
#initialize(lexicon, args_list, server, headers: { "Content-Type" => "application/json" }) ⇒ BaseLexicon
Returns a new instance of BaseLexicon.
27 28 29 30 31 32 |
# File 'lib/xrpc/lexicon.rb', line 27 def initialize(lexicon, args_list, server, headers: { "Content-Type" => "application/json" }) @lexicon = lexicon @args_list = args_list @server = server @headers = headers end |
Instance Attribute Details
#args_list ⇒ Object
Returns the value of attribute args_list.
25 26 27 |
# File 'lib/xrpc/lexicon.rb', line 25 def args_list @args_list end |
#headers ⇒ Object
Returns the value of attribute headers.
25 26 27 |
# File 'lib/xrpc/lexicon.rb', line 25 def headers @headers end |
#lexicon ⇒ Object
Returns the value of attribute lexicon.
25 26 27 |
# File 'lib/xrpc/lexicon.rb', line 25 def lexicon @lexicon end |
#server ⇒ Object
Returns the value of attribute server.
25 26 27 |
# File 'lib/xrpc/lexicon.rb', line 25 def server @server end |
Instance Method Details
#call(*args, **kwargs) ⇒ Object
34 35 36 |
# File 'lib/xrpc/lexicon.rb', line 34 def call(*args, **kwargs) make_request(Hash[args_list.zip(args)].merge kwargs) end |
#make_request(payload) ⇒ Object
38 39 40 |
# File 'lib/xrpc/lexicon.rb', line 38 def make_request(payload) raise NotImplementedError, "Subclasses must implement the .make_request method." end |