roqua-rom-api 0.4.1 → 0.4.2

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: f4a44227ef378cfa123fc67a32514224665c4ec0
4
- data.tar.gz: 03a581f525c15e9377b43333d81ede727026b011
3
+ metadata.gz: 535a4b60c45368785c54db8ea787cb7c55ae76ea
4
+ data.tar.gz: 3136d9448c04008760acdb583e32a14664515d67
5
5
  SHA512:
6
- metadata.gz: 4251654190fe7d4eed5cfbb47a9ae1b1a729dace7c13674f0e6c9f8b87fb07df9364591b9cafb2b58bbafd10cf63b05784a4feeae825835fa84ca840d5baeda6
7
- data.tar.gz: 905f793b5b9c39e87019160c10cf810911ad0ed0202513e81e51da36cefc383a6f60ddacb1d17e7acde8c9e580c78abbd7ee49303fba5c093ded2a393e800b42
6
+ metadata.gz: 1b14d68dc7d170cf45fecbac5b6c2cee25fd476195734cdf9b44a3da5ff1fb14c15353278ea15e043df81d9a4cb8060e89937623baaddcf58b2f3ecb63402e25
7
+ data.tar.gz: 1f88c54aacb92fb083e1dccd5e82deba0d534d6b95ad48fa4e9766c83745a854a3db98b871b33dcba8200eec47b79d10da834d2809c2361c694cd128934187ac
data/ChangeLog.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ### HEAD
2
2
 
3
+ ### 0.4.2 / 2015-8-20
4
+
5
+ * Add ability to use different basic_auth_sessions than the global one
6
+
7
+ ### 0.4.1 / 2015-8-12
8
+
3
9
  * Add charts to questionnaire model
4
10
  * Add internal quby_key to questionnaire model
5
11
 
@@ -7,7 +7,7 @@ module Roqua
7
7
 
8
8
  def execute
9
9
  validate_response_for do
10
- RomApi.basic_auth_session.delete("/dossiers/#{dossier_id}/fill_out_requests/#{fill_out_request_id}")
10
+ basic_auth_session.delete("/dossiers/#{dossier_id}/fill_out_requests/#{fill_out_request_id}")
11
11
  end
12
12
  end
13
13
  end
@@ -22,8 +22,8 @@ module Roqua
22
22
  open_from: open_from && open_from.to_i,
23
23
  open_till: open_till && open_till.to_i
24
24
  }.keep_if { |_k, v| v.present? }
25
- RomApi.basic_auth_session.post("/dossiers/#{dossier_id}/fill_out_requests",
26
- fill_out_request: fill_out_request)
25
+ basic_auth_session.post("/dossiers/#{dossier_id}/fill_out_requests",
26
+ fill_out_request: fill_out_request)
27
27
  end
28
28
  end
29
29
 
@@ -8,8 +8,8 @@ module Roqua
8
8
 
9
9
  def execute
10
10
  validate_response_for do
11
- RomApi.basic_auth_session.post("/dossiers/#{dossier_id}/measurement_sequences",
12
- measurement_sequence: {flags: flags, textvars: textvars})
11
+ basic_auth_session.post("/dossiers/#{dossier_id}/measurement_sequences",
12
+ measurement_sequence: {flags: flags, textvars: textvars})
13
13
  end
14
14
  end
15
15
 
@@ -10,11 +10,11 @@ module Roqua
10
10
 
11
11
  def execute
12
12
  validate_response_for do
13
- RomApi.basic_auth_session.post "/dossiers/#{dossier_id}/responses",
14
- questionnaire_key: questionnaire_key,
15
- answer_data: answer_data,
16
- filled_out_at: (filled_out_at.to_i if filled_out_at),
17
- respondent: respondent
13
+ basic_auth_session.post "/dossiers/#{dossier_id}/responses",
14
+ questionnaire_key: questionnaire_key,
15
+ answer_data: answer_data,
16
+ filled_out_at: (filled_out_at.to_i if filled_out_at),
17
+ respondent: respondent
18
18
  end
19
19
  end
20
20
 
@@ -2,6 +2,10 @@ module Roqua
2
2
  module RomApi
3
3
  # @api private
4
4
  class Endpoint < ActiveInteraction::Base
5
+ model :basic_auth_session,
6
+ default: -> { RomApi.basic_auth_session },
7
+ class: Roqua::RomApi::Sessions::BasicAuthSession
8
+
5
9
  private
6
10
 
7
11
  def validate_response_for
@@ -6,7 +6,7 @@ module Roqua
6
6
 
7
7
  def execute
8
8
  validate_response_for do
9
- RomApi.basic_auth_session.get "/questionnaires/#{questionnaire_key}"
9
+ basic_auth_session.get "/questionnaires/#{questionnaire_key}"
10
10
  end
11
11
  end
12
12
 
@@ -6,7 +6,7 @@ module Roqua
6
6
 
7
7
  def execute
8
8
  validate_response_for do
9
- RomApi.basic_auth_session.get "/dossiers/#{epd_ids}/stats"
9
+ basic_auth_session.get "/dossiers/#{epd_ids}/stats"
10
10
  end
11
11
  end
12
12
 
@@ -6,7 +6,7 @@ module Roqua
6
6
 
7
7
  def execute
8
8
  validate_response_for do
9
- RomApi.basic_auth_session.get "/dossiers/#{dossier_id}/protocol_subscriptions"
9
+ basic_auth_session.get "/dossiers/#{dossier_id}/protocol_subscriptions"
10
10
  end
11
11
  end
12
12
 
@@ -13,7 +13,7 @@ module Roqua
13
13
 
14
14
  def execute
15
15
  validate_response_for do
16
- RomApi.basic_auth_session.get "/dossiers/#{dossier_id}/responses", filter_params
16
+ basic_auth_session.get "/dossiers/#{dossier_id}/responses", filter_params
17
17
  end
18
18
  end
19
19
 
@@ -13,7 +13,7 @@ module Roqua
13
13
 
14
14
  def execute
15
15
  validate_response_for do
16
- RomApi.basic_auth_session.get "/dossiers/#{dossier_id}/report_calculations", params
16
+ basic_auth_session.get "/dossiers/#{dossier_id}/report_calculations", params
17
17
  end
18
18
  end
19
19
 
@@ -13,12 +13,12 @@ module Roqua
13
13
 
14
14
  def execute
15
15
  validate_response_for do
16
- RomApi.basic_auth_session.post("/dossiers/#{dossier_id}/fill_out_sessions",
17
- questionnaire_keys: questionnaire_keys,
18
- response_ids: response_ids,
19
- return_to: return_to,
20
- progress_url: progress_url,
21
- stylesheet: stylesheet)
16
+ basic_auth_session.post("/dossiers/#{dossier_id}/fill_out_sessions",
17
+ questionnaire_keys: questionnaire_keys,
18
+ response_ids: response_ids,
19
+ return_to: return_to,
20
+ progress_url: progress_url,
21
+ stylesheet: stylesheet)
22
22
  end
23
23
  end
24
24
 
@@ -12,7 +12,7 @@ module Roqua
12
12
  options = {protocol_key: protocol_key, flags: flags, textvars: textvars}
13
13
  options[:start_at] = start_at.to_i if start_at
14
14
  validate_response_for do
15
- RomApi.basic_auth_session.post("/dossiers/#{dossier_id}/protocol_subscriptions", options)
15
+ basic_auth_session.post("/dossiers/#{dossier_id}/protocol_subscriptions", options)
16
16
  end
17
17
  end
18
18
 
@@ -7,7 +7,7 @@ module Roqua
7
7
 
8
8
  def execute
9
9
  validate_response_for do
10
- RomApi.basic_auth_session.delete("/dossiers/#{dossier_id}/protocol_subscriptions/#{protocol_subscription_id}")
10
+ basic_auth_session.delete("/dossiers/#{dossier_id}/protocol_subscriptions/#{protocol_subscription_id}")
11
11
  end
12
12
  end
13
13
  end
@@ -11,11 +11,11 @@ module Roqua
11
11
 
12
12
  def execute
13
13
  validate_response_for do
14
- RomApi.basic_auth_session.patch "/dossiers/#{dossier_id}/responses/#{id}",
15
- questionnaire_key: questionnaire_key,
16
- answer_data: answer_data,
17
- filled_out_at: (filled_out_at.to_i if filled_out_at),
18
- started_at: (started_at.to_i if started_at)
14
+ basic_auth_session.patch "/dossiers/#{dossier_id}/responses/#{id}",
15
+ questionnaire_key: questionnaire_key,
16
+ answer_data: answer_data,
17
+ filled_out_at: (filled_out_at.to_i if filled_out_at),
18
+ started_at: (started_at.to_i if started_at)
19
19
  end
20
20
  end
21
21
 
@@ -1,5 +1,5 @@
1
1
  module Roqua
2
2
  module RomApi
3
- VERSION = '0.4.1'
3
+ VERSION = '0.4.2'
4
4
  end
5
5
  end
@@ -15,6 +15,21 @@ describe Endpoint do
15
15
  end
16
16
  end
17
17
 
18
+ describe '#initialize' do
19
+ it 'calls RomApi.basic_auth_session to fill in basic_auth_session if the basic_auth_session is not passed in' do
20
+ bas_double = Roqua::RomApi::Sessions::BasicAuthSession.new # doubles dont pass AI default type checking
21
+ allow(Roqua::RomApi).to receive(:basic_auth_session).and_return bas_double
22
+ endpoint = TestEndpoint.new
23
+ expect(endpoint.instance_variable_get :@basic_auth_session).to eq(bas_double)
24
+ end
25
+
26
+ it 'sets basic_auth_session to the passed basic_auth_session' do
27
+ bas_double = double("BasicAuthSession")
28
+ endpoint = TestEndpoint.new(basic_auth_session: bas_double)
29
+ expect(endpoint.instance_variable_get :@basic_auth_session).to eq(bas_double)
30
+ end
31
+ end
32
+
18
33
  describe 'with validations' do
19
34
  let(:response) do
20
35
  double('httparty_repsonse', code: 200, parsed_response: {}).tap do |response|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roqua-rom-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Esposito
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-08-12 00:00:00.000000000 Z
15
+ date: 2015-08-21 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: httparty
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  version: '0'
215
215
  requirements: []
216
216
  rubyforge_project:
217
- rubygems_version: 2.4.3
217
+ rubygems_version: 2.2.2
218
218
  signing_key:
219
219
  specification_version: 4
220
220
  summary: API wrapper gem around RoQua's ROM API