stbaldricks 2.1.0.alpha.2 → 3.0.0.alpha.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: 79edbc4f9b64f19660b1e21de5684ec4aa13650b
4
- data.tar.gz: 7ba5ab1319f27e0a25edffa186f5c99abdf89e56
3
+ metadata.gz: c0aeba2b13acc4b3e32228139d2d0cb75605022c
4
+ data.tar.gz: 573fa7b8b7ecf6ef819ec97fa73830796993ee4f
5
5
  SHA512:
6
- metadata.gz: 1217846d9cf01217d7a0b0b696d86f1de553228f49f864d199c28d11b27e1c66b2bd69b5e15fd117656fb8a5389132da1b36e87f0d765a109e9d4ddab36f486d
7
- data.tar.gz: 3e4bd4a61f1882356cd15afa060f3ca73795ea4177ff1d424cacf08decb5675348b8ba6129583f5b5e7aceaeeeefae8cc361ee8409f93163dedbd7f5aec36a83
6
+ metadata.gz: 198912e64a8c1372de7c488388e93bd0e33f43f5b4b9c7d3382519dcfb3d35c4c859ba5336fbbb5d2a83e77cf754a802160a87c791005f5fbc26dabc89b8d889
7
+ data.tar.gz: c21fd67d3ca1c3c45ee2caefa35a716fcecb94920eb9ed474569b68360c8b359bee3a59803949b2b3ba19a91c8cd6d44b39af90b7f80190b6d99b693849ca674
@@ -5,7 +5,7 @@ module SBF
5
5
  module Client
6
6
  class ConfigEndpoint < SBF::Client::EntityEndpoint
7
7
  def reload(entity)
8
- response = SBF::Client::Api::Request.public_get_request("#{base_uri}/get")
8
+ response = SBF::Client::Api::Request.get_request("#{base_uri}/get")
9
9
  parsed_response_body = JSON.parse(response.body).symbolize!
10
10
 
11
11
  raise SBF::Client::StandardError, 'Unable to retrieve settings from the api' unless ok?(response)
@@ -13,7 +13,7 @@ module SBF
13
13
 
14
14
  entity.errors.clear
15
15
 
16
- response = SBF::Client::Api::Request.public_post_request("#{base_uri}/create", create_data)
16
+ response = SBF::Client::Api::Request.post_request("#{base_uri}/create", create_data)
17
17
  parsed_response_body = JSON.parse(response.body).symbolize!
18
18
 
19
19
  if ok?(response)
@@ -14,7 +14,7 @@ module SBF
14
14
 
15
15
  data = entity.to_hash
16
16
 
17
- response = SBF::Client::Api::Request.public_post_request("#{base_uri}/subscribe", data)
17
+ response = SBF::Client::Api::Request.post_request("#{base_uri}/subscribe", data)
18
18
  error = SBF::Client::ErrorEntity.new(JSON.parse(response.body).symbolize!) unless ok?(response)
19
19
 
20
20
  SBF::Client::Api::Response.new(http_code: response.code, data: nil, error: error)
@@ -31,7 +31,7 @@ module SBF
31
31
 
32
32
  data = entity.to_hash
33
33
 
34
- response = SBF::Client::Api::Request.public_post_request("#{base_uri}/unsubscribe", data)
34
+ response = SBF::Client::Api::Request.post_request("#{base_uri}/unsubscribe", data)
35
35
  error = SBF::Client::ErrorEntity.new(JSON.parse(response.body).symbolize!) unless ok?(response)
36
36
 
37
37
  SBF::Client::Api::Response.new(http_code: response.code, data: nil, error: error)
@@ -11,7 +11,7 @@ module SBF
11
11
  # @param password [string]
12
12
  # @return [string]
13
13
  def login!(username, password)
14
- response = SBF::Client::Api::Request.public_post_request(
14
+ response = SBF::Client::Api::Request.post_request(
15
15
  "/#{SBF::Client::Api::VERSION}/security/login",
16
16
  username: username,
17
17
  password: password
@@ -37,11 +37,8 @@ module SBF
37
37
  def self.get_request(path, params = {})
38
38
  raise SBF::Client::InvalidURIError, "Invalid URI: #{path}" unless valid_uri?(path)
39
39
 
40
- # Use a public request if the user has not logged in
41
- return public_get_request(path, params) if user_token.nil?
42
-
43
40
  request_log('GET', path, params) do
44
- get(path, options(query: params, auth: user_token))
41
+ get(path, options(query: params, auth: user_token || general_token))
45
42
  end
46
43
  end
47
44
 
@@ -55,10 +52,9 @@ module SBF
55
52
  # @raise [Error]
56
53
  def self.post_request(path, params = {})
57
54
  raise SBF::Client::InvalidURIError, "Invalid URI: #{path}" unless valid_uri?(path)
58
- raise SBF::Client::Error, 'Not yet authenticated' if user_token.nil?
59
55
 
60
56
  request_log('POST', path, params) do
61
- post(path, options(body: params.to_json, type: :post, auth: user_token))
57
+ post(path, options(body: params.to_json, type: :post, auth: user_token || general_token))
62
58
  end
63
59
  end
64
60
 
@@ -72,28 +68,6 @@ module SBF
72
68
  end
73
69
  end
74
70
 
75
- # Makes a HTTP GET request to the specified path with specified params
76
- # This is used for login which is the only request which should use the public key.
77
- #
78
- def self.public_get_request(path, params = {})
79
- raise SBF::Client::InvalidURIError, "Invalid URI: #{path}" unless valid_uri?(path)
80
-
81
- request_log('GET', path, params) do
82
- get(path, options(query: params, auth: general_token))
83
- end
84
- end
85
-
86
- # Makes a HTTP POST request to the specified path with specified params
87
- # This is used for login which is the only request which should use the public key.
88
- #
89
- def self.public_post_request(path, params = {})
90
- raise SBF::Client::InvalidURIError, "Invalid URI: #{path}" unless valid_uri?(path)
91
-
92
- request_log('POST', path, params) do
93
- post(path, options(body: params.to_json, type: :post, auth: general_token))
94
- end
95
- end
96
-
97
71
  def self.options(auth: nil, type: :get, query: nil, body: nil)
98
72
  {}.tap do |options|
99
73
  options.merge!(base_uri: SBF::Client::Configuration.base_uri,
@@ -1,5 +1,5 @@
1
1
  module SBF
2
2
  module Client
3
- VERSION = '2.1.0.alpha.2'
3
+ VERSION = '3.0.0.alpha.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stbaldricks
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.alpha.2
4
+ version: 3.0.0.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-26 00:00:00.000000000 Z
11
+ date: 2017-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -216,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
216
  version: 1.3.1
217
217
  requirements: []
218
218
  rubyforge_project:
219
- rubygems_version: 2.6.12
219
+ rubygems_version: 2.6.11
220
220
  signing_key:
221
221
  specification_version: 4
222
222
  summary: St. Baldrick's Foundation Ruby Client Library