Class: LedgerSync::QuickBooksOnline::Request
- Inherits:
-
Ledgers::Request
- Object
- Ledgers::Request
- LedgerSync::QuickBooksOnline::Request
- Defined in:
- lib/ledger_sync/quickbooks_online/request.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(*args, client:, **keywords) ⇒ Request
constructor
A new instance of Request.
- #perform ⇒ Object
- #refresh! ⇒ Object
Constructor Details
#initialize(*args, client:, **keywords) ⇒ Request
Returns a new instance of Request.
8 9 10 11 |
# File 'lib/ledger_sync/quickbooks_online/request.rb', line 8 def initialize(*args, client:, **keywords) @client = client super(*args, **keywords) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/ledger_sync/quickbooks_online/request.rb', line 6 def client @client end |
Instance Method Details
#perform ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ledger_sync/quickbooks_online/request.rb', line 13 def perform raise 'Request already performed' if performed? @response = generate_response( body: body, headers: headers, method: method, url: url ) rescue OAuth2::Error => e error = parse_error(error: e) if error.is_a?(Error::LedgerError::AuthenticationError) begin client.refresh! @response = generate_response( body: body, headers: headers, method: method, url: url ) return @response rescue OAuth2::Error => e raise parse_error(error: e) end end raise error end |
#refresh! ⇒ Object
43 44 45 46 47 |
# File 'lib/ledger_sync/quickbooks_online/request.rb', line 43 def refresh! oauth.refresh! rescue OAuth2::Error => e raise parse_error(error: e) end |