Class: Line::Bot::Message::Location

Inherits:
Base
  • Object
show all
Defined in:
lib/line/bot/message/location.rb

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

#[], #event_type, #initialize

Constructor Details

This class inherits a constructor from Line::Bot::Message::Base

Instance Method Details

#contentObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/line/bot/message/location.rb', line 8

def content
  {
    contentType: ContentType::LOCATION,
    toType: 1,
    text: attrs[:address] || attrs[:title],
    location: {
      title: attrs[:title],
      address: attrs[:address],
      latitude: attrs[:latitude],
      longitude: attrs[:longitude],
    }
  }
end

#valid?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/line/bot/message/location.rb', line 22

def valid?
  attrs[:title] && attrs[:latitude] && attrs[:longitude]
end