Class: Dashdate::Publisher

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(notifier) ⇒ Publisher

Returns a new instance of Publisher.



6
7
8
# File 'lib/publisher.rb', line 6

def initialize notifier
  @notifier = notifier
end

Class Method Details

.buildObject



9
10
11
# File 'lib/publisher.rb', line 9

def self.build
  new(Dashdate::Notifier.build)
end

Instance Method Details

#update(widget, values, auth) ⇒ Object



12
13
14
15
16
17
# File 'lib/publisher.rb', line 12

def update(widget, values, auth)
  url = "http://localhost:3030/widgets/#{widget.to_s}"
  values[:auth_token] = auth
  result = HTTParty.post(url, :body => values.to_json)
  @notifier.received_http_response_code(result.code)
end