Class: ZooniverseSocial::Updater
- Inherits:
-
Object
- Object
- ZooniverseSocial::Updater
- Defined in:
- lib/zooniverse_social/updater.rb
Instance Method Summary collapse
-
#initialize(host, path) ⇒ Updater
constructor
A new instance of Updater.
- #update(*args) ⇒ Object
Constructor Details
#initialize(host, path) ⇒ Updater
Returns a new instance of Updater.
5 6 7 8 |
# File 'lib/zooniverse_social/updater.rb', line 5 def initialize(host, path) @connection = Faraday.new host @path = path end |
Instance Method Details
#update(*args) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/zooniverse_social/updater.rb', line 10 def update(*args) response = @connection.get(@path, *args) do |req| req.headers['Accept'] = 'application/json' req.headers['Content-Type'] = 'application/json' end JSON.parse response.body end |