roqua-core-api 0.0.6 → 0.0.7

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: 67ff3e48f5919f5069d74dd9b15526758a4accd2
4
- data.tar.gz: d913be241b4f1223a437860b2766acedf20a7020
3
+ metadata.gz: eb5022cd342803dfe4cfafde0bc41c44fe4ca09a
4
+ data.tar.gz: 686c02fc8953b4d261d3039a09bcb1c13b31e7bd
5
5
  SHA512:
6
- metadata.gz: 0ebb58cb3b1667bab8082a700bb13a9d5b426ecbba13005d56eb126fce4a252833d83618107102af06fde6f395db11dca4c4a5f63d2f84ac6b504b93be077490
7
- data.tar.gz: 82dbfd9211e89bb6570701db18253c5fa44362917d400d3b2132ee886b264ef8f04f97393115dcda87fc1d7ddc71a00a725febfbf5a8dda8d71931971a50c326
6
+ metadata.gz: 6ad89331acfe10b09413ac796aba0ba1fb92b3a9bee9261b00c2c0f9ae5bd63973996cbaffe60cfc2fb9d4a2fe417fe2c0f2566073fb83293293c1fe3df6f1c4
7
+ data.tar.gz: 517e5a269da65e9fd722bd7f9dc79f7b8aa48a22044af0af8f2bf8d268de89812077bcd9103603296874182f788500bf8f412a22db15ea5c4c8f0d38dd1c602c
data/ChangeLog.md CHANGED
@@ -1,3 +1,7 @@
1
+ ###
2
+
3
+ * Removed start api
4
+
1
5
  ### 0.0.5 / 2014-02-10
2
6
 
3
7
  * Renamed Organization to DossierGroup
@@ -0,0 +1,15 @@
1
+ module Roqua
2
+ module CoreApi
3
+ module Models
4
+ class Person
5
+ def initialize(attributes)
6
+ @attributes = attributes
7
+ end
8
+
9
+ def id
10
+ @attributes.fetch("id")
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -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
- def initialize(organization_id, server_url = ENV["CORE_URL"])
13
- @server_url = server_url
14
- @organization_id = organization_id
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
@@ -1,5 +1,5 @@
1
1
  module Roqua
2
2
  module CoreApi
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  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.6
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-17 00:00:00.000000000 Z
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