Method: Tmdb::Search#fetch_response

Defined in:
lib/themoviedb/search.rb

#fetch_response(conditions = {}) ⇒ Object

Send back whole response



64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/themoviedb/search.rb', line 64

def fetch_response(conditions={})
  if conditions[:external_source]
    options = @params.merge(Api.config.merge({external_source: conditions[:external_source]}))
  else
    options = @params.merge(Api.config)
  end
  response = Api.get(@resource, :query => options)

  original_etag = response.headers.fetch('etag', '')
  etag = original_etag.gsub(/"/, '')

  Api.set_response({'code' => response.code, 'etag' => etag})
  return response.to_hash
end