Module: EventMachine::Instagram::Media
- Included in:
- EventMachine::Instagram
- Defined in:
- lib/em-instagram/api/media.rb
Instance Method Summary collapse
- #fetch_geography(object_id) ⇒ Object
- #fetch_tag(object_id) ⇒ Object
- #media(id) ⇒ Object
- #media_by_geography(object_id, params = {}) ⇒ Object
- #media_by_tag(object_id, params = {}) ⇒ Object
Instance Method Details
#fetch_geography(object_id) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/em-instagram/api/media.rb', line 17 def fetch_geography(object_id) self.logger.debug "fetching #{object_id} updates..." # TODO: figure out if min_id parameter would be appropriate for reading recent tagged media request = media_by_geography(object_id) request.errback { |error| self.logger.debug "fetch error: #{error}"; EventMachine::add_timer(15) { fetch_geography object_id } } request.callback { |media| @update_queue.push(*media) } end |
#fetch_tag(object_id) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/em-instagram/api/media.rb', line 25 def fetch_tag(object_id) self.logger.debug "fetching #{object_id} updates..." # TODO: figure out if max_id or min_id parameter would be appropriate for reading recent tagged media request = media_by_tag(object_id) request.errback { |error| self.logger.debug "fetch error: #{error}"; EventMachine::add_timer(15) { fetch_tag object_id } } request.callback { |media| @update_queue.push(*media) } end |
#media(id) ⇒ Object
4 5 6 |
# File 'lib/em-instagram/api/media.rb', line 4 def media(id) request :get, "/v1/media/#{id}" end |
#media_by_geography(object_id, params = {}) ⇒ Object
8 9 10 |
# File 'lib/em-instagram/api/media.rb', line 8 def media_by_geography(object_id, params = {}) request :get, "/v1/geographies/#{object_id}/media/recent", :query => default_params.merge(params) end |
#media_by_tag(object_id, params = {}) ⇒ Object
12 13 14 |
# File 'lib/em-instagram/api/media.rb', line 12 def media_by_tag(object_id, params = {}) request :get, "/v1/tags/#{object_id}/media/recent", :query => default_params.merge(params) end |