stbaldricks 2.1.0.alpha.2 → 3.0.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stbaldricks/endpoints/config.rb +1 -1
- data/lib/stbaldricks/endpoints/event_application.rb +1 -1
- data/lib/stbaldricks/endpoints/newsletter_recipient.rb +2 -2
- data/lib/stbaldricks/endpoints/user.rb +1 -1
- data/lib/stbaldricks/request.rb +2 -28
- data/lib/stbaldricks/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0aeba2b13acc4b3e32228139d2d0cb75605022c
|
4
|
+
data.tar.gz: 573fa7b8b7ecf6ef819ec97fa73830796993ee4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
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.
|
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.
|
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.
|
14
|
+
response = SBF::Client::Api::Request.post_request(
|
15
15
|
"/#{SBF::Client::Api::VERSION}/security/login",
|
16
16
|
username: username,
|
17
17
|
password: password
|
data/lib/stbaldricks/request.rb
CHANGED
@@ -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,
|
data/lib/stbaldricks/version.rb
CHANGED
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:
|
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-
|
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.
|
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
|