qbwc 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,5 +31,8 @@ QBWC.configure do |c|
31
31
  # :stop
32
32
  # :continue
33
33
  c.on_error = :stop
34
+
35
+ # Rails Cache Hot Boot (Check the rails cache for existing API object to speed app boot)
36
+ c.warm_boot = true
34
37
 
35
38
  end
@@ -40,8 +40,12 @@ module QBWC
40
40
 
41
41
  # Quickbooks Type (either :qb or :qbpos)
42
42
  mattr_reader :api, :parser
43
- @@api= ::Quickbooks::API[:qb]
43
+ @@api = :qb #::Quickbooks::API[:qb]
44
44
 
45
+ # Check Rails Cache for Parser before boot
46
+ mattr_accessor :warm_boot
47
+ @@warm_boot = true
48
+
45
49
  class << self
46
50
 
47
51
  def add_job(name, &block)
@@ -57,7 +61,13 @@ class << self
57
61
  def api=(api)
58
62
  raise 'Quickbooks type must be :qb or :qbpos' unless [:qb, :qbpos].include?(api)
59
63
  @@api = api
60
- @@parser = ::Quickbooks::API[api]
64
+ if @@warm_boot
65
+ ::Rails.logger.warn "using warm boot"
66
+ @@parser = ::Rails.cache.read("qb_api_#{api}") || ::Quickbooks::API[api]
67
+ ::Rails.cache.write("qb_api_#{api}", @@parser)
68
+ else
69
+ @@parser = ::Quickbooks::API[api]
70
+ end
61
71
  end
62
72
 
63
73
  # Allow configuration overrides
@@ -1,3 +1,3 @@
1
1
  module QBWC
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qbwc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-08-29 00:00:00.000000000 Z
14
+ date: 2012-11-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: quickbooks_api