roqua-rom-api 0.0.1 → 0.0.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: bde7b277fe62ad02a254c9b2178396c604d84a59
4
- data.tar.gz: 2837225a0fa190fa140be2c54b40fd7a8c527f5d
3
+ metadata.gz: d62c6a258bb660e3611e4a7494931145d54966ed
4
+ data.tar.gz: 497c244e9b1b0d1e659bf232154d03cb4fa8cde7
5
5
  SHA512:
6
- metadata.gz: a86a5bce3202da7c8f33303469ed2d1d0f5d5972284adff5c260c746a2517816182243a853c4589e5d72d49e4442bba313d3d9e75c68d7c0d5cb639f63aa3ff6
7
- data.tar.gz: 8114eae0d7166e741dedd0d6ae86ce260bc5bec8ab154af2f7011aa4500d47f623db2aeb253b95a16e788f1508e884263211507fcc435ee38b245afdd8b56d9e
6
+ metadata.gz: c419b26a1a7d6c1b871980f387aae35569024879102a0f8aa231b4c4ecab30e23c24b5e04fadc830e5157be77a5df6f5942f41f1c705b2e634e3d68b98010607
7
+ data.tar.gz: a610cff81e691ad11585dc20df220c32ef4d8f45dc997c7282b6c89aaa1174aa6c4921e8d6068509c1a50f2da4e8217c2911d3d90644cd8c15a86e9d1ccfefd6
data/ChangeLog.md ADDED
@@ -0,0 +1,9 @@
1
+ ### 0.0.2 / 2014-02-17
2
+
3
+ * Raise when API response is not in 200 range
4
+
5
+ ### 0.0.1 / 2014-02-14
6
+
7
+ * Initial release:
8
+
9
+ Here be dragons
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- roqua-rom-api (0.0.1)
4
+ roqua-rom-api (0.0.2)
5
5
  active_interaction (~> 1.0.4)
6
6
  httparty (~> 0.12.0)
7
7
 
@@ -4,22 +4,18 @@ module Roqua
4
4
  module RomApi
5
5
  class Base
6
6
  def self.get(url, params = {})
7
- # TODO: Handle http basic authentication here
8
7
  HTTParty.get(api_base + url + '.json', query: params, basic_auth: authentication)
9
8
  end
10
9
 
11
10
  def self.post(url, params = {})
12
- # TODO: Handle http basic authentication here
13
11
  HTTParty.post(api_base + url + '.json', query: params, basic_auth: authentication)
14
12
  end
15
13
 
16
14
  def self.put(url, params = {})
17
- # TODO: Handle http basic authentication here
18
15
  HTTParty.put(api_base + url + '.json', query: params, basic_auth: authentication)
19
16
  end
20
17
 
21
18
  def self.delete(url, params = {})
22
- # TODO: Handle http basic authentication here
23
19
  HTTParty.delete(api_base + url + '.json', query: params, basic_auth: authentication)
24
20
  end
25
21
 
@@ -7,10 +7,12 @@ module Roqua
7
7
  integer :daily_start_time, default: nil
8
8
 
9
9
  def execute
10
- Base.post '/protocol_subscriptions', dossier_id: dossier_id,
11
- protocol_key: protocol_key,
12
- start_at: (start_at.to_i if start_at),
13
- daily_start_time: daily_start_time
10
+ response = Base.post '/protocol_subscriptions', dossier_id: dossier_id,
11
+ protocol_key: protocol_key,
12
+ start_at: (start_at.to_i if start_at),
13
+ daily_start_time: daily_start_time
14
+ fail response.inspect unless response.code / 100 == 2
15
+ response
14
16
  end
15
17
  end
16
18
  end
@@ -1,5 +1,5 @@
1
1
  module Roqua
2
2
  module RomApi
3
- VERSION = "0.0.1"
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
@@ -1,15 +1,24 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe StartProtocolSubscription do
4
+ let(:options) do
5
+ {dossier_id: 'some_dossier_id',
6
+ protocol_key: 'some_key',
7
+ start_at: Time.now,
8
+ daily_start_time: 32400} # nine o'clock
9
+ end
10
+
4
11
  it 'does a post to the rom protocol_subscription api' do
5
- options = {dossier_id: 'some_dossier_id',
6
- protocol_key: 'some_key',
7
- start_at: Time.now,
8
- daily_start_time: 32400} # nine o'clock
9
- expect(Base).to receive(:post).with '/protocol_subscriptions', dossier_id: options[:dossier_id],
12
+ expect(Base).to receive(:post).with('/protocol_subscriptions', dossier_id: options[:dossier_id],
10
13
  protocol_key: options[:protocol_key],
11
14
  start_at: options[:start_at].to_i,
12
- daily_start_time: options[:daily_start_time]
15
+ daily_start_time: options[:daily_start_time])
16
+ .and_return double('response', code: 200)
13
17
  StartProtocolSubscription.run(options)
14
18
  end
19
+
20
+ it 'raises when the response HTTP status is not in the 200 range' do
21
+ allow(Base).to receive(:post).and_return double('response', code: 401)
22
+ expect { StartProtocolSubscription.run(options) }.to raise_error
23
+ end
15
24
  end
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.1
4
+ version: 0.0.2
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-02-14 00:00:00.000000000 Z
11
+ date: 2014-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -88,6 +88,7 @@ extra_rdoc_files: []
88
88
  files:
89
89
  - ".document"
90
90
  - ".gitignore"
91
+ - ChangeLog.md
91
92
  - Gemfile
92
93
  - Gemfile.lock
93
94
  - Guardfile