roqua-core-api 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 +4 -4
- data/ChangeLog.md +5 -0
- data/lib/roqua/core_api.rb +1 -0
- data/lib/roqua/core_api/send_email_to.rb +0 -1
- data/lib/roqua/core_api/send_notification.rb +31 -0
- data/lib/roqua/core_api/sessions/hmac_auth_request.rb +1 -1
- data/lib/roqua/core_api/version.rb +1 -1
- data/spec/lib/roqua/core_api/send_email_to_spec.rb +0 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b788e173b506c370992aed5f8b6fcb4d230ba04f
|
4
|
+
data.tar.gz: c419cc9116e18c43e884f8e251a224ddcfd5cc04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b9a8d71ab5bd7eb919ef2a0611ddcf94a2bdcf1ab1eabd8950eb1c1f723c4d43e019b1a6bcff58b9348db60b89db0d3dac8f02ff8989097b9137156796f03dd
|
7
|
+
data.tar.gz: 267ca4836bef435b63f86ea90b68f8a2f652c2155af5e5f052f06744b93d25d9bfed4ecc2c878c296d663f6620297ae8e1ba6f35c946044b15bda85d57f620db
|
data/ChangeLog.md
CHANGED
data/lib/roqua/core_api.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
module Roqua
|
2
|
+
module CoreApi
|
3
|
+
# @api private
|
4
|
+
class SendNotification < ActiveInteraction::Base
|
5
|
+
string :person_id, default: nil # if nil, to must be present.
|
6
|
+
string :dossier_id, default: nil
|
7
|
+
hash :attributes do
|
8
|
+
string :body_short
|
9
|
+
string :body_long
|
10
|
+
string :notification_type, default: nil
|
11
|
+
string :reference
|
12
|
+
string :subject
|
13
|
+
hash :addresses, default: nil, strip: false
|
14
|
+
hash :variables, strip: false, default: {}
|
15
|
+
array :notify_by do # [:sms, :email]
|
16
|
+
string
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Possible variables in the body/subject are:
|
21
|
+
# %firstname%,
|
22
|
+
# %lastname%,
|
23
|
+
# %initials%
|
24
|
+
def execute
|
25
|
+
CoreApi.basic_auth_session.post "/notifications", notification: attributes,
|
26
|
+
person_id: person_id,
|
27
|
+
dossier_id: dossier_id
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -37,7 +37,7 @@ module Roqua
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def calculate_hmac(request_method, path, params)
|
40
|
-
checker = Authmac::HmacChecker.new(consumer_secret, '
|
40
|
+
checker = Authmac::HmacChecker.new(consumer_secret, digest_function: 'sha256', message_format: :json)
|
41
41
|
params_to_sign = params.merge \
|
42
42
|
'request_method' => request_method,
|
43
43
|
'request_path' => "/api/v1#{path}",
|
@@ -7,7 +7,6 @@ describe SendEmailTo do
|
|
7
7
|
it 'performs a post on the emails api path providing the person_id and the email attributes' do
|
8
8
|
email_attributes = {subject: 'some_subject',
|
9
9
|
body: 'some_body',
|
10
|
-
bcc: 'some@bcc',
|
11
10
|
content_type: 'some/content/type',
|
12
11
|
mail_type: 'some_mail_type'}
|
13
12
|
expect(session).to receive(:post).with '/emails', person_id: 'some_person_id', email: email_attributes
|
@@ -17,7 +16,6 @@ describe SendEmailTo do
|
|
17
16
|
it 'defaults the content_type to text/html' do
|
18
17
|
email_attributes = {subject: 'some_subject',
|
19
18
|
body: 'some_body',
|
20
|
-
bcc: 'some@bcc',
|
21
19
|
mail_type: 'some_mail_type'}
|
22
20
|
expect(session).to receive(:post).with '/emails', person_id: 'some_person_id',
|
23
21
|
email: email_attributes.merge(content_type: 'text/html')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roqua-core-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marten Veldthuis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -207,6 +207,7 @@ files:
|
|
207
207
|
- lib/roqua/core_api/person.rb
|
208
208
|
- lib/roqua/core_api/send_email_to.rb
|
209
209
|
- lib/roqua/core_api/send_invite_email.rb
|
210
|
+
- lib/roqua/core_api/send_notification.rb
|
210
211
|
- lib/roqua/core_api/send_text_message_to.rb
|
211
212
|
- lib/roqua/core_api/sessions.rb
|
212
213
|
- lib/roqua/core_api/sessions/auth_session.rb
|
@@ -263,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
263
264
|
version: '0'
|
264
265
|
requirements: []
|
265
266
|
rubyforge_project:
|
266
|
-
rubygems_version: 2.6.
|
267
|
+
rubygems_version: 2.6.8
|
267
268
|
signing_key:
|
268
269
|
specification_version: 4
|
269
270
|
summary: API wrapper gem around Core's API
|