4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/organizai/provider.rb', line 4
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
|