Class: EventbriteAPI::Request
- Inherits:
-
Object
- Object
- EventbriteAPI::Request
- Includes:
- HTTParty
- Defined in:
- lib/rubybrite/request.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#query ⇒ Object
Returns the value of attribute query.
Instance Method Summary collapse
- #delete ⇒ Object
- #get ⇒ Object
-
#initialize(path = "", query = {}) ⇒ Request
constructor
A new instance of Request.
- #method_missing(method, *args) ⇒ Object
- #post ⇒ Object
Constructor Details
#initialize(path = "", query = {}) ⇒ Request
Returns a new instance of Request.
8 9 10 11 |
# File 'lib/rubybrite/request.rb', line 8 def initialize(path = "", query = {}) @path = path @query = query end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/rubybrite/request.rb', line 28 def method_missing(method, *args) params = args[0].is_a?(Hash) ? args[0] : {} route, token = path.split("?") id = params.delete(:id) route += "/#{method}/#{id}?#{token}" Request.new(route, params) end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/rubybrite/request.rb', line 6 def path @path end |
#query ⇒ Object
Returns the value of attribute query.
6 7 8 |
# File 'lib/rubybrite/request.rb', line 6 def query @query end |
Instance Method Details
#delete ⇒ Object
23 24 25 26 |
# File 'lib/rubybrite/request.rb', line 23 def delete response = self.class.delete(path, query: query).body Response.new(response) end |