Class: Dynectastic::Session
- Defined in:
- lib/dynectastic/session.rb
Instance Attribute Summary collapse
-
#api_version ⇒ Object
readonly
Returns the value of attribute api_version.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Attributes inherited from Resource
#factory, #last_request, #session
Instance Method Summary collapse
- #entity_base ⇒ Object
-
#initialize(customer_name, user_name, password) ⇒ Session
constructor
A new instance of Session.
- #nodes ⇒ Object
- #records ⇒ Object
- #zones ⇒ Object
Methods inherited from Resource
#attributes=, #delete, #get, #post, #put
Constructor Details
#initialize(customer_name, user_name, password) ⇒ Session
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/dynectastic/session.rb', line 7 def initialize(customer_name, user_name, password) payload = { :customer_name => customer_name, :user_name => user_name, :password => password }.to_json response = post(entity_base, :body => payload) @token = response['token'] @api_version = response['version'] end |
Instance Attribute Details
#api_version ⇒ Object (readonly)
Returns the value of attribute api_version.
5 6 7 |
# File 'lib/dynectastic/session.rb', line 5 def api_version @api_version end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
5 6 7 |
# File 'lib/dynectastic/session.rb', line 5 def token @token end |
Instance Method Details
#entity_base ⇒ Object
31 32 33 |
# File 'lib/dynectastic/session.rb', line 31 def entity_base "/REST/Session" end |
#nodes ⇒ Object
23 24 25 |
# File 'lib/dynectastic/session.rb', line 23 def nodes Dynectastic::NodeFactory.new(self) end |
#records ⇒ Object
27 28 29 |
# File 'lib/dynectastic/session.rb', line 27 def records Dynectastic::RecordFactory.new(self) end |
#zones ⇒ Object
19 20 21 |
# File 'lib/dynectastic/session.rb', line 19 def zones Dynectastic::ZoneFactory.new(self) end |