Class: MokiRuby::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/moki_ruby/action.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actionObject

Returns the value of attribute action.



3
4
5
# File 'lib/moki_ruby/action.rb', line 3

def action
  @action
end

#client_nameObject

Returns the value of attribute client_name.



3
4
5
# File 'lib/moki_ruby/action.rb', line 3

def client_name
  @client_name
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/moki_ruby/action.rb', line 3

def id
  @id
end

#item_nameObject

Returns the value of attribute item_name.



3
4
5
# File 'lib/moki_ruby/action.rb', line 3

def item_name
  @item_name
end

#last_seenObject

Returns the value of attribute last_seen.



3
4
5
# File 'lib/moki_ruby/action.rb', line 3

def last_seen
  @last_seen
end

#noteObject

Returns the value of attribute note.



3
4
5
# File 'lib/moki_ruby/action.rb', line 3

def note
  @note
end

#payloadObject

Returns the value of attribute payload.



3
4
5
# File 'lib/moki_ruby/action.rb', line 3

def payload
  @payload
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/moki_ruby/action.rb', line 3

def status
  @status
end

#third_party_userObject

Returns the value of attribute third_party_user.



3
4
5
# File 'lib/moki_ruby/action.rb', line 3

def third_party_user
  @third_party_user
end

Class Method Details

.from_hash(input_hash) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/moki_ruby/action.rb', line 5

def self.from_hash(input_hash)
  new_action = self.new

  new_action.id = input_hash["id"]
  new_action.last_seen = input_hash["lastSeen"]
  new_action.action = input_hash["action"]
  new_action.status = input_hash["status"]
  new_action.client_name = input_hash["clientName"]
  new_action.item_name = input_hash["itemName"]
  new_action.third_party_user = input_hash["thirdPartyUser"]
  new_action.payload = input_hash["payload"]
  new_action.note = input_hash["note"]

  new_action
end

Instance Method Details

#to_hashObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/moki_ruby/action.rb', line 21

def to_hash
  {
    "id" => self.id,
    "lastSeen" => self.last_seen,
    "action" => self.action,
    "status" => self.status,
    "clientName" => self.client_name,
    "itemName" => self.item_name,
    "thirdPartyUser" => self.third_party_user,
    "payload" => self.payload,
    "note" => self.note
  }
end