class Simplecast::Client
Public Class Methods
new(options = {})
click to toggle source
# File lib/simplecast/client.rb, line 7 def initialize(options = {}) # Use options passed in, but fall back to module defaults Simplecast::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", options[key] || Simplecast.instance_variable_get(:"@#{key}")) end @client = Hurley::Client.new('https://api.simplecast.com/v1/') @client.header["X-API-KEY"] = @api_key @client end
Public Instance Methods
get(url)
click to toggle source
# File lib/simplecast/client.rb, line 27 def get(url) response = @client.get(url) JSON.parse(response.body) end
request(method, path, data, options = {})
click to toggle source
# File lib/simplecast/client.rb, line 16 def request(method, path, data, options = {}) if data.is_a?(Hash) options[:query] = data.delete(:query) || {} options[:headers] = data.delete(:headers) || {} if accept = data.delete(:accept) options[:headers][:accept] = accept end end @last_response = response = @client.send(method, URI::Parser.new.escape(path.to_s), data, options) response.data end