panoptes-client 0.3.0 → 0.3.1

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: c1672588d0e6aa42f444652e8ba296f7ed5f4b3b
4
- data.tar.gz: 05a812e25aa5eb57231af579d8c7af8f1c48fdf0
3
+ metadata.gz: 540f683db234bc8033e9431841393bb159adde19
4
+ data.tar.gz: d93345cca9db9d40c24a7abfbf2b15a6a79ac485
5
5
  SHA512:
6
- metadata.gz: 236008784bec67aa18e2df5e2a735db4ab66b557907e5b7353b4131744e429813dfa388d06e7a69ebba668d78d07fbd002b1f5dfcf466e5eb5be8b1b9ac22718
7
- data.tar.gz: 798d2902d8b3e86e16b2525748edb4fecb9c2c074a649f0eab59515f015da0715d55ddd7af64fd067909de6265895386cfe740ab0ced1d46532cbbc656187347
6
+ metadata.gz: 68939b3810367e0331b6a1d2a0c748d2fdd1d0c0fad07ba6e17925899b1cc8e7d44559f7e03ecf4f23d7fbb59b024d3e3bc2e30e268b3e9b336b2b9057e9872f
7
+ data.tar.gz: a8d8674148c5fe92a4c7fc3d337ccaec9eea3d90d0683c2f7cad8394b5132db11f415061c3b7b7eea3052064996964488b9915d451a78a758728652079b93c5b
@@ -1,3 +1,7 @@
1
+ # 0.3.1
2
+
3
+ * Automatically loads active public key (as of gem release)
4
+
1
5
  # 0.2.10
2
6
 
3
7
  * Fix bug with server errors
@@ -17,18 +17,21 @@ require 'panoptes/client/workflows'
17
17
  module Panoptes
18
18
  class Client
19
19
  include Panoptes::Client::Me
20
+
21
+ # Panoptes
22
+ include Panoptes::Client::Classifications
23
+ include Panoptes::Client::Collections
20
24
  include Panoptes::Client::Projects
21
25
  include Panoptes::Client::Subjects
22
26
  include Panoptes::Client::SubjectSets
23
27
  include Panoptes::Client::UserGroups
24
28
  include Panoptes::Client::Workflows
25
29
 
26
- include Panoptes::Client::Discussions
30
+ # Talk
27
31
  include Panoptes::Client::Comments
32
+ include Panoptes::Client::Discussions
28
33
 
29
- include Panoptes::Client::Collections
30
- include Panoptes::Client::Classifications
31
-
34
+ # Cellect
32
35
  include Panoptes::Client::Cellect
33
36
 
34
37
  class GenericError < StandardError; end
@@ -39,12 +42,12 @@ module Panoptes
39
42
 
40
43
  attr_reader :env, :auth, :panoptes, :talk, :cellect
41
44
 
42
- def initialize(env: :production, auth: {}, public_key_path: nil, params: nil)
45
+ def initialize(env: :production, auth: {}, public_key_path: nil)
43
46
  @env = env
44
47
  @auth = auth
45
- @public_key_path = public_key_path
48
+ @public_key_path = public_key_path || public_key_for_env(env)
46
49
  @panoptes = Panoptes::Endpoints::JsonApiEndpoint.new(
47
- auth: auth, url: panoptes_url, prefix: '/api', params: params
50
+ auth: auth, url: panoptes_url, prefix: '/api'
48
51
  )
49
52
  @talk = Panoptes::Endpoints::JsonApiEndpoint.new(
50
53
  auth: auth, url: talk_url
@@ -65,6 +68,17 @@ module Panoptes
65
68
  @jwt_signing_public_key ||= OpenSSL::PKey::RSA.new(File.read(@public_key_path))
66
69
  end
67
70
 
71
+ def public_key_for_env(env)
72
+ case env.to_s
73
+ when "staging"
74
+ File.expand_path(File.join("..", "..", "..", "data", "doorkeeper-jwt-staging.pub"), __FILE__)
75
+ when "production"
76
+ File.expand_path(File.join("..", "..", "..", "data", "doorkeeper-jwt-production.pub"), __FILE__)
77
+ else
78
+ nil
79
+ end
80
+ end
81
+
68
82
  def panoptes_url
69
83
  case env
70
84
  when :production, 'production'.freeze
@@ -1,5 +1,5 @@
1
1
  module Panoptes
2
2
  class Client
3
- VERSION = "0.3.0".freeze
3
+ VERSION = "0.3.1".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panoptes-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-09 00:00:00.000000000 Z
11
+ date: 2017-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  version: '0'
185
185
  requirements: []
186
186
  rubyforge_project:
187
- rubygems_version: 2.5.2
187
+ rubygems_version: 2.6.8
188
188
  signing_key:
189
189
  specification_version: 4
190
190
  summary: API wrapper for https://panoptes.zooniverse.org