loco_bill 0.0.8 → 0.0.9

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.
Files changed (2) hide show
  1. data/lib/loco_bill/configuration.rb +13 -1
  2. metadata +2 -2
@@ -3,7 +3,7 @@ module LocoBill
3
3
  API_VERSION = "1.0" # :nodoc:
4
4
 
5
5
  class << self
6
- attr_accessor :session_id, :transaction_id, :debug
6
+ attr_accessor :transaction_id, :debug, :_session_id, :_session_id_expiration_time
7
7
  attr_writer :application_key, :username, :password, :org_id
8
8
  end
9
9
 
@@ -29,6 +29,18 @@ module LocoBill
29
29
  "/crudApi"
30
30
  end
31
31
 
32
+ def self.session_id
33
+ # only return a session_id if we have one + it hasn't expired
34
+ self._session_id.present? && Time.now < self._session_id_expiration_time ? self._session_id : nil
35
+ end
36
+
37
+ def self.session_id=(session_id)
38
+ self._session_id=session_id
39
+ self._session_id_expiration_time=Time.now+30.minutes # 35 minutes is the actual session expiration time, but we just rounded it off...
40
+
41
+ self._session_id
42
+ end
43
+
32
44
  def self.server # :nodoc:
33
45
  case environment
34
46
  when :production
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 8
9
- version: 0.0.8
8
+ - 9
9
+ version: 0.0.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - chris mcc