roqua-core-api 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MTVmMjg5NjQ3MTUwZDgzZTA3ODBkNmRkMGQ5NGY4ZmI0Y2E5Y2Y3OQ==
5
- data.tar.gz: !binary |-
6
- M2I5NDA5OGI4MTBlYTQ1MTEyNzc5ZmZkMmU5NzY4MmRhYzhjMmRjYw==
2
+ SHA1:
3
+ metadata.gz: c2bf9efd8b13ab187adef20a4e7b69957b665a7d
4
+ data.tar.gz: 9c51d7e5a803c42c2f9d8844da19755b90cb5f79
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NWFiNjIwYzMzZWRjN2YxMjNmNTNlYjU1YmY3M2RhMTNmOGMyM2E2ZjA4Nzg4
10
- OTA4YjM2MGRiMzRjZjllOTA1MGVmMTFiNTQ3MjE2Mjg5ZmZiNGFhNTZkZGMy
11
- YjA0MTdmODEyZTZlZTljY2ZlNGFlZjc2N2M1MTc0ZmQ1NWNjYzY=
12
- data.tar.gz: !binary |-
13
- ZDgyNGRjMmZlNzc2MTVhM2IzYTJkNjVjMmEyMjIyYjEyYjE1NzI2YjZiMmJk
14
- YTQ4NDc0MWVmMWYxMDQwOWJlYTI3Mzc4YjljMTFhZWJlYmZiOTFjM2UxZjFi
15
- ZTRjNjdjNzcwYjk2NzA3N2RmNTQ0YzAwYTI3NzRmOTAyODI3MWY=
6
+ metadata.gz: 369ad4410afc11690cdc8033de5054c61ae2532d42d3c704587c426c866db52e9a3f256e55f2aacaa838b7ee92a0a418eab7f9e1fa2ce7f8b7172b70012262f0
7
+ data.tar.gz: 851bc24b9f72fa41c0b23e5f95eaa4d5a0da911f0e83fe2ecb822b995d17262c52e40852dab7b731bac182476d2576cd8f7241adb560e0cbc4720289635b88ee
data/ChangeLog.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.0.5 / 2014-02-10
2
+
3
+ * Renamed Organization to DossierGroup
4
+
1
5
  ### 0.0.4 / 2014-02-03
2
6
 
3
7
  * Use object ids instead of objects in sessions
@@ -1,2 +1,2 @@
1
- require 'roqua/core_api/models/organization'
1
+ require 'roqua/core_api/models/dossier_group'
2
2
  require 'roqua/core_api/models/dossier'
@@ -1,7 +1,7 @@
1
1
  module Roqua
2
2
  module CoreApi
3
3
  module Models
4
- class Organization
4
+ class DossierGroup
5
5
  def initialize(attributes)
6
6
  @attributes = attributes
7
7
  end
@@ -1,4 +1,4 @@
1
1
  require 'httparty'
2
- require 'roqua/core_api/sessions/app_session'
3
2
  require 'roqua/core_api/sessions/organization_session'
3
+ require 'roqua/core_api/sessions/dossier_group_session'
4
4
  require 'roqua/core_api/sessions/dossier_session'
@@ -0,0 +1,30 @@
1
+ module Roqua
2
+ module CoreApi
3
+ module Sessions
4
+ class DossierGroupSession < OrganizationSession
5
+ attr_reader :dossier_group_id
6
+
7
+ def initialize(dossier_group_id, organization_id, server_url = ENV["CORE_URL"])
8
+ @dossier_group_id = dossier_group_id
9
+ super(organization_id, server_url)
10
+ end
11
+
12
+ def create_dossier(attributes)
13
+ response = post "/dossiers", dossier: attributes
14
+ fail response.inspect unless response.code == 201
15
+ Models::Dossier.new(response)
16
+ end
17
+
18
+ def dossier_session(dossier_id)
19
+ DossierSession.new dossier_id, dossier_group_id, organization_id, server_url
20
+ end
21
+
22
+ private
23
+
24
+ def base_url
25
+ super + "/dossier_groups/#{dossier_group_id}"
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,12 +1,12 @@
1
1
  module Roqua
2
2
  module CoreApi
3
3
  module Sessions
4
- class DossierSession < OrganizationSession
4
+ class DossierSession < DossierGroupSession
5
5
  attr_reader :dossier_id
6
6
 
7
- def initialize(dossier_id, organization_id, app_id, server_url = ENV["CORE_URL"])
7
+ def initialize(dossier_id, dossier_group_id, organization_id, server_url = ENV["CORE_URL"])
8
8
  @dossier_id = dossier_id
9
- super(organization_id, app_id, server_url)
9
+ super(dossier_group_id, organization_id, server_url)
10
10
  end
11
11
 
12
12
  def start(attributes)
@@ -1,28 +1,43 @@
1
1
  module Roqua
2
2
  module CoreApi
3
3
  module Sessions
4
- class OrganizationSession < AppSession
4
+ # OrganizationSession represents a session which is scoped to a specific organization
5
+ # in the Core database. It deals with managing dossier groups and dossiers,
6
+ # but only on a anonymous base. It is not allowed to know who these dossiers
7
+ # represent.
8
+ class OrganizationSession
9
+ attr_reader :server_url
5
10
  attr_reader :organization_id
6
11
 
7
- def initialize(organization_id, app_id, server_url = ENV["CORE_URL"])
8
- @organization_id = organization_id
9
- super(app_id, server_url)
12
+ def initialize(organization_id, server_url = ENV["CORE_URL"])
13
+ @server_url = server_url
14
+ @organization_id = organization_id
10
15
  end
11
16
 
12
- def create_dossier(attributes)
13
- response = post "/dossiers", dossier: attributes
17
+ def create_dossier_group(attributes)
18
+ response = post "/dossier_groups", dossier_group: attributes
14
19
  fail response.inspect unless response.code == 201
15
- Models::Dossier.new(response)
20
+ Models::DossierGroup.new(response)
16
21
  end
17
22
 
18
- def dossier_session(dossier_id)
19
- DossierSession.new dossier_id, organization_id, app_id, server_url
23
+ def dossier_group_session(dossier_group_id)
24
+ DossierGroupSession.new dossier_group_id, organization_id, server_url
20
25
  end
21
26
 
22
27
  private
23
28
 
29
+ def post(url, params = {})
30
+ # TODO: Handle authentication here
31
+ HTTParty.post(server_url + base_url + url + ".json", body: params)
32
+ end
33
+
34
+ def put(url, params = {})
35
+ # TODO: Handle authentication here
36
+ HTTParty.put(server_url + base_url + url + ".json", body: params)
37
+ end
38
+
24
39
  def base_url
25
- super + "/organizations/#{organization_id}"
40
+ "/organizations/#{organization_id}"
26
41
  end
27
42
  end
28
43
  end
@@ -1,5 +1,5 @@
1
1
  module Roqua
2
2
  module CoreApi
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
@@ -0,0 +1,3 @@
1
+ Fabricator(:dossier_group, class_name: Roqua::CoreApi::Models::DossierGroup) do
2
+ initialize_with { Roqua::CoreApi::Models::DossierGroup.new 'id' => 'some_id', 'name' => 'some_name' }
3
+ end
@@ -0,0 +1,5 @@
1
+ Fabricator(:dossier_group_session, class_name: Roqua::CoreApi::Sessions::DossierGroupSession) do
2
+ initialize_with do
3
+ Roqua::CoreApi::Sessions::DossierGroupSession.new Fabricate(:dossier_group), 'some_key', 'some_server'
4
+ end
5
+ end
@@ -1,5 +1,3 @@
1
1
  Fabricator(:organization_session, class_name: Roqua::CoreApi::Sessions::OrganizationSession) do
2
- initialize_with do
3
- Roqua::CoreApi::Sessions::OrganizationSession.new Fabricate(:organization), 'some_key', 'some_server'
4
- end
2
+ initialize_with { Roqua::CoreApi::Sessions::OrganizationSession.new 'some_key', 'some_server' }
5
3
  end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ module Roqua
4
+ module CoreApi
5
+ module Sessions
6
+ describe DossierGroupSession do
7
+ let(:session) { Fabricate :dossier_group_session }
8
+
9
+ describe '#dossier_session' do
10
+ it 'initializes a dossier session with a given dossier_group' do
11
+ dossier_id = 'some_dossier_id'
12
+ expect(DossierSession).to receive(:new)
13
+ .with(dossier_id, session.dossier_group_id,
14
+ session.organization_id, session.server_url)
15
+ session.dossier_session dossier_id
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -6,12 +6,12 @@ module Roqua
6
6
  describe OrganizationSession do
7
7
  let(:session) { Fabricate :organization_session }
8
8
 
9
- describe '#dossier_session' do
10
- it 'initializes a dossier session with a given organization' do
11
- dossier_id = 'some_dossier_id'
12
- expect(DossierSession).to receive(:new)
13
- .with(dossier_id, session.organization_id, session.app_id, session.server_url)
14
- session.dossier_session dossier_id
9
+ describe '#dossier_group_session' do
10
+ it 'initializes an dossier_group session with a given dossier_group_id' do
11
+ dossier_group_id = 'some_dossier_group_id'
12
+ expect(DossierGroupSession).to receive(:new).with(dossier_group_id, session.organization_id,
13
+ session.server_url)
14
+ session.dossier_group_session dossier_group_id
15
15
  end
16
16
  end
17
17
  end
metadata CHANGED
@@ -1,125 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roqua-core-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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-04 00:00:00.000000000 Z
11
+ date: 2014-02-10 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: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
34
  type: :development
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.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '10.0'
48
48
  type: :development
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: '10.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: yard
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.8'
62
62
  type: :development
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: '0.8'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 3.0.0.beta1
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: 3.0.0.beta1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: vcr
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 2.8.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: 2.8.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: webmock
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: 1.17.1
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: 1.17.1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: fabrication
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: 2.9.6
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: 2.9.6
125
125
  description: Provides authenticated access to Core
@@ -128,10 +128,10 @@ executables: []
128
128
  extensions: []
129
129
  extra_rdoc_files: []
130
130
  files:
131
- - .document
132
- - .gitignore
133
- - .rspec
134
- - .yardopts
131
+ - ".document"
132
+ - ".gitignore"
133
+ - ".rspec"
134
+ - ".yardopts"
135
135
  - ChangeLog.md
136
136
  - Gemfile
137
137
  - Guardfile
@@ -143,18 +143,18 @@ files:
143
143
  - lib/roqua/core_api.rb
144
144
  - lib/roqua/core_api/models.rb
145
145
  - lib/roqua/core_api/models/dossier.rb
146
- - lib/roqua/core_api/models/organization.rb
146
+ - lib/roqua/core_api/models/dossier_group.rb
147
147
  - lib/roqua/core_api/sessions.rb
148
- - lib/roqua/core_api/sessions/app_session.rb
148
+ - lib/roqua/core_api/sessions/dossier_group_session.rb
149
149
  - lib/roqua/core_api/sessions/dossier_session.rb
150
150
  - lib/roqua/core_api/sessions/organization_session.rb
151
151
  - lib/roqua/core_api/version.rb
152
152
  - spec/core_api_spec.rb
153
- - spec/fabricators/app_session_fabricator.rb
154
153
  - spec/fabricators/dossier_fabricator.rb
155
- - spec/fabricators/organization_fabricator.rb
154
+ - spec/fabricators/dossier_group_fabricator.rb
155
+ - spec/fabricators/dossier_group_session_fabricator.rb
156
156
  - spec/fabricators/organization_session_fabricator.rb
157
- - spec/lib/roqua/core_api/sessions/app_session_spec.rb
157
+ - spec/lib/roqua/core_api/sessions/dossier_group_session_spec.rb
158
158
  - spec/lib/roqua/core_api/sessions/organization_session_spec.rb
159
159
  - spec/spec_helper.rb
160
160
  homepage: https://github.com/roqua/core/blob/master/core_api/README.markdown
@@ -167,12 +167,12 @@ require_paths:
167
167
  - lib
168
168
  required_ruby_version: !ruby/object:Gem::Requirement
169
169
  requirements:
170
- - - ! '>='
170
+ - - ">="
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0'
173
173
  required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  requirements:
175
- - - ! '>='
175
+ - - ">="
176
176
  - !ruby/object:Gem::Version
177
177
  version: '0'
178
178
  requirements: []
@@ -183,11 +183,11 @@ specification_version: 4
183
183
  summary: API wrapper gem around Core's API
184
184
  test_files:
185
185
  - spec/core_api_spec.rb
186
- - spec/fabricators/app_session_fabricator.rb
187
186
  - spec/fabricators/dossier_fabricator.rb
188
- - spec/fabricators/organization_fabricator.rb
187
+ - spec/fabricators/dossier_group_fabricator.rb
188
+ - spec/fabricators/dossier_group_session_fabricator.rb
189
189
  - spec/fabricators/organization_session_fabricator.rb
190
- - spec/lib/roqua/core_api/sessions/app_session_spec.rb
190
+ - spec/lib/roqua/core_api/sessions/dossier_group_session_spec.rb
191
191
  - spec/lib/roqua/core_api/sessions/organization_session_spec.rb
192
192
  - spec/spec_helper.rb
193
193
  has_rdoc:
@@ -1,45 +0,0 @@
1
- module Roqua
2
- module CoreApi
3
- module Sessions
4
- # AppSession represents a session which is scoped to a specific app
5
- # in the Core database. It deals with managing organizations and dossiers,
6
- # but only on a anonymous base. It is not allowed to know who these dossiers
7
- # represent.
8
- class AppSession
9
- attr_reader :server_url
10
- attr_reader :app_id
11
-
12
- def initialize(app_id, server_url = ENV["CORE_URL"])
13
- @server_url = server_url
14
- @app_id = app_id
15
- end
16
-
17
- def create_organization(attributes)
18
- response = post "/organizations", organization: attributes
19
- fail response.inspect unless response.code == 201
20
- Models::Organization.new(response)
21
- end
22
-
23
- def organization_session(organization_id)
24
- OrganizationSession.new organization_id, app_id, server_url
25
- end
26
-
27
- private
28
-
29
- def post(url, params = {})
30
- # TODO: Handle authentication here
31
- HTTParty.post(server_url + base_url + url + ".json", body: params)
32
- end
33
-
34
- def put(url, params = {})
35
- # TODO: Handle authentication here
36
- HTTParty.put(server_url + base_url + url + ".json", body: params)
37
- end
38
-
39
- def base_url
40
- "/apps/#{app_id}"
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,3 +0,0 @@
1
- Fabricator(:app_session, class_name: Roqua::CoreApi::Sessions::AppSession) do
2
- initialize_with { Roqua::CoreApi::Sessions::AppSession.new 'some_key', 'some_server' }
3
- end
@@ -1,3 +0,0 @@
1
- Fabricator(:organization, class_name: Roqua::CoreApi::Models::Organization) do
2
- initialize_with { Roqua::CoreApi::Models::Organization.new 'id' => 'some_id', 'name' => 'some_name' }
3
- end
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Roqua
4
- module CoreApi
5
- module Sessions
6
- describe AppSession do
7
- let(:session) { Fabricate :app_session }
8
-
9
- describe '#organization_session' do
10
- it 'initializes an organization session with a given organization_id' do
11
- organization_id = 'some_organization_id'
12
- expect(OrganizationSession).to receive(:new).with(organization_id, session.app_id, session.server_url)
13
- session.organization_session organization_id
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end