Class: Rubeetup::Requester
- Inherits:
-
Object
- Object
- Rubeetup::Requester
- Includes:
- Utilities
- Defined in:
- lib/rubeetup/requester.rb
Overview
Requester instances perform requests for the user
Instance Attribute Summary collapse
-
#auth ⇒ Hash{Symbol=>String}
This Requester’s auth data.
-
#request_builder ⇒ Symbol
readonly
The chosen request builder.
Instance Method Summary collapse
-
#initialize(args) ⇒ Requester
constructor
A new instance of Requester.
-
#method_missing(name, *args) ⇒ Array<Rubeetup::ResponseWrapper>
Performs the actual request, by dynamically creating a Request instance, and by then executing it.
Methods included from Utilities
#blank?, #collection_symbolyzer, #present?, #stringify
Constructor Details
#initialize(args) ⇒ Requester
Returns a new instance of Requester.
24 25 26 27 |
# File 'lib/rubeetup/requester.rb', line 24 def initialize(args) self.auth = args @request_builder = Rubeetup::RequestBuilder end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Array<Rubeetup::ResponseWrapper>
Performs the actual request, by dynamically creating a Request instance, and by then executing it.
49 50 51 52 53 |
# File 'lib/rubeetup/requester.rb', line 49 def method_missing(name, *args) merge_auth(args) request = request_builder.compose_request(name, args) request.execute end |
Instance Attribute Details
#auth ⇒ Hash{Symbol=>String}
Returns this Requester’s auth data.
13 14 15 |
# File 'lib/rubeetup/requester.rb', line 13 def auth @auth end |
#request_builder ⇒ Symbol (readonly)
Returns the chosen request builder.
18 19 20 |
# File 'lib/rubeetup/requester.rb', line 18 def request_builder @request_builder end |