Sha256: cb7edfbc5d257f7ad65396dc90fadf0b6f86273cb6e101ad3ccdb2d7aff99d82

Contents?: true

Size: 518 Bytes

Versions: 1

Compression:

Stored size: 518 Bytes

Contents

module Itrigga
  module NetHelper
    class RestClient
   
      def self.get( opts={} )
        raise ArgumentError.new(":url is required") unless opts[:url]
        
        # rest_client expects :user and not :username
        opts[:user] ||= opts.delete(:username) if opts[:username]
        
        opts[:headers] = {:params => opts.delete(:params)} if opts[:params]
        
        response = ::RestClient::Request.new(opts.merge(:method => :get)).execute
        response.to_str
      end
  
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
itrigga-net_helper-0.3.0 lib/itrigga/net_helper/rest_client.rb