Class: GmailOAuth::Client
- Inherits:
-
Object
- Object
- GmailOAuth::Client
- Defined in:
- lib/gmail-oauth/client.rb
Overview
Client.new(“[email protected]”, :access_token => @access_token) Client.new(“[email protected]”, :consumer => @consumer)
Instance Method Summary collapse
-
#initialize(email_address, options = {}) ⇒ Client
constructor
A new instance of Client.
- #xoauth_string ⇒ Object
Constructor Details
#initialize(email_address, options = {}) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/gmail-oauth/client.rb', line 5 def initialize(email_address, = {}) raise ArgumentError, "Must provide either an access token (3legged oauth) or a consumer (2legged oauth)" if [:access_token].nil? && [:consumer].nil? @email_address = email_address @access_token = [:access_token] if @access_token @consumer = @access_token.consumer else @consumer = [:consumer] end @service = [:service] || :imap end |
Instance Method Details
#xoauth_string ⇒ Object
18 19 20 21 22 23 |
# File 'lib/gmail-oauth/client.rb', line 18 def xoauth_string params = request["parameters"].merge("oauth_signature" => signature) prefix = "GET #{request["uri"]} " prefix + params.keys.sort.select { |k| k != "xoauth_requestor_id" }.collect { |k| "#{k}=\"#{CGI.escape(params[k])}\"" }.join(",") end |