Module: Poms::MergedSeries
Overview
Methods for working with the merged series api from NPO.
Constant Summary collapse
- TEST_URL =
'https://rs-test.poms.omroep.nl/v1/api/media/redirects/'.freeze
- PRODUCTION_URL =
'https://rs.poms.omroep.nl/v1/api/media/redirects/'.freeze
Instance Method Summary collapse
-
#serie_mids(api_url = PRODUCTION_URL, key = '', secret = '', origin = '') ⇒ Hash
Gets the merged serie mids as a hash.
Instance Method Details
#serie_mids(api_url = PRODUCTION_URL, key = '', secret = '', origin = '') ⇒ Hash
Gets the merged serie mids as a hash. Expects a JSON response from the server with a ‘map` key. Throws a PomsError if the call timeouts, has an HTTP error or JSON parse error.
19 20 21 22 23 24 25 26 |
# File 'lib/poms/merged_series.rb', line 19 def serie_mids(api_url = PRODUCTION_URL, key = '', secret = '', origin = '') Timeout.timeout(3) do data = Poms::Api::Request.new(api_url, key, secret, origin).call.read JSON.parse(data).fetch('map') end rescue OpenURI::HTTPError, JSON::ParserError, Timeout::Error => e raise Poms::PomsError, e. end |