Class: Polycom::Pusher

Inherits:
Object
  • Object
show all
Defined in:
lib/polycom/pusher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Pusher

Returns a new instance of Pusher.



10
11
12
13
14
# File 'lib/polycom/pusher.rb', line 10

def initialize(args)
  args.each do |k, v|
    instance_variable_set("@#{k}", v) unless v.nil?
  end
end

Instance Attribute Details

#ip_addressObject

Returns the value of attribute ip_address.



8
9
10
# File 'lib/polycom/pusher.rb', line 8

def ip_address
  @ip_address
end

#passwordObject

Returns the value of attribute password.



8
9
10
# File 'lib/polycom/pusher.rb', line 8

def password
  @password
end

#usernameObject

Returns the value of attribute username.



8
9
10
# File 'lib/polycom/pusher.rb', line 8

def username
  @username
end

Instance Method Details

#send(h) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/polycom/pusher.rb', line 17

def send(h)
  priority = h.fetch(:priority, :critical).to_s.capitalize
  data = h.fetch(:data, nil)
  url = h.fetch(:url, nil)
  
  if data.nil? && url.nil?
    raise "Either :data or :url must be passed to this method"
  end
  
  push_data(priority, data) unless data.nil?
  push_url(priority, url) unless url.nil?
end