class SPOT::Resources::Message
Attributes
battery_state[R]
content[R]
created_at[R]
id[R]
latitude[R]
longitude[R]
messenger_id[R]
messenger_model[R]
messenger_name[R]
response[R]
show_custom_message[R]
type[R]
Public Class Methods
new(object, response = nil)
click to toggle source
# File lib/spot-gps/resources/message.rb, line 19 def initialize(object, response = nil) @id = object.fetch('id') @created_at = Time.at(object.fetch('unixTime')) @type = object.fetch('messageType') @latitude = object.fetch('latitude') @longitude = object.fetch('longitude') @battery_state = object.fetch('batteryState') @hidden = object.fetch('hidden') == 1 @show_custom_message = object.fetch('showCustomMsg') == "Y" @content = object.fetch('messageContent', nil) @messenger_id = object.fetch('messengerId') @messenger_name = object.fetch('messengerName') @messenger_model = object.fetch('modelId') @object = object @response = response end
Public Instance Methods
inspect()
click to toggle source
# File lib/spot-gps/resources/message.rb, line 53 def inspect attr_list = to_h.map { |key, value| "#{key}: #{value.inspect}" }.join(', ') "#<#{self.class} #{attr_list}>" end
to_h()
click to toggle source
# File lib/spot-gps/resources/message.rb, line 37 def to_h @hash ||= begin attribute_ivars = (instance_variables - [:@response, :@object, :@hash]) attribute_ivars.each_with_object({}) do |ivar, hash| hash[ivar.to_s.delete('@').to_sym] = instance_variable_get(ivar) end end end
to_raw_h()
click to toggle source
# File lib/spot-gps/resources/message.rb, line 49 def to_raw_h @object end