roqua-core-api 0.0.26 → 0.0.27
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/Gemfile +1 -0
- data/lib/roqua/core_api/create_dossier_group.rb +1 -1
- data/lib/roqua/core_api/dossier_groups.rb +13 -0
- data/lib/roqua/core_api/models/active_virtus.rb +8 -7
- data/lib/roqua/core_api/version.rb +1 -1
- data/lib/roqua/core_api.rb +1 -0
- data/lib/roqua/omniauth/rails_initializer.rb +2 -1
- data/spec/lib/roqua/core_api/create_dossier_group_spec.rb +5 -4
- 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: 23e0e206f098bcf278fa81bfc085489c08bcb213
|
4
|
+
data.tar.gz: 774b7b841acc9a2fc4074f54125ca7014137f489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f96fd0241be3059e1dec48b62a297172396b8694719110385ae7b97b422dfd88a453496c4c89c435476100fd56d4ac4a052c7d73c0c509de6388b1ca0f017df
|
7
|
+
data.tar.gz: b088425d466a61724322cdca7e2c34a3468278fc546b7366ac9a6aef231b6e6b6207dda1bc73642e5d29e9831300ed25148d0f518c6d058df312deedc38c81ba
|
data/ChangeLog.md
CHANGED
data/Gemfile
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
module Roqua
|
2
|
+
module CoreApi
|
3
|
+
# @api private
|
4
|
+
class DossierGroups < ActiveInteraction::Base
|
5
|
+
model :session, class: Sessions::OAuthSession
|
6
|
+
|
7
|
+
def execute
|
8
|
+
response = session.get "/dossier_groups"
|
9
|
+
response['dossier_groups'].map { |attrs| Models::DossierGroup.new(attrs) }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -9,7 +9,7 @@ class Roqua::CoreApi::Models::ActiveVirtus
|
|
9
9
|
include Virtus.model
|
10
10
|
|
11
11
|
def attributes=(params)
|
12
|
-
|
12
|
+
dates_from_xi(params)
|
13
13
|
super
|
14
14
|
end
|
15
15
|
|
@@ -20,15 +20,16 @@ class Roqua::CoreApi::Models::ActiveVirtus
|
|
20
20
|
private
|
21
21
|
|
22
22
|
# set Date and DateTime attributes by "name(1i)" style params
|
23
|
-
def
|
24
|
-
self.class.attribute_set.select do |a|
|
25
|
-
a.type.primitive <= Date && params.
|
26
|
-
end
|
27
|
-
|
23
|
+
def dates_from_xi(params)
|
24
|
+
dates_to_change = self.class.attribute_set.select do |a|
|
25
|
+
a.type.primitive <= Date && params.key?("#{a.name}(1i)")
|
26
|
+
end
|
27
|
+
dates_to_change.each do |a|
|
28
|
+
date_from_xi(a.name, params)
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
31
|
-
def
|
32
|
+
def date_from_xi(attribute, params)
|
32
33
|
self[attribute] = {
|
33
34
|
year: params.fetch("#{attribute}(1i)"),
|
34
35
|
month: params.fetch("#{attribute}(2i)", 1),
|
data/lib/roqua/core_api.rb
CHANGED
@@ -3,6 +3,7 @@ require 'roqua/core_api/version'
|
|
3
3
|
require 'roqua/core_api/sessions'
|
4
4
|
require 'roqua/core_api/models'
|
5
5
|
require 'roqua/core_api/dossiers'
|
6
|
+
require 'roqua/core_api/dossier_groups'
|
6
7
|
require 'roqua/core_api/create_dossier'
|
7
8
|
require 'roqua/core_api/create_dossier_group'
|
8
9
|
require 'roqua/core_api/send_email_to'
|
@@ -7,5 +7,6 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
7
7
|
provider :doorkeeper,
|
8
8
|
ENV.fetch('CORE_OAUTH_CLIENT_ID'),
|
9
9
|
ENV.fetch('CORE_OAUTH_CLIENT_SECRET'),
|
10
|
-
client_options: {site: ENV.fetch('CORE_SITE')}
|
10
|
+
client_options: {site: ENV.fetch('CORE_SITE')},
|
11
|
+
authorize_params: {login_title: ENV['CORE_LOGIN_TITLE']}
|
11
12
|
end
|
@@ -4,15 +4,16 @@ describe CreateDossierGroup do
|
|
4
4
|
let(:session) { Fabricate :oauth_session }
|
5
5
|
|
6
6
|
it 'performs a post on the /dossier_groups api path' do
|
7
|
-
expect(session).to receive(:post).with
|
8
|
-
organization_id: 'some_organization_id'
|
7
|
+
expect(session).to receive(:post).with('/dossier_groups', dossier_group: {some: 'attributes'},
|
8
|
+
organization_id: 'some_organization_id')
|
9
|
+
.and_return("dossier_group" => {})
|
9
10
|
CreateDossierGroup.run!(session: session, attributes: {some: 'attributes'}, organization_id: 'some_organization_id')
|
10
11
|
end
|
11
12
|
|
12
|
-
it 'returns a
|
13
|
+
it 'returns a DossierGroup model' do
|
13
14
|
allow(session).to receive(:post).with('/dossier_groups', dossier_group: {some: 'attributes'},
|
14
15
|
organization_id: 'some_organization_id')
|
15
|
-
.and_return 'id' => 'some_id', 'name' => 'some_name'
|
16
|
+
.and_return('dossier_group' => {'id' => 'some_id', 'name' => 'some_name'})
|
16
17
|
dossier_group = CreateDossierGroup.run!(session: session,
|
17
18
|
attributes: {some: 'attributes'},
|
18
19
|
organization_id: 'some_organization_id')
|
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.27
|
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-04-
|
11
|
+
date: 2014-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- lib/roqua/core_api.rb
|
186
186
|
- lib/roqua/core_api/create_dossier.rb
|
187
187
|
- lib/roqua/core_api/create_dossier_group.rb
|
188
|
+
- lib/roqua/core_api/dossier_groups.rb
|
188
189
|
- lib/roqua/core_api/dossiers.rb
|
189
190
|
- lib/roqua/core_api/models.rb
|
190
191
|
- lib/roqua/core_api/models/active_virtus.rb
|