productive 0.5.7 → 0.5.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e53342a3ddbee919074c0e0bbe4cb7e44243ca04
4
- data.tar.gz: 279f678778960b5bc6297f1d4466a62b8874cfc8
3
+ metadata.gz: 61c94b3fee22edc6ae9e7e35119758a6c008d658
4
+ data.tar.gz: 0a788e2771ec2465a9b3a78efa265a4677a4e2eb
5
5
  SHA512:
6
- metadata.gz: a02decb0c7111be5916e5583e774b47324309e186e02ab98fc4bf353929f97b5534a4255068aa1a391489d324426bc8b50922bffbac68de16b2eb931667fb81b
7
- data.tar.gz: 6b38bd78ce71cdd26ec9a1b23cddc43bf3fbd6c5a7a75c85700f9968e43ce445aec1daa87083521cd072e18cc4854ff54f14d65751b106e79e3f993417f25402
6
+ metadata.gz: bd7d5f5222dd4234176037913ae60344747a58b4a6dc6dfdea7d58b594559dee247eeaffacb003e1ea92338879c63bd93be17b14678485c9d8771551eb171f6a
7
+ data.tar.gz: 80d7a2e0bfe7ab978555132ddcefea247d22bb69efbdbe5195793bfa9f79daa67979d327261e0191bd5314b46d02d238dabfaf3fb17d556883ff8d01756a1c4d
data/lib/productive.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'json_api_client'
2
+ require 'request_store'
2
3
 
3
4
  require 'productive/version'
4
5
  require 'productive/configuration'
@@ -43,12 +44,12 @@ module Productive
43
44
  def configure
44
45
  yield configuration
45
46
 
46
- Productive::Base.setup(@configuration)
47
- Productive::BaseAccount.setup(@configuration)
47
+ Productive::Base.setup(configuration)
48
+ Productive::BaseAccount.setup(configuration)
48
49
  end
49
50
 
50
51
  def configuration
51
- @configuration ||= Productive::Configuration.new
52
+ RequestStore.store[:json_api_client_configuration] ||= Productive::Configuration.new
52
53
  end
53
54
  end
54
55
  end
@@ -2,10 +2,35 @@ module Productive
2
2
  class Base < JsonApiClient::Resource
3
3
  PER_PAGE = 1000
4
4
 
5
+ def self.site
6
+ RequestStore.store[:json_api_client_base_site]
7
+ end
8
+
9
+ def self.site=(site)
10
+ RequestStore.store[:json_api_client_base_site] = site
11
+ end
12
+
13
+ def self.connection_options
14
+ RequestStore.store[:json_api_client_base_connection_options]
15
+ end
16
+
17
+ def self.connection_options=(options)
18
+ RequestStore.store[:json_api_client_base_connection_options] = options
19
+ end
20
+
21
+ def self.connection_object
22
+ RequestStore.store[:json_api_client_base_connection_object]
23
+ end
24
+
25
+ def self.connection_object=(connection)
26
+ RequestStore.store[:json_api_client_base_connection_object] = connection
27
+ end
28
+
5
29
  def self.setup(config)
6
30
  site_setup config
7
31
  connection_options_setup config
8
32
  paginator_setup config
33
+ reset_connection
9
34
  end
10
35
 
11
36
  def self.site_setup(config)
@@ -20,6 +45,10 @@ module Productive
20
45
  self.paginator = config.paginator
21
46
  end
22
47
 
48
+ def self.reset_connection
49
+ self.connection(rebuild: true)
50
+ end
51
+
23
52
  def self.all(args = {})
24
53
  depaginate(BaseItems.new([]), args).items
25
54
  end
@@ -1,5 +1,21 @@
1
1
  module Productive
2
2
  class BaseAccount < Base
3
+ def self.site
4
+ RequestStore.store[:json_api_client_base_account_site]
5
+ end
6
+
7
+ def self.site=(site)
8
+ RequestStore.store[:json_api_client_base_account_site] = site
9
+ end
10
+
11
+ def self.connection_object
12
+ RequestStore.store[:json_api_client_base_account_connection_object]
13
+ end
14
+
15
+ def self.connection_object=(connection)
16
+ RequestStore.store[:json_api_client_base_account_connection_object] = connection
17
+ end
18
+
3
19
  def self.site_setup(config)
4
20
  self.site = File.join config.base_url, config.account_id.to_s, '/'
5
21
  end
@@ -1,3 +1,3 @@
1
1
  module Productive
2
- VERSION = '0.5.7'.freeze
2
+ VERSION = '0.5.8'.freeze
3
3
  end
data/productive.gemspec CHANGED
@@ -14,5 +14,6 @@ Gem::Specification.new do |s|
14
14
  s.files = `git ls-files`.split("\n")
15
15
 
16
16
  s.add_dependency 'rack'
17
- s.add_dependency 'json_api_client'
17
+ s.add_dependency 'json_api_client', '>= 1.5.1'
18
+ s.add_dependency 'request_store', '>= 1.3.2'
18
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: productive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josip Bišćan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-12 00:00:00.000000000 Z
11
+ date: 2017-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -30,14 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 1.5.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 1.5.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: request_store
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 1.3.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.3.2
41
55
  description: Productive API client
42
56
  email: josip@infinum.hr
43
57
  executables: []