roqua-core-api 0.0.32 → 0.0.35

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 678e4ae5c7c3d16615d18e6e281cf91fa4914cda
4
- data.tar.gz: 05a66bcca78f102d0ea61ade9f2c1eb124e4375f
3
+ metadata.gz: 701130ae6447552bed7bee8edbcd3d48ba391b6a
4
+ data.tar.gz: 83ad356c5bca77d648987dea22375e28488ea079
5
5
  SHA512:
6
- metadata.gz: ca4c68a9e732b0f87396e78178e43057662ce88a84924ab7fc553fecab9fb01a0933b0c6cfa058fc7b4a1b46baf7de1b070d3ccddf3e94884f5eddce828055b0
7
- data.tar.gz: c23e665fb6b1e359c71bd2bf3e46638b1d234dc32e101fad6a11b88f93c1ed1711bf51b9eb5f620568ebf6f3124b83482015cbef55ccbb7ef83b855994e02d57
6
+ metadata.gz: 8defee938b1216b71a59e0df9c14aff435c8514726d74b884e53a7ef200603e21489186eea51ee993718d8dc0b82196de78c05a885a28c059facdd167c005129
7
+ data.tar.gz: a87210e3565bbadac2853a9ba247777ea7a0a2cc5bb3ab04a6f15c039d8f10cfb644b913cd31ed329a1063a01ae22e4a8df460e400eeb03a826b02c05e6df064
data/.yardopts CHANGED
@@ -1 +1,2 @@
1
1
  --markup markdown --title "core_api Documentation" --protected
2
+ - 'config/locales/validation_errors.yml'
@@ -1,3 +1,16 @@
1
+ ### 0.0.35 / 20114-09-15
2
+
3
+ * CreateProfessional accepts new parameters: email_subject and email_body.
4
+ * SendInviteEmail accepts new parameters: email_subject and email_body
5
+
6
+ ### 0.0.34 / 2014-08-25
7
+
8
+ * New dossier creation endpoint. No api change.
9
+
10
+ ### 0.0.33 / 2014-07-30
11
+
12
+ * Added search options with_name and with_identifier to the api.
13
+
1
14
  ### 0.0.31 / 2014-05-14
2
15
 
3
16
  * Added translations files for errors we return
@@ -1,3 +1,5 @@
1
+ # @markup ruby
2
+ # @title Translations
1
3
  nl:
2
4
  errors: &errors
3
5
  format: ! '%{attribute} %{message}'
@@ -7,9 +7,8 @@ module Roqua
7
7
  hash :attributes, strip: false
8
8
 
9
9
  def execute
10
- response = session.post "/dossiers", person: attributes.delete(:person),
11
- dossier: attributes,
12
- dossier_group_id: dossier_group_id
10
+ response = session.post "/dossier_groups/#{dossier_group_id}/dossiers",
11
+ person: attributes.delete(:person), dossier: attributes
13
12
  Models::Dossier.new(response)
14
13
  end
15
14
  end
@@ -5,10 +5,11 @@ module Roqua
5
5
  model :session, class: Sessions::OAuthSession
6
6
  string :dossier_group_id
7
7
  model :person, class: Models::Person
8
+ string :email_subject, default: nil
9
+ string :email_body, default: nil
8
10
 
9
11
  def execute
10
- response = session.post "/dossier_groups/#{dossier_group_id}/people",
11
- person: person.as_json
12
+ response = session.post "/dossier_groups/#{dossier_group_id}/people", params
12
13
  if response.code == 422
13
14
  errors_to_object(response, person)
14
15
  person
@@ -16,6 +17,13 @@ module Roqua
16
17
  Models::Person.new(response['person'])
17
18
  end
18
19
  end
20
+
21
+ def params
22
+ {
23
+ person: person.as_json,
24
+ email_subject: email_subject, email_body: email_body
25
+ }.delete_if { |k, v| v.nil? }
26
+ end
19
27
  end
20
28
  end
21
29
  end
@@ -3,15 +3,30 @@ module Roqua
3
3
  # @api private
4
4
  class Dossiers < Base
5
5
  model :session, class: Sessions::OAuthSession
6
+ string :dossier_group_id, default: nil
7
+ string :with_name, default: nil
8
+ string :with_external_identifier, default: nil
9
+
10
+ validates :dossier_group_id, presence: true, if: :with_external_identifier?
6
11
 
7
12
  # usage:
8
13
  # Roqua.CoreApi.Dossiers.run!.each do |d|
9
- # puts d.id, d.birth_year, d.gender
14
+ # puts d.id, d.birth_year, d.gender, d.firstname, d.lastname
10
15
  # end
11
16
  def execute
12
- response = session.get "/dossiers"
17
+ response = session.get "#{url_prefix}/dossiers", params
13
18
  create_enum(response['headers'], response['rows'])
14
19
  end
20
+
21
+ def url_prefix
22
+ dossier_group_id.present? ? "/dossier_groups/#{dossier_group_id}" : ''
23
+ end
24
+
25
+ def params
26
+ {name: with_name,
27
+ external_identifier: with_external_identifier
28
+ }.delete_if { |k, v| v.nil? }
29
+ end
15
30
  end
16
31
  end
17
32
  end
@@ -4,9 +4,19 @@ module Roqua
4
4
  class SendInviteEmail < ActiveInteraction::Base
5
5
  model :session, class: Sessions::OAuthSession
6
6
  string :dossier_id
7
+ string :email_subject, default: nil
8
+ string :email_body, default: nil
7
9
 
8
10
  def execute
9
- session.post "/dossiers/#{dossier_id}/send_invite_email"
11
+ session.post "/dossiers/#{dossier_id}/send_invite_email", params
12
+ end
13
+
14
+ private
15
+
16
+ def params
17
+ {
18
+ email_subject: email_subject, email_body: email_body
19
+ }.delete_if { |k, v| v.nil? }
10
20
  end
11
21
  end
12
22
  end
@@ -1,5 +1,5 @@
1
1
  module Roqua
2
2
  module CoreApi
3
- VERSION = '0.0.32'
3
+ VERSION = '0.0.35'
4
4
  end
5
5
  end
@@ -4,18 +4,16 @@ describe CreateDossier do
4
4
  let(:session) { Fabricate :oauth_session }
5
5
 
6
6
  it 'performs a post on the /dossiers api path' do
7
- expect(session).to receive(:post).with '/dossiers', person: 'person',
8
- dossier: {other: 'attributes'},
9
- dossier_group_id: 'some_dossier_group_id'
7
+ expect(session).to receive(:post).with '/dossier_groups/some_dossier_group_id/dossiers',
8
+ person: 'person', dossier: {other: 'attributes'}
10
9
  CreateDossier.run!(session: session,
11
10
  attributes: {person: 'person', other: 'attributes'},
12
11
  dossier_group_id: 'some_dossier_group_id')
13
12
  end
14
13
 
15
14
  it 'returns a Dossier model' do
16
- allow(session).to receive(:post).with('/dossiers', person: 'person',
17
- dossier: {other: 'attributes'},
18
- dossier_group_id: 'some_dossier_group_id')
15
+ allow(session).to receive(:post).with('/dossier_groups/some_dossier_group_id/dossiers',
16
+ person: 'person', dossier: {other: 'attributes'})
19
17
  .and_return 'id' => 'some_id'
20
18
  dossier = CreateDossier.run!(session: session,
21
19
  attributes: {person: 'person', other: 'attributes'},
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+
3
+ describe Dossiers do
4
+ let(:session) { Fabricate :oauth_session }
5
+ let(:dossier_group_id) { 'some_dg_id' }
6
+ let(:external_identifier) { 'some_eid' }
7
+ let(:response) { {'headers' => %w(id birth_year gender firstname lastname),
8
+ 'rows' => [[1, 1980, 'M', 'john', 'doe']]} }
9
+
10
+ it 'performs a get on the /dossiers api path' do
11
+ expect(session).to receive(:get).with('/dossiers', {}).and_return(response)
12
+ Dossiers.run!(session: session)
13
+ end
14
+
15
+ it 'performs a get on /dossier_groups/:id/dossiers if a group is given' do
16
+ expect(session).to receive(:get).with("/dossier_groups/#{dossier_group_id}/dossiers", {}).and_return(response)
17
+ Dossiers.run!(session: session, dossier_group_id: dossier_group_id)
18
+ end
19
+
20
+ it 'performs a get on /dossier_groups/:id/dossiers?external_identifier=:eid if with_external_identifier is given' do
21
+ expect(session).to receive(:get).with(
22
+ "/dossier_groups/#{dossier_group_id}/dossiers", external_identifier: external_identifier).and_return(response)
23
+ Dossiers.run!(session: session, dossier_group_id: dossier_group_id,
24
+ with_external_identifier: external_identifier)
25
+ end
26
+
27
+ it 'performs a get on /dossier_groups/:id/dossiers?name=:foo+bar if with_name is given' do
28
+ expect(session).to receive(:get).with(
29
+ "/dossier_groups/#{dossier_group_id}/dossiers", name: 'foo bar').and_return(response)
30
+ Dossiers.run!(session: session, dossier_group_id: dossier_group_id, with_name: 'foo bar')
31
+ end
32
+
33
+ it 'fails when a search is done for external_identifier without specifying a dossier_group_id' do
34
+ op = Dossiers.run(session: session, with_external_identifier: external_identifier)
35
+ expect(op).to be_invalid
36
+ end
37
+
38
+ it 'returns the results as an array of structs' do
39
+ expect(session).to receive(:get).with('/dossiers', {}).and_return(response)
40
+ dossiers = Dossiers.run!(session: session)
41
+ expect(dossiers.force[0].firstname).to eq 'john'
42
+ end
43
+ end
@@ -4,7 +4,11 @@ describe SendInviteEmail do
4
4
  let(:session) { Fabricate :oauth_session }
5
5
 
6
6
  it 'performs a post on the send_invite_email api path' do
7
- expect(session).to receive(:post).with '/dossiers/some_dossier_id/send_invite_email'
8
- SendInviteEmail.run!(session: session, dossier_id: 'some_dossier_id')
7
+ expect(session).to receive(:post).with '/dossiers/some_dossier_id/send_invite_email',
8
+ email_subject: 'account created',
9
+ email_body: 'visit %create_account_link% to set password'
10
+ SendInviteEmail.run!(session: session, dossier_id: 'some_dossier_id',
11
+ email_subject: 'account created',
12
+ email_body: 'visit %create_account_link% to set password')
9
13
  end
10
14
  end
metadata CHANGED
@@ -1,167 +1,167 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roqua-core-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.32
4
+ version: 0.0.35
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-06-11 00:00:00.000000000 Z
11
+ date: 2014-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.12.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.12.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: active_interaction
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: omniauth-oauth2
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: virtus
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '10.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '10.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: yard
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0.8'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0.8'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: 3.0.0.beta1
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 3.0.0.beta1
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: fabrication
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: '2.9'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '2.9'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: webmock
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: '1.17'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '1.17'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: dotenv
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ~>
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0.10'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ~>
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0.10'
167
167
  description: Provides authenticated access to Core
@@ -170,10 +170,10 @@ executables: []
170
170
  extensions: []
171
171
  extra_rdoc_files: []
172
172
  files:
173
- - .document
174
- - .gitignore
175
- - .rspec
176
- - .yardopts
173
+ - ".document"
174
+ - ".gitignore"
175
+ - ".rspec"
176
+ - ".yardopts"
177
177
  - ChangeLog.md
178
178
  - Gemfile
179
179
  - Guardfile
@@ -216,6 +216,7 @@ files:
216
216
  - spec/fabricators/oauth_session_fabricator.rb
217
217
  - spec/lib/roqua/core_api/create_dossier_group_spec.rb
218
218
  - spec/lib/roqua/core_api/create_dossier_spec.rb
219
+ - spec/lib/roqua/core_api/dossiers_spec.rb
219
220
  - spec/lib/roqua/core_api/models/active_virtus_spec.rb
220
221
  - spec/lib/roqua/core_api/models/person_spec.rb
221
222
  - spec/lib/roqua/core_api/send_email_to_spec.rb
@@ -234,17 +235,17 @@ require_paths:
234
235
  - lib
235
236
  required_ruby_version: !ruby/object:Gem::Requirement
236
237
  requirements:
237
- - - '>='
238
+ - - ">="
238
239
  - !ruby/object:Gem::Version
239
240
  version: '0'
240
241
  required_rubygems_version: !ruby/object:Gem::Requirement
241
242
  requirements:
242
- - - '>='
243
+ - - ">="
243
244
  - !ruby/object:Gem::Version
244
245
  version: '0'
245
246
  requirements: []
246
247
  rubyforge_project:
247
- rubygems_version: 2.0.14
248
+ rubygems_version: 2.3.0
248
249
  signing_key:
249
250
  specification_version: 4
250
251
  summary: API wrapper gem around Core's API
@@ -255,6 +256,7 @@ test_files:
255
256
  - spec/fabricators/oauth_session_fabricator.rb
256
257
  - spec/lib/roqua/core_api/create_dossier_group_spec.rb
257
258
  - spec/lib/roqua/core_api/create_dossier_spec.rb
259
+ - spec/lib/roqua/core_api/dossiers_spec.rb
258
260
  - spec/lib/roqua/core_api/models/active_virtus_spec.rb
259
261
  - spec/lib/roqua/core_api/models/person_spec.rb
260
262
  - spec/lib/roqua/core_api/send_email_to_spec.rb
@@ -263,3 +265,4 @@ test_files:
263
265
  - spec/lib/roqua/core_api/sessions/basic_auth_session_spec.rb
264
266
  - spec/lib/roqua/core_api/sessions/oauth_session_spec.rb
265
267
  - spec/spec_helper.rb
268
+ has_rdoc: