Class: LedgerSync::Xero::Request
- Inherits:
-
Ledgers::Request
- Object
- Ledgers::Request
- LedgerSync::Xero::Request
- Defined in:
- lib/ledger_sync/xero/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/xero/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/xero/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 |
# File 'lib/ledger_sync/xero/request.rb', line 13 def perform raise 'Request already performed' if performed? @response = generate_response( body: body, headers: headers, method: method, url: url ) ensure @performed = true end |
#refresh! ⇒ Object
26 27 28 29 30 |
# File 'lib/ledger_sync/xero/request.rb', line 26 def refresh! oauth.refresh! rescue OAuth2::Error => e raise e # parse_error(error: e) end |