Class: Coinsetter::ClientSession

Inherits:
Model
  • Object
show all
Defined in:
lib/coinsetter/client_session.rb

Instance Attribute Summary collapse

Attributes inherited from Model

#error, #message

Instance Method Summary collapse

Methods inherited from Model

#attributes, #attributes=, #initialize

Constructor Details

This class inherits a constructor from Coinsetter::Model

Instance Attribute Details

#customer_uuidObject

Returns the value of attribute customer_uuid.



3
4
5
# File 'lib/coinsetter/client_session.rb', line 3

def customer_uuid
  @customer_uuid
end

#user_nameObject

Returns the value of attribute user_name.



3
4
5
# File 'lib/coinsetter/client_session.rb', line 3

def user_name
  @user_name
end

#uuidObject

Returns the value of attribute uuid.



3
4
5
# File 'lib/coinsetter/client_session.rb', line 3

def uuid
  @uuid
end

Instance Method Details

#call(action = 'HEARTBEAT') ⇒ Object



17
18
19
20
21
22
23
# File 'lib/coinsetter/client_session.rb', line 17

def call(action='HEARTBEAT')
  Coinsetter::Net.put(
    path,
    {action: action},
    {"coinsetter-client-session-id" => uuid}
  )
end

#destroy!Object



5
6
7
# File 'lib/coinsetter/client_session.rb', line 5

def destroy!
  parse call("LOGOUT")
end

#heartbeatObject



9
10
11
# File 'lib/coinsetter/client_session.rb', line 9

def heartbeat
  parse call("HEARTBEAT")
end

#parse(string) ⇒ Object



25
26
27
# File 'lib/coinsetter/client_session.rb', line 25

def parse(string)
  Coinsetter::Helper.parse_message! string
end

#pathObject



13
14
15
# File 'lib/coinsetter/client_session.rb', line 13

def path
  "clientSession/#{uuid}"
end