Sha256: 1686253f73a8ffb6bfeb68417bd5d4d65cb2d81dea172b7cf7c1240eec74c3f4
Contents?: true
Size: 979 Bytes
Versions: 1
Compression:
Stored size: 979 Bytes
Contents
require 'rest-client' require 'oj' module SiebelDonations class Base def initialize(json = {}) json.each do |key, value| instance_variable_set("@#{key.underscore}", value) end end def self.get(path, params) raise 'You need to configure SiebelDonations with your oauth_token.' unless SiebelDonations.oauth_token params[:response_timeout] ||= SiebelDonations.default_timeout url = SiebelDonations.base_url + path RestClient::Request.execute(:method => :get, :url => url, :headers => {params: params, authorization: "Bearer #{SiebelDonations.oauth_token}"}, :timeout => -1) { |response, request, result, &block| case response.code when 200 Oj.load(response) else puts response.inspect puts request.inspect raise result.inspect end } end def self.find(params) get(path, params).collect { |json| new(json) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
siebel_donations-1.0.2 | lib/siebel_donations/base.rb |