Module: EffectiveQbOnline
- Includes:
- EffectiveGem
- Defined in:
- lib/effective_qb_online.rb,
lib/effective_qb_online/engine.rb,
lib/effective_qb_online/version.rb,
lib/generators/effective_qb_online/install_generator.rb
Defined Under Namespace
Modules: Generators
Classes: Engine
Constant Summary
collapse
- VERSION =
'0.8.3'.freeze
Class Method Summary
collapse
Class Method Details
.api(realm: nil) ⇒ Object
33
34
35
36
37
38
|
# File 'lib/effective_qb_online.rb', line 33
def self.api(realm: nil)
realm ||= Effective::QbRealm.first
return nil if realm.blank?
Effective::QbApi.new(realm: realm)
end
|
.config_keys ⇒ Object
8
9
10
11
12
13
14
15
|
# File 'lib/effective_qb_online.rb', line 8
def self.config_keys
[
:qb_realms_table_name, :qb_receipts_table_name, :qb_receipt_items_table_name,
:mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :mailer_subject,
:oauth_client_id, :oauth_client_secret,
:layout
]
end
|
.mailer_class ⇒ Object
19
20
21
|
# File 'lib/effective_qb_online.rb', line 19
def self.mailer_class
mailer&.constantize || Effective::QbOnlineMailer
end
|
.oauth2_client ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'lib/effective_qb_online.rb', line 23
def self.oauth2_client
OAuth2::Client.new(
oauth_client_id,
oauth_client_secret,
site: 'https://appcenter.intuit.com/connect/oauth2',
authorize_url: 'https://appcenter.intuit.com/connect/oauth2',
token_url: 'https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer'
)
end
|
.skip_order!(order) ⇒ Object
53
54
55
56
57
58
|
# File 'lib/effective_qb_online.rb', line 53
def self.skip_order!(order)
raise 'expected a purchased Effective::Order' unless order.kind_of?(Effective::Order) && order.purchased?
qb_receipt = Effective::QbReceipt.create_from_order!(order)
qb_receipt.skip!
end
|
.sync_order!(order, perform_now: false) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/effective_qb_online.rb', line 40
def self.sync_order!(order, perform_now: false)
raise 'expected a purchased Effective::Order' unless order.kind_of?(Effective::Order) && order.purchased?
if perform_now
qb_receipt = Effective::QbReceipt.create_from_order!(order)
qb_receipt.sync!
else
QbSyncOrderJob.perform_later(order)
end
true
end
|