g5-jobbing 0.0.1 → 0.0.2

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: 55652a2298d944b826ddea6b131b8f274361764a
4
- data.tar.gz: 2282b5b732157ec4c93e7eebaecc501ee2b0ba81
3
+ metadata.gz: 7882ff36d5f80f6cb2bd0ed703d3b22e0f693886
4
+ data.tar.gz: 6768f527fcfb3faaa7f288a7bbc35009a12e97d7
5
5
  SHA512:
6
- metadata.gz: cac1729f614604cd32927778b448d1b838f4b48363209a29d0a0d69f488675be5436eaae5185ef113ee6766c43035e77ff53cd3fa7232cad142ab0ba193c40ed
7
- data.tar.gz: dadda9985bea16ea44eee5888ec31c81cf72cc19e9e5a92bde10b638ba6e62404fc1114a0855f110091d56784c6d170a039f571fe5dab82b44ead37703e32fb0
6
+ metadata.gz: 796cd60f7ccd8d5850a398f8f4883a9d9dfc2681973c9959852f7ff5dcb2a06f7019dc0d3ca3a658d7f89c9a9183c27dd047b7b3058545fb8d7416a8f13cf0f9
7
+ data.tar.gz: 205a41aa4e599599d81ba5e845f1607e648d27d02e7e486cbcb3a387384ad81e15aa092039052622d73f8437711796172e3972f61ebb46634c03981ae44b9ccc
@@ -7,7 +7,10 @@ class G5::Jobbing::Job
7
7
  attribute :created_at, DateTime
8
8
  attribute :updated_at, DateTime
9
9
  attribute :integration_setting_uid, String
10
+ attribute :integration_setting_urn, String
10
11
  attribute :message, String
12
+ attribute :error_state, Boolean
13
+ attribute :success_state, Boolean
11
14
 
12
15
  def logs_url
13
16
  return 'ENV[LOGS_BY_JOB_URL] not set!' if logs_by_job_url.blank?
@@ -1,9 +1,9 @@
1
1
  class G5::Jobbing::JobRetriever
2
2
  include G5::Jobbing::AccessToken
3
- attr_accessor :locations_integration_setting_uids
3
+ attr_accessor :location_setting_urns
4
4
 
5
5
  def initialize(params={})
6
- self.locations_integration_setting_uids = params[:locations_integration_setting_uids]
6
+ self.location_setting_urns = params[:location_setting_urns]
7
7
  end
8
8
 
9
9
  def perform
@@ -15,10 +15,10 @@ class G5::Jobbing::JobRetriever
15
15
  end
16
16
 
17
17
  def jobs_url_for_locations
18
- "#{ENV['JOBS_URL']}/api/v1/jobs?current=true&integration_setting_uid=#{CGI.escape(locations_as_parameter)}"
18
+ "#{ENV['JOBS_URL']}/api/v1/jobs?current=true&integration_setting_urn=#{CGI.escape(locations_as_parameter)}"
19
19
  end
20
20
 
21
21
  def locations_as_parameter
22
- "[#{self.locations_integration_setting_uids.join(',')}]"
22
+ "[#{self.location_setting_urns.join(',')}]"
23
23
  end
24
24
  end
@@ -1,9 +1,9 @@
1
1
  class G5::Jobbing::JobStarter
2
2
  include G5::Jobbing::AccessToken
3
- attr_accessor :locations_integration_setting_uid
3
+ attr_accessor :location_setting_urn
4
4
 
5
5
  def initialize(params={})
6
- self.locations_integration_setting_uid = params[:locations_integration_setting_uid]
6
+ self.location_setting_urn = params[:location_setting_urn]
7
7
  end
8
8
 
9
9
  def perform
@@ -15,6 +15,6 @@ class G5::Jobbing::JobStarter
15
15
  end
16
16
 
17
17
  def start_job_url
18
- "#{ENV['JOBS_URL']}/api/v1/job_runners?integration_setting_uid=#{CGI.escape(self.locations_integration_setting_uid)}"
18
+ "#{ENV['JOBS_URL']}/api/v1/job_runners?integration_setting_urn=#{self.location_setting_urn}"
19
19
  end
20
20
  end
@@ -1,5 +1,5 @@
1
1
  module G5
2
2
  module Jobbing
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -2,7 +2,10 @@
2
2
  {
3
3
  "uid": "http://localhost:5778/api/v1/jobs/g5-job-6i4h4jo",
4
4
  "urn": "g5-job-6i4h4jo",
5
+ "integration_setting_urn": "int-6i4h4",
5
6
  "state": "started",
7
+ "error_state": true,
8
+ "success_state": false,
6
9
  "created_at": "2014-11-10T14:57:49.216-08:00",
7
10
  "updated_at": "2014-11-10T15:12:23.111-08:00",
8
11
  "integration_setting_uid": "http://localhost/clients/g5-c-6i4h3un-ethan-bode/locations/g5-cl-6i4h3uo-zoe-krajcik/locations_integration_settings/g5-lis-6i4h3uo",
@@ -11,7 +14,10 @@
11
14
  {
12
15
  "uid": "http://localhost:5778/api/v1/jobs/g5-job-6i4h4bb",
13
16
  "urn": "g5-job-6i4h4bb",
17
+ "integration_setting_urn": "int-622h4",
14
18
  "state": "started",
19
+ "error_state": false,
20
+ "success_state": true,
15
21
  "created_at": "2014-11-10T14:57:19.546-08:00",
16
22
  "updated_at": "2014-11-10T15:12:23.103-08:00",
17
23
  "integration_setting_uid": "http://localhost/clients/g5-c-6i4h3un-ethan-bode/locations/g5-cl-6i4h3un-retha-hane/locations_integration_settings/g5-lis-6i4h3un",
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe G5::Jobbing::JobRetriever do
4
- let!(:locations_integration_setting_uid_1) { 'uid1' }
5
- let!(:locations_integration_setting_uid_2) { 'uid2' }
4
+ let!(:locations_integration_setting_urn_1) { 'urn1' }
5
+ let!(:locations_integration_setting_urn_2) { 'urn2' }
6
6
 
7
- subject { G5::Jobbing::JobRetriever.new(locations_integration_setting_uids: [locations_integration_setting_uid_1, locations_integration_setting_uid_2]) }
7
+ subject { G5::Jobbing::JobRetriever.new(location_setting_urns: [locations_integration_setting_urn_1, locations_integration_setting_urn_2]) }
8
8
 
9
9
  describe :perform do
10
10
  let(:body) { fixture('jobs.json') }
@@ -22,15 +22,17 @@ describe G5::Jobbing::JobRetriever do
22
22
  expect(result.length).to eq(2)
23
23
  expect(result.all? { |job| G5::Jobbing::Job == job.class }).to be_truthy
24
24
  expect(result.collect(&:integration_setting_uid)).to eq(%w(http://localhost/clients/g5-c-6i4h3un-ethan-bode/locations/g5-cl-6i4h3uo-zoe-krajcik/locations_integration_settings/g5-lis-6i4h3uo http://localhost/clients/g5-c-6i4h3un-ethan-bode/locations/g5-cl-6i4h3un-retha-hane/locations_integration_settings/g5-lis-6i4h3un))
25
+ expect(result.collect(&:error_state)).to eq([true, false])
26
+ expect(result.collect(&:success_state)).to eq([false, true])
25
27
  end
26
28
  end
27
29
 
28
- its (:locations_as_parameter) { is_expected.to eq("[#{locations_integration_setting_uid_1},#{locations_integration_setting_uid_2}]") }
30
+ its (:locations_as_parameter) { is_expected.to eq("[#{locations_integration_setting_urn_1},#{locations_integration_setting_urn_2}]") }
29
31
 
30
32
  describe :jobs_url_for_locations do
31
33
  it 'filters by current and locations_integration_setting UIDs' do
32
34
  expect(subject).to receive(:locations_as_parameter).and_return('loc_param')
33
- expect(subject.jobs_url_for_locations).to match(/\/api\/v1\/jobs\?current=true&integration_setting_uid=loc_param/)
35
+ expect(subject.jobs_url_for_locations).to match(/\/api\/v1\/jobs\?current=true&integration_setting_urn=loc_param/)
34
36
  end
35
37
  end
36
38
  end
@@ -5,18 +5,27 @@ describe G5::Jobbing::Job do
5
5
  let(:urn) { 'urn' }
6
6
  let(:state) { 'state' }
7
7
  let(:integration_setting_uid) { 'isuid' }
8
+ let(:integration_setting_urn) { 'is-urn' }
9
+ let(:error_state) { true }
10
+ let(:success_state) { false }
8
11
  let(:message) { 'message' }
9
12
  let(:created_at) { DateTime.new(2012, 11, 11) }
10
13
  let(:updated_at) { DateTime.new(2013, 10, 10) }
11
14
 
12
15
  subject { G5::Jobbing::Job.new(uid: uid, urn: urn, state: state,
13
16
  integration_setting_uid: integration_setting_uid,
17
+ integration_setting_urn: integration_setting_urn,
18
+ error_state: error_state,
19
+ success_state: success_state,
14
20
  message: message, created_at: created_at, updated_at: updated_at) }
15
21
 
16
22
  its(:uid) { is_expected.to eq(uid) }
17
23
  its(:urn) { is_expected.to eq(urn) }
18
24
  its(:state) { is_expected.to eq(state) }
25
+ its(:error_state) { is_expected.to eq(error_state) }
26
+ its(:success_state) { is_expected.to eq(success_state) }
19
27
  its(:integration_setting_uid) { is_expected.to eq(integration_setting_uid) }
28
+ its(:integration_setting_urn) { is_expected.to eq(integration_setting_urn) }
20
29
  its(:message) { is_expected.to eq(message) }
21
30
  its(:created_at) { is_expected.to eq(created_at) }
22
31
  its(:updated_at) { is_expected.to eq(updated_at) }
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe G5::Jobbing::JobStarter do
4
- let(:locations_integration_setting_uid) { 'a-uid' }
4
+ let(:location_setting_urn) { 'a-urn' }
5
5
  let(:token) { 'the toke' }
6
- subject { G5::Jobbing::JobStarter.new(locations_integration_setting_uid: locations_integration_setting_uid) }
6
+ subject { G5::Jobbing::JobStarter.new(location_setting_urn: location_setting_urn) }
7
7
 
8
8
  describe :perform do
9
9
  before do
@@ -24,5 +24,5 @@ describe G5::Jobbing::JobStarter do
24
24
  end
25
25
  end
26
26
 
27
- its(:start_job_url) { is_expected.to match(/\/api\/v1\/job_runners\?integration_setting_uid=/) }
27
+ its(:start_job_url) { is_expected.to match(/\/api\/v1\/job_runners\?integration_setting_urn=#{location_setting_urn}/) }
28
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: g5-jobbing
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
  - Perry Hertler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-12 00:00:00.000000000 Z
11
+ date: 2014-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler