Class: Dynectastic::Session

Inherits:
Resource show all
Defined in:
lib/dynectastic/session.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#factory, #last_request, #session

Instance Method Summary collapse

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_versionObject (readonly)

Returns the value of attribute api_version.



5
6
7
# File 'lib/dynectastic/session.rb', line 5

def api_version
  @api_version
end

#tokenObject (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_baseObject



31
32
33
# File 'lib/dynectastic/session.rb', line 31

def entity_base
  "/REST/Session"
end

#nodesObject



23
24
25
# File 'lib/dynectastic/session.rb', line 23

def nodes
  Dynectastic::NodeFactory.new(self)
end

#recordsObject



27
28
29
# File 'lib/dynectastic/session.rb', line 27

def records
  Dynectastic::RecordFactory.new(self)
end

#zonesObject



19
20
21
# File 'lib/dynectastic/session.rb', line 19

def zones
  Dynectastic::ZoneFactory.new(self)
end