Class: Dynectastic::Resource
- Inherits:
-
Object
- Object
- Dynectastic::Resource
- Defined in:
- lib/dynectastic/resource.rb
Direct Known Subclasses
Job, NodeFactory, Record, RecordFactory, Session, Zone, ZoneFactory
Instance Attribute Summary collapse
-
#factory ⇒ Object
readonly
Returns the value of attribute factory.
-
#last_request ⇒ Object
Returns the value of attribute last_request.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Instance Method Summary collapse
- #attributes=(smth) ⇒ Object
- #delete(*args) ⇒ Object
- #get(*args) ⇒ Object
-
#initialize(session, factory = nil) ⇒ Resource
constructor
A new instance of Resource.
- #post(*args) ⇒ Object
- #put(*args) ⇒ Object
Constructor Details
#initialize(session, factory = nil) ⇒ Resource
Returns a new instance of Resource.
8 9 10 11 |
# File 'lib/dynectastic/resource.rb', line 8 def initialize(session, factory=nil) @session = session @factory = factory end |
Instance Attribute Details
#factory ⇒ Object (readonly)
Returns the value of attribute factory.
5 6 7 |
# File 'lib/dynectastic/resource.rb', line 5 def factory @factory end |
#last_request ⇒ Object
Returns the value of attribute last_request.
6 7 8 |
# File 'lib/dynectastic/resource.rb', line 6 def last_request @last_request end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
5 6 7 |
# File 'lib/dynectastic/resource.rb', line 5 def session @session end |
Instance Method Details
#attributes=(smth) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/dynectastic/resource.rb', line 29 def attributes=(smth) return smth unless smth.kind_of?(Hash) smth.each_pair do |name, value| instance_variable_set("@#{ name }", value) end end |
#delete(*args) ⇒ Object
25 26 27 |
# File 'lib/dynectastic/resource.rb', line 25 def delete(*args) request(:delete, *args) end |
#get(*args) ⇒ Object
13 14 15 |
# File 'lib/dynectastic/resource.rb', line 13 def get(*args) request(:get, *args) end |
#post(*args) ⇒ Object
17 18 19 |
# File 'lib/dynectastic/resource.rb', line 17 def post(*args) request(:post, *args) end |
#put(*args) ⇒ Object
21 22 23 |
# File 'lib/dynectastic/resource.rb', line 21 def put(*args) request(:put, *args) end |