roqua-rom-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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05a0d9ec612437981f82ec1c3b7236437c6aa58b
4
- data.tar.gz: bc1bb0cac2a640d4038ba6a165a1ab38a6da3b40
3
+ metadata.gz: 16fc5f0f04495f71a7a5658cdcd60939d44b7d89
4
+ data.tar.gz: ff78fb08b0c1fe66a2745c38f376d0c79068e759
5
5
  SHA512:
6
- metadata.gz: d5df8650874825cc203a28a51522b34079271d3b8f9e6624e928a3f04508661d6832093c71b3629a7c904a6aec34726d0f584af95919c46237e6712546e37c05
7
- data.tar.gz: 8064fc956752998a5f42970b7b96553e9efb7c51de471e9e5a2a59438f7218fc83a1c0a46b8d29ce0642124944c77b33e644970620ab574339770dce63962b30
6
+ metadata.gz: 24e8e9bad8b0c40ee0a1ce2bc4b1b6595ac3af61823f8160dacbe2309a4a32e9c4c837ce707824746dc83eca74dcc9be00d7794ed1d82626d429b440b2e31761
7
+ data.tar.gz: c3cd6a83c3b7806db832b30ae6cb701633ec4742c8a6ebdc969e85218064d7769e4327bac72ba81959d5b1591d28efde0d7e65671765b6b0fcd9fdd3eb402b53
data/ChangeLog.md CHANGED
@@ -1,3 +1,7 @@
1
+ ##$ 0.0.5 / 2014-03-12
2
+
3
+ * Remove RoQua prefix from env vars
4
+
1
5
  ### 0.0.4 / 2014-03-06
2
6
 
3
7
  * Use BasicAuthSession for http requests instead of RomApi::Base class
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- roqua-rom-api (0.0.4)
4
+ roqua-rom-api (0.0.5)
5
5
  active_interaction (~> 1.0.4)
6
6
  httparty (~> 0.12.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- active_interaction (1.0.4)
11
+ active_interaction (1.0.5)
12
12
  activemodel (>= 3, < 5)
13
13
  activemodel (4.0.3)
14
14
  activesupport (= 4.0.3)
@@ -19,7 +19,7 @@ GEM
19
19
  multi_json (~> 1.3)
20
20
  thread_safe (~> 0.1)
21
21
  tzinfo (~> 0.3.37)
22
- atomic (1.1.14)
22
+ atomic (1.1.15)
23
23
  builder (3.1.4)
24
24
  celluloid (0.15.2)
25
25
  timers (~> 1.1.0)
@@ -56,7 +56,7 @@ GEM
56
56
  lumberjack (1.0.4)
57
57
  method_source (0.8.2)
58
58
  minitest (4.7.5)
59
- multi_json (1.8.4)
59
+ multi_json (1.9.0)
60
60
  multi_xml (0.5.5)
61
61
  nio4r (1.0.0)
62
62
  pry (0.9.12.6)
@@ -78,10 +78,10 @@ GEM
78
78
  ruby-progressbar (1.4.1)
79
79
  slop (3.4.7)
80
80
  thor (0.18.1)
81
- thread_safe (0.1.3)
82
- atomic
81
+ thread_safe (0.2.0)
82
+ atomic (>= 1.1.7, < 2)
83
83
  timers (1.1.0)
84
- tzinfo (0.3.38)
84
+ tzinfo (0.3.39)
85
85
  yard (0.8.7.3)
86
86
 
87
87
  PLATFORMS
@@ -2,15 +2,12 @@ module Roqua
2
2
  module RomApi
3
3
  # @api private
4
4
  class ListResponses < ActiveInteraction::Base
5
- include Sessions
6
- include Results
7
5
  string :dossier_id
8
6
 
9
7
  def execute
10
- session = BasicAuthSession.new
11
- response = session.get "/dossiers/#{dossier_id}/responses"
8
+ response = RomApi.basic_auth_session.get "/dossiers/#{dossier_id}/responses"
12
9
  JSON.parse(response.body)['responses'].map do |response_entry|
13
- Response.new response_entry
10
+ Models::Response.new response_entry
14
11
  end
15
12
  end
16
13
  end
@@ -1,6 +1,6 @@
1
1
  module Roqua
2
2
  module RomApi
3
- module Results
3
+ module Models
4
4
  class Response
5
5
  attr_reader :response, :name, :open_from, :open_till, :completing_url, :completer_type, :completed_at, :status
6
6
 
@@ -0,0 +1 @@
1
+ require 'roqua/rom_api/models/response'
@@ -6,9 +6,9 @@ module Roqua
6
6
  attr_reader :username
7
7
  attr_reader :password
8
8
 
9
- def initialize(rom_host: ENV['ROQUA_ROM_HOST'],
10
- username: ENV['ROQUA_ROM_KEY'],
11
- password: ENV['ROQUA_ROM_SECRET'])
9
+ def initialize(rom_host: ENV['ROM_HOST'],
10
+ username: ENV['ROM_KEY'],
11
+ password: ENV['ROM_SECRET'])
12
12
  @rom_host = rom_host
13
13
  @username = username
14
14
  @password = password
@@ -1,2 +1,10 @@
1
1
  require 'httparty'
2
- require 'roqua/rom_api/sessions/basic_auth_session'
2
+ require 'roqua/rom_api/sessions/basic_auth_session'
3
+
4
+ module Roqua
5
+ module RomApi
6
+ def self.basic_auth_session(*arguments, &block)
7
+ Sessions::BasicAuthSession.new(*arguments, &block)
8
+ end
9
+ end
10
+ end
@@ -2,17 +2,15 @@ module Roqua
2
2
  module RomApi
3
3
  # @api private
4
4
  class StartProtocolSubscription < ActiveInteraction::Base
5
- include Sessions
6
5
  string :dossier_id
7
6
  string :protocol_key
8
7
  time :start_at, default: nil
9
8
 
10
9
  def execute
11
- session = BasicAuthSession.new
12
10
  options = {dossier_id: dossier_id,
13
11
  protocol_key: protocol_key}
14
12
  options[:start_at] = start_at.to_i if start_at
15
- response = session.post '/protocol_subscriptions', options
13
+ response = RomApi.basic_auth_session.post '/protocol_subscriptions', options
16
14
  fail response.parsed_response.inspect unless (200..299).include? response.code
17
15
  response
18
16
  end
@@ -1,5 +1,5 @@
1
1
  module Roqua
2
2
  module RomApi
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.5'
4
4
  end
5
5
  end
data/lib/roqua/rom_api.rb CHANGED
@@ -1,6 +1,6 @@
1
- require 'roqua/rom_api/version'
2
1
  require 'active_interaction'
2
+ require 'roqua/rom_api/version'
3
3
  require 'roqua/rom_api/sessions'
4
- require 'roqua/rom_api/results'
4
+ require 'roqua/rom_api/models'
5
5
  require 'roqua/rom_api/start_protocol_subscription'
6
6
  require 'roqua/rom_api/list_responses'
@@ -7,41 +7,41 @@ describe BasicAuthSession do
7
7
 
8
8
  describe '#initialize' do
9
9
  it 'sets the rom_host instance attribute' do
10
- session = BasicAuthSession.new rom_host: 'some_rom_host'
10
+ session = Roqua::RomApi.basic_auth_session rom_host: 'some_rom_host'
11
11
  expect(session.rom_host).to eq('some_rom_host')
12
12
  end
13
13
 
14
- it 'defaults the rom_host to the ROQUA_ROM_HOST env variable' do
15
- orginal_env_rom_host = ENV['ROQUA_ROM_HOST']
16
- ENV['ROQUA_ROM_HOST'] = 'some_env_rom_host'
17
- session = BasicAuthSession.new
18
- ENV['ROQUA_ROM_HOST'] = orginal_env_rom_host
14
+ it 'defaults the rom_host to the ROM_HOST env variable' do
15
+ orginal_env_rom_host = ENV['ROM_HOST']
16
+ ENV['ROM_HOST'] = 'some_env_rom_host'
17
+ session = Roqua::RomApi.basic_auth_session
18
+ ENV['ROM_HOST'] = orginal_env_rom_host
19
19
  expect(session.rom_host).to eq('some_env_rom_host')
20
20
  end
21
21
 
22
22
  it 'sets the username instance variable' do
23
- session = BasicAuthSession.new username: 'some_username'
23
+ session = Roqua::RomApi.basic_auth_session username: 'some_username'
24
24
  expect(session.username).to eq('some_username')
25
25
  end
26
26
 
27
- it 'defaults the username to the ROQUA_ROM_KEY env variable' do
28
- orginal_env_rom_key = ENV['ROQUA_ROM_KEY']
29
- ENV['ROQUA_ROM_KEY'] = 'some_env_rom_key'
30
- session = BasicAuthSession.new
31
- ENV['ROQUA_ROM_KEY'] = orginal_env_rom_key
27
+ it 'defaults the username to the ROM_KEY env variable' do
28
+ orginal_env_rom_key = ENV['ROM_KEY']
29
+ ENV['ROM_KEY'] = 'some_env_rom_key'
30
+ session = Roqua::RomApi.basic_auth_session
31
+ ENV['ROM_KEY'] = orginal_env_rom_key
32
32
  expect(session.username).to eq('some_env_rom_key')
33
33
  end
34
34
 
35
35
  it 'sets the password instance variable' do
36
- session = BasicAuthSession.new password: 'some_password'
36
+ session = Roqua::RomApi.basic_auth_session password: 'some_password'
37
37
  expect(session.password).to eq('some_password')
38
38
  end
39
39
 
40
- it 'defaults the password to the ROQUA_ROM_SECRET env variable' do
41
- orginal_env_rom_secret = ENV['ROQUA_ROM_SECRET']
42
- ENV['ROQUA_ROM_SECRET'] = 'some_env_rom_secret'
43
- session = BasicAuthSession.new
44
- ENV['ROQUA_ROM_SECRET'] = orginal_env_rom_secret
40
+ it 'defaults the password to the ROM_SECRET env variable' do
41
+ orginal_env_rom_secret = ENV['ROM_SECRET']
42
+ ENV['ROM_SECRET'] = 'some_env_rom_secret'
43
+ session = Roqua::RomApi.basic_auth_session
44
+ ENV['ROM_SECRET'] = orginal_env_rom_secret
45
45
  expect(session.password).to eq('some_env_rom_secret')
46
46
  end
47
47
  end
data/spec/spec_helper.rb CHANGED
@@ -3,4 +3,4 @@ require 'fabrication'
3
3
  require 'roqua-rom-api'
4
4
  include Roqua::RomApi
5
5
  include Roqua::RomApi::Sessions
6
- include Roqua::RomApi::Results
6
+ include Roqua::RomApi::Models
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roqua-rom-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
  - Samuel Esposito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-06 00:00:00.000000000 Z
11
+ date: 2014-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -126,8 +126,8 @@ files:
126
126
  - lib/roqua-rom-api.rb
127
127
  - lib/roqua/rom_api.rb
128
128
  - lib/roqua/rom_api/list_responses.rb
129
- - lib/roqua/rom_api/results.rb
130
- - lib/roqua/rom_api/results/response.rb
129
+ - lib/roqua/rom_api/models.rb
130
+ - lib/roqua/rom_api/models/response.rb
131
131
  - lib/roqua/rom_api/sessions.rb
132
132
  - lib/roqua/rom_api/sessions/basic_auth_session.rb
133
133
  - lib/roqua/rom_api/start_protocol_subscription.rb
@@ -135,7 +135,7 @@ files:
135
135
  - roqua_rom_api.gemspec
136
136
  - spec/fabricators/basic_auth_session_fabricator.rb
137
137
  - spec/lib/roqua/rom_api/list_responses_spec.rb
138
- - spec/lib/roqua/rom_api/results/response_spec.rb
138
+ - spec/lib/roqua/rom_api/models/response_spec.rb
139
139
  - spec/lib/roqua/rom_api/sessions/basic_auth_session_spec.rb
140
140
  - spec/lib/roqua/rom_api/start_protocol_subscription_spec.rb
141
141
  - spec/lib/roqua_rom_api_spec.rb
@@ -167,7 +167,7 @@ summary: API wrapper gem around RoQua's ROM API
167
167
  test_files:
168
168
  - spec/fabricators/basic_auth_session_fabricator.rb
169
169
  - spec/lib/roqua/rom_api/list_responses_spec.rb
170
- - spec/lib/roqua/rom_api/results/response_spec.rb
170
+ - spec/lib/roqua/rom_api/models/response_spec.rb
171
171
  - spec/lib/roqua/rom_api/sessions/basic_auth_session_spec.rb
172
172
  - spec/lib/roqua/rom_api/start_protocol_subscription_spec.rb
173
173
  - spec/lib/roqua_rom_api_spec.rb
@@ -1 +0,0 @@
1
- require 'roqua/rom_api/results/response'