Module: CloudConnect::Units::UnitMethods

Defined in:
lib/cloud_connect/client/units.rb

Instance Method Summary (collapse)

Instance Method Details

- (Integer lat, Integer long) location

Return the last known location of a specific unit

Returns:

  • (Integer lat, Integer long)

    Latitude, Longitude



60
61
62
# File 'lib/cloud_connect/client/units.rb', line 60

def location
  [lat.to_f / 100_000, lng.to_f / 100_000]
end

- (Hashie::Mash) send_message(channel, content, opts = {})

Send a message to the unit

Parameters:

  • channel (Integer)
  • content (String)
  • opts (Hash) (defaults to: {})

Returns:

  • (Hashie::Mash)

    The message

See Also:



71
72
73
74
# File 'lib/cloud_connect/client/units.rb', line 71

def send_message(channel, content, opts = {})
  raise "Unknown unit id, try providing :ret => 'id' when fetching units from the API." unless id && id > 0
  _cloud_connect.send_message(id, channel, content, opts)
end