class Strutta::APIObject
@abstract APIObject
contains all the HTTP request methods
Attributes
game[RW]
Public Instance Methods
all(params = {})
click to toggle source
GET index request (Uses instance vars of child object to generate resource path)
@return [Hash] Parsed body of the API
response
# File lib/strutta-api/api_object.rb, line 12 def all(params = {}) @game.verify_no_id(@id) @game.all(params, "#{@game.id}/#{@root_path}") end
create(params = {})
click to toggle source
POST request (Uses instance vars of child object to generate resource path)
@return [Hash] Parsed body of the API
response
# File lib/strutta-api/api_object.rb, line 21 def create(params = {}) @game.verify_no_id(@id) @game.create(params, "#{@game.id}/#{@root_path}") end
delete()
click to toggle source
DELETE request (Uses instance vars of child object to generate resource path)
@return [Hash] Parsed body of the API
response
# File lib/strutta-api/api_object.rb, line 48 def delete @game.verify_id(@id, Errors::ROUND_ID_REQUIRED) @game.delete(@root_path) end
get(params = {})
click to toggle source
GET request (Uses instance vars of child object to generate resource path)
@return [Hash] Parsed body of the API
response
# File lib/strutta-api/api_object.rb, line 30 def get(params = {}) @game.verify_id(@id, Errors::ROUND_ID_REQUIRED) @game.get(params, @root_path) end
method_disabled(*_)
click to toggle source
Manually disable a method in child classed
# File lib/strutta-api/api_object.rb, line 54 def method_disabled(*_) fail Errors::DisabledEndpointError, Errors::METHOD_DISABLED end
update(params = {})
click to toggle source
PATCH request (Uses instance vars of child object to generate resource path)
@return [Hash] Parsed body of the API
response
# File lib/strutta-api/api_object.rb, line 39 def update(params = {}) @game.verify_id(@id, Errors::ROUND_ID_REQUIRED) @game.update(params, @root_path) end