Sha256: 9109c87769e805fba45af22a9b96cf40b8687e3d805bd1fc5b78e34c0b487d92

Contents?: true

Size: 646 Bytes

Versions: 2

Compression:

Stored size: 646 Bytes

Contents

require 'json'
module OAuthClient
  module Adapters
    # Json Adapter for OAuthClient
    class Json
      attr_accessor :client
  
      # on creation, the adapter must be supplied with the client
      def initialize(client)
        self.client = client
      end
  
      # make a GET request and parse JSON response
      def get(url)
        oauth_response = self.client.get(url)
        JSON.parse(oauth_response.body)
      end
  
      # make a GET request and parse JSON response
      def post(url, params = {})
        oauth_response = self.client.post(url, params)
        JSON.parse(oauth_response.body)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
marcinbunsch-oauth_client-0.2.1 lib/oauth_client/adapters/json.rb
oauth-client-0.1.0 lib/oauth_client/adapters/json.rb