Class: OAuthClient::Adapters::Xml

Inherits:
Object
  • Object
show all
Defined in:
lib/oauth_client/adapters/xml.rb

Overview

Xml Adapter for OAuthClient

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Xml

on creation, the adapter must be supplied with the client



9
10
11
# File 'lib/oauth_client/adapters/xml.rb', line 9

def initialize(client)
  self.client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



6
7
8
# File 'lib/oauth_client/adapters/xml.rb', line 6

def client
  @client
end

Instance Method Details

#get(url) ⇒ Object

make a GET request and parse Xml response



14
15
16
17
# File 'lib/oauth_client/adapters/xml.rb', line 14

def get(url)
  oauth_response = self.client.get(url)
  Nokogiri::XML::Document.parse(oauth_response.body)
end

#post(url, params = {}) ⇒ Object

make a GET request and parse Xml response



20
21
22
23
# File 'lib/oauth_client/adapters/xml.rb', line 20

def post(url, params = {})
  oauth_response = self.client.post(url, params)
  Nokogiri::XML::Document.parse(oauth_response.body)
end