Class: LedgerSync::Adaptors::QuickBooksOnline::DashboardURLHelper
- Inherits:
-
Object
- Object
- LedgerSync::Adaptors::QuickBooksOnline::DashboardURLHelper
- Defined in:
- lib/ledger_sync/adaptors/quickbooks_online/dashboard_url_helper.rb
Constant Summary collapse
- PRODUCTION_APP_URL_BASE =
'https://qbo.intuit.com/app'
- SANDBOX_APP_URL_BASE =
'https://app.sandbox.qbo.intuit.com/app'
Instance Attribute Summary collapse
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#test ⇒ Object
readonly
Returns the value of attribute test.
Instance Method Summary collapse
-
#initialize(resource:, test:) ⇒ DashboardURLHelper
constructor
A new instance of DashboardURLHelper.
- #production_url ⇒ Object
- #resource_path ⇒ Object
- #sandbox_url ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(resource:, test:) ⇒ DashboardURLHelper
Returns a new instance of DashboardURLHelper.
13 14 15 16 |
# File 'lib/ledger_sync/adaptors/quickbooks_online/dashboard_url_helper.rb', line 13 def initialize(resource:, test:) @resource = resource @test = test end |
Instance Attribute Details
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
10 11 12 |
# File 'lib/ledger_sync/adaptors/quickbooks_online/dashboard_url_helper.rb', line 10 def resource @resource end |
#test ⇒ Object (readonly)
Returns the value of attribute test.
10 11 12 |
# File 'lib/ledger_sync/adaptors/quickbooks_online/dashboard_url_helper.rb', line 10 def test @test end |
Instance Method Details
#production_url ⇒ Object
18 19 20 |
# File 'lib/ledger_sync/adaptors/quickbooks_online/dashboard_url_helper.rb', line 18 def production_url @production_url ||= PRODUCTION_APP_URL_BASE + resource_path end |
#resource_path ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ledger_sync/adaptors/quickbooks_online/dashboard_url_helper.rb', line 22 def resource_path @resource_path = case resource when LedgerSync::Account "/register?accountId=#{resource.ledger_id}" when LedgerSync::Bill "/bill?txnId=#{resource.ledger_id}" when LedgerSync::Customer "/customerdetail?nameId=#{resource.ledger_id}" when LedgerSync::Deposit "/deposit?txnId=#{resource.ledger_id}" when LedgerSync::Expense "/expense?txnId=#{resource.ledger_id}" when LedgerSync::JournalEntry "/journal?txnId=#{resource.ledger_id}" when LedgerSync::LedgerClass "/class" when LedgerSync::Payment "/recvpayment?txnId=#{resource.ledger_id}" when LedgerSync::Transfer "/transfer?txnId=#{resource.ledger_id}" when LedgerSync::Vendor "/vendordetail?nameId=#{resource.ledger_id}" end end |
#sandbox_url ⇒ Object
47 48 49 |
# File 'lib/ledger_sync/adaptors/quickbooks_online/dashboard_url_helper.rb', line 47 def sandbox_url @sandbox_url ||= SANDBOX_APP_URL_BASE + resource_path end |
#url ⇒ Object
51 52 53 54 55 |
# File 'lib/ledger_sync/adaptors/quickbooks_online/dashboard_url_helper.rb', line 51 def url return production_url unless test sandbox_url end |