Sha256: 45ce46e6c7933994676647ca25ca3c75dc3f8dd81c4902d39c2e8e2a3e1a048a

Contents?: true

Size: 761 Bytes

Versions: 2

Compression:

Stored size: 761 Bytes

Contents

module Organizai
  class Provider
    
    def self.request(method,resource,endpoint,data,token=nil)
      
      formatted_uri  = "#{Organizai.protocol}://#{HOST[Organizai.api_env]}#{endpoint}.#{Organizai.format}"
      
      formatted_data = case Organizai.format
        when :json
          ActiveSupport::JSON.encode(data)
        when :xml
          data.to_xml :root => resource
        end
        
      current_consumer = Organizai.current_consumer
      oauth_consumer = OAuth::Consumer.new(current_consumer.key, current_consumer.secret)
      response = oauth_consumer.request(method,formatted_uri,token,{},{resource => formatted_data})
      
      response_object = Organizai::Response.new(response,Organizai.format)
      
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
organizai-0.1.1 lib/organizai/provider.rb
organizai-0.1.0 lib/organizai/provider.rb