Sha256: 356af1b0a0576b4fe8d473da2cf90a70da38f8b1c07914227bfe20b6675de910

Contents?: true

Size: 474 Bytes

Versions: 5

Compression:

Stored size: 474 Bytes

Contents

module Ravelry
  module Utils
    module Request
      extend self

      def get(url, key, params={})
        request = Typhoeus::Request.get(
          "https://api.ravelry.com/#{url}",
          userpwd: "#{Ravelry.configuration.access_key}:#{Ravelry.configuration.personal_key}",
          params: params
        )

        data = JSON.parse(request.response_body, {symbolize_names: true})
        return data[key] if key
        return data
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ravelry-0.2.0 lib/ravelry/utils/request.rb
ravelry-0.1.0 lib/ravelry/utils/request.rb
ravelry-0.0.9 lib/ravelry/utils/request.rb
ravelry-0.0.8 lib/ravelry/utils/request.rb
ravelry-0.0.7 lib/ravelry/utils/request.rb