Class: LedgerSync::QuickBooksOnline::OAuthClient::RedirectURIParser
- Inherits:
-
Object
- Object
- LedgerSync::QuickBooksOnline::OAuthClient::RedirectURIParser
- Defined in:
- lib/ledger_sync/quickbooks_online/oauth_client.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(uri:) ⇒ RedirectURIParser
constructor
A new instance of RedirectURIParser.
- #parsed_uri ⇒ Object
- #query ⇒ Object
- #realm_id ⇒ Object
- #redirect_uri ⇒ Object
Constructor Details
#initialize(uri:) ⇒ RedirectURIParser
Returns a new instance of RedirectURIParser.
13 14 15 |
# File 'lib/ledger_sync/quickbooks_online/oauth_client.rb', line 13 def initialize(uri:) @uri = uri end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
11 12 13 |
# File 'lib/ledger_sync/quickbooks_online/oauth_client.rb', line 11 def uri @uri end |
Instance Method Details
#code ⇒ Object
17 18 19 |
# File 'lib/ledger_sync/quickbooks_online/oauth_client.rb', line 17 def code @code ||= query.fetch('code').first end |
#parsed_uri ⇒ Object
21 22 23 |
# File 'lib/ledger_sync/quickbooks_online/oauth_client.rb', line 21 def parsed_uri @parsed_uri = URI.parse(uri) end |
#query ⇒ Object
25 26 27 |
# File 'lib/ledger_sync/quickbooks_online/oauth_client.rb', line 25 def query @query ||= CGI.parse(parsed_uri.query) end |
#realm_id ⇒ Object
29 30 31 |
# File 'lib/ledger_sync/quickbooks_online/oauth_client.rb', line 29 def realm_id @realm_id ||= query.fetch('realmId').first end |
#redirect_uri ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ledger_sync/quickbooks_online/oauth_client.rb', line 33 def redirect_uri @redirect_uri ||= begin use_uri = parsed_uri.dup use_uri.fragment = nil use_uri.query = nil ret = use_uri.to_s ret = ret[0..-2] if ret.end_with?('/') ret end end |