Class: Mirror::Api::Resource
- Inherits:
-
Object
- Object
- Mirror::Api::Resource
- Defined in:
- lib/mirror-api/resource.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #create(params) ⇒ Object (also: #insert)
- #delete(id, params = nil) ⇒ Object
- #get(id, params = nil) ⇒ Object
-
#initialize(credentials, resource_name = Request::TIMELINE, options = {}) ⇒ Resource
constructor
A new instance of Resource.
- #list(*args) ⇒ Object
- #patch(id, params) ⇒ Object
- #update(id, params) ⇒ Object
Constructor Details
#initialize(credentials, resource_name = Request::TIMELINE, options = {}) ⇒ Resource
Returns a new instance of Resource.
9 10 11 12 13 14 15 |
# File 'lib/mirror-api/resource.rb', line 9 def initialize(credentials, resource_name=Request::TIMELINE, ={}) @credentials = credentials @resource_name = resource_name self. = || {} raise "Invalid credentials #{credentials}" unless @credentials end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/mirror-api/resource.rb', line 7 def @options end |
Instance Method Details
#create(params) ⇒ Object Also known as: insert
21 22 23 |
# File 'lib/mirror-api/resource.rb', line 21 def create(params) Request.new(@credentials, (params)).post end |
#delete(id, params = nil) ⇒ Object
39 40 41 |
# File 'lib/mirror-api/resource.rb', line 39 def delete(id, params=nil) Request.new(@credentials, (id, params)).delete end |
#get(id, params = nil) ⇒ Object
26 27 28 |
# File 'lib/mirror-api/resource.rb', line 26 def get(id, params=nil) Request.new(@credentials, (id, params)).get end |
#list(*args) ⇒ Object
17 18 19 |
# File 'lib/mirror-api/resource.rb', line 17 def list(*args) handle_list(args) end |