Class: Pickpoint::Device

Inherits:
Struct
  • Object
show all
Defined in:
lib/pickpoint/devices.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



7
8
9
# File 'lib/pickpoint/devices.rb', line 7

def created_at
  @created_at
end

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



7
8
9
# File 'lib/pickpoint/devices.rb', line 7

def description
  @description
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



7
8
9
# File 'lib/pickpoint/devices.rb', line 7

def id
  @id
end

#last_locationObject

Returns the value of attribute last_location

Returns:

  • (Object)

    the current value of last_location



7
8
9
# File 'lib/pickpoint/devices.rb', line 7

def last_location
  @last_location
end

#metadataObject

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



7
8
9
# File 'lib/pickpoint/devices.rb', line 7

def 
  @metadata
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



7
8
9
# File 'lib/pickpoint/devices.rb', line 7

def name
  @name
end

#secretObject

Returns the value of attribute secret

Returns:

  • (Object)

    the current value of secret



7
8
9
# File 'lib/pickpoint/devices.rb', line 7

def secret
  @secret
end

#statusObject

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



7
8
9
# File 'lib/pickpoint/devices.rb', line 7

def status
  @status
end

#tracks_countObject

Returns the value of attribute tracks_count

Returns:

  • (Object)

    the current value of tracks_count



7
8
9
# File 'lib/pickpoint/devices.rb', line 7

def tracks_count
  @tracks_count
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



7
8
9
# File 'lib/pickpoint/devices.rb', line 7

def type
  @type
end

#uidObject

Returns the value of attribute uid

Returns:

  • (Object)

    the current value of uid



7
8
9
# File 'lib/pickpoint/devices.rb', line 7

def uid
  @uid
end

#updated_atObject

Returns the value of attribute updated_at

Returns:

  • (Object)

    the current value of updated_at



7
8
9
# File 'lib/pickpoint/devices.rb', line 7

def updated_at
  @updated_at
end

Class Method Details

.from_hash(d) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/pickpoint/devices.rb', line 12

def self.from_hash(d)
  d = d.transform_keys(&:to_s)
  new(
    id: (d["id"] || 0).to_i,
    uid: (d["uid"] || "").to_s,
    name: (d["name"] || "").to_s,
    status: (d["status"] || "").to_s,
    description: d["description"],
    tracks_count: (d["tracksCount"] || 0).to_i,
    type: (d["type"] || "").to_s,
    secret: (d["secret"] || "").to_s,
    metadata: d["metadata"],
    created_at: (d["createdAt"] || "").to_s,
    updated_at: (d["updatedAt"] || "").to_s,
    last_location: d["lastLocation"]
  )
end