class Gfycat::JsonClient

Public Class Methods

new(url, options = {}) click to toggle source
# File lib/gfycat/json_client.rb, line 5
def initialize(url, options = {})
  options = options.dup

  @conn = Faraday.new(url: url) do |conn|
    conn.response :snake_case_keys
    conn.response :json, content_type: /\bjson$/
    
    conn.options.update(options)

    conn.adapter Faraday.default_adapter
  end
end

Public Instance Methods

get(path, params = {}) click to toggle source
# File lib/gfycat/json_client.rb, line 18
def get(path, params = {})
  @conn.get(path, params).body
end