roqua-core-api 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +4 -0
- data/lib/roqua/core_api/models/person.rb +15 -0
- data/lib/roqua/core_api/sessions/dossier_group_session.rb +2 -2
- data/lib/roqua/core_api/sessions/dossier_session.rb +0 -6
- data/lib/roqua/core_api/sessions/organization_session.rb +26 -7
- data/lib/roqua/core_api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb5022cd342803dfe4cfafde0bc41c44fe4ca09a
|
4
|
+
data.tar.gz: 686c02fc8953b4d261d3039a09bcb1c13b31e7bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ad89331acfe10b09413ac796aba0ba1fb92b3a9bee9261b00c2c0f9ae5bd63973996cbaffe60cfc2fb9d4a2fe417fe2c0f2566073fb83293293c1fe3df6f1c4
|
7
|
+
data.tar.gz: 517e5a269da65e9fd722bd7f9dc79f7b8aa48a22044af0af8f2bf8d268de89812077bcd9103603296874182f788500bf8f412a22db15ea5c4c8f0d38dd1c602c
|
data/ChangeLog.md
CHANGED
@@ -4,9 +4,9 @@ module Roqua
|
|
4
4
|
class DossierGroupSession < OrganizationSession
|
5
5
|
attr_reader :dossier_group_id
|
6
6
|
|
7
|
-
def initialize(dossier_group_id, organization_id, server_url = ENV["CORE_URL"])
|
7
|
+
def initialize(dossier_group_id, organization_id, server_url = ENV["CORE_URL"], auth: nil)
|
8
8
|
@dossier_group_id = dossier_group_id
|
9
|
-
super(organization_id, server_url)
|
9
|
+
super(organization_id, server_url, auth: auth)
|
10
10
|
end
|
11
11
|
|
12
12
|
# create_dossier(.. , person: { email: 'user@domain.com' })
|
@@ -9,12 +9,6 @@ module Roqua
|
|
9
9
|
super(dossier_group_id, organization_id, server_url)
|
10
10
|
end
|
11
11
|
|
12
|
-
def start(attributes)
|
13
|
-
response = put "/start", attributes: attributes
|
14
|
-
fail response.inspect unless response.code / 100 == 2 # Success 2xx
|
15
|
-
response
|
16
|
-
end
|
17
|
-
|
18
12
|
private
|
19
13
|
|
20
14
|
def base_url
|
@@ -9,9 +9,11 @@ module Roqua
|
|
9
9
|
attr_reader :server_url
|
10
10
|
attr_reader :organization_id
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
@
|
12
|
+
# auth = { username: '..', password: '..' }
|
13
|
+
def initialize(organization_id, server_url = ENV["CORE_URL"], auth:nil)
|
14
|
+
@server_url = server_url
|
15
|
+
@organization_id = organization_id
|
16
|
+
@basic_auth = auth
|
15
17
|
end
|
16
18
|
|
17
19
|
def create_dossier_group(attributes)
|
@@ -24,25 +26,42 @@ module Roqua
|
|
24
26
|
DossierGroupSession.new dossier_group_id, organization_id, server_url
|
25
27
|
end
|
26
28
|
|
29
|
+
# send_email_to(dossier_group.id, dossier.id, person.id,
|
30
|
+
# subject: '..',
|
31
|
+
# body: 'Hello %firstname%, ..',
|
32
|
+
# bcc: 'bcc@test.com',
|
33
|
+
# content_type: 'text/html',
|
34
|
+
# mail_type: 'daily_recap')
|
35
|
+
# Possible variables in the body are:
|
36
|
+
# %firstname%,
|
37
|
+
# %lastname%,
|
38
|
+
# %initials%
|
39
|
+
def send_email_to(dossier_group_id, dossier_id, person_id, attributes)
|
40
|
+
response = post "/dossier_groups/#{dossier_group_id}/dossiers/#{dossier_id}/people/#{person_id}/emails",
|
41
|
+
email: attributes
|
42
|
+
fail response.inspect unless response.code == 201
|
43
|
+
response
|
44
|
+
end
|
45
|
+
|
27
46
|
private
|
28
47
|
|
29
48
|
def get(url, params = {})
|
30
49
|
# TODO: Handle authentication here
|
31
|
-
HTTParty.get(server_url + base_url + url + ".json", query: params)
|
50
|
+
HTTParty.get(server_url + base_url + url + ".json", query: params, basic_auth: @basic_auth)
|
32
51
|
end
|
33
52
|
|
34
53
|
def post(url, params = {})
|
35
54
|
# TODO: Handle authentication here
|
36
|
-
HTTParty.post(server_url + base_url + url + ".json", body: params)
|
55
|
+
HTTParty.post(server_url + base_url + url + ".json", body: params, basic_auth: @basic_auth)
|
37
56
|
end
|
38
57
|
|
39
58
|
def put(url, params = {})
|
40
59
|
# TODO: Handle authentication here
|
41
|
-
HTTParty.put(server_url + base_url + url + ".json", body: params)
|
60
|
+
HTTParty.put(server_url + base_url + url + ".json", body: params, basic_auth: @basic_auth)
|
42
61
|
end
|
43
62
|
|
44
63
|
def base_url
|
45
|
-
"/organizations/#{organization_id}"
|
64
|
+
"/api/v1/organizations/#{organization_id}"
|
46
65
|
end
|
47
66
|
end
|
48
67
|
end
|
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.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marten Veldthuis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -144,6 +144,7 @@ files:
|
|
144
144
|
- lib/roqua/core_api/models.rb
|
145
145
|
- lib/roqua/core_api/models/dossier.rb
|
146
146
|
- lib/roqua/core_api/models/dossier_group.rb
|
147
|
+
- lib/roqua/core_api/models/person.rb
|
147
148
|
- lib/roqua/core_api/sessions.rb
|
148
149
|
- lib/roqua/core_api/sessions/dossier_group_session.rb
|
149
150
|
- lib/roqua/core_api/sessions/dossier_session.rb
|