Class: Gecko::Pusher::Channel::Map
- Defined in:
- lib/gecko-pusher/channel/map.rb
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Gecko::Pusher::Channel::Base
Instance Method Details
#push(*args) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gecko-pusher/channel/map.rb', line 6 def push(*args) data = args.map {|arg| point_data, = if arg.is_a?(Array) && arg.length == 2 && arg.last.is_a?(Hash) [arg.first, (arg.last)] else [arg, {}] end if ip_address?(point_data) {ip: point_data}.merge() elsif lat_long?(point_data) {latitude: point_data[0].to_s, longitude: point_data[1].to_s}.merge() elsif address?(point_data) {city: point_data}.merge() elsif hostname?(point_data) {host: point_data}.merge() end } _push({points: { point: data}}) end |