Class: OTX::Subscribed
Overview
Within the OTX system you are able to subscribe to pulses from other users, this class allows the retreival of the currently subscribed pulse feeds and the associated pulses
Instance Method Summary collapse
-
#get_all(limit = 20) ⇒ Array
Get all subscribed pulses from the API, get all events in chunks defined by limit.
-
#get_since(timestamp, limit = 20) ⇒ Array
Get all subscribed pulses from the API, get all events in chunks defined by limit and since timestamp.
Methods inherited from Base
Constructor Details
This class inherits a constructor from OTX::Base
Instance Method Details
#get_all(limit = 20) ⇒ Array
Get all subscribed pulses from the API, get all events in chunks defined by limit
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/otx_ruby/subscribed.rb', line 14 def get_all(limit=20) uri = '/api/v1/pulses/subscribed' params = {limit: limit} pulses = [] begin json_data = get(uri, params) page = json_data['next'] params = URI::decode_www_form(URI(page).query).to_h unless page.nil? pulses += json_data['results'] end while !page.nil? results = [] pulses.each do |pulse| results << OTX::Pulse.new(pulse) end return results end |
#get_since(timestamp, limit = 20) ⇒ Array
Get all subscribed pulses from the API, get all events in chunks defined by limit and since timestamp
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/otx_ruby/subscribed.rb', line 43 def get_since(, limit=20) uri = '/api/v1/pulses/subscribed' params = {limit: limit, modified_since: } pulses = [] begin json_data = get(uri, params) page = json_data['next'] params = URI::decode_www_form(URI(page).query).to_h unless page.nil? pulses += json_data['results'] end while !page.nil? results = [] pulses.each do |pulse| results << OTX::Pulse.new(pulse) end return results end |