g5_foundation_client 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -50,8 +50,6 @@ describe G5FoundationClient::Location do
50
50
  its(:locality) { should eql("Testville") }
51
51
  its(:postal_code) { should eql("31337") }
52
52
  its(:status) { should eql("Pending") }
53
- its(:inventory_integration_settings) { should be_nil }
54
- its(:lead_integration_settings) { should be_nil }
55
53
 
56
54
  it 'deletes client from hash' do
57
55
  expect(subject.location_hash[:client]).to be_nil
@@ -67,8 +65,5 @@ describe G5FoundationClient::Location do
67
65
  subject(:find) { G5FoundationClient::Location.find_by_uid(uid) }
68
66
 
69
67
  its(:name) { should eq('brussels') }
70
- it 'has inventory integration settings' do
71
- subject.inventory_integration_settings.integration_setting_hash[:strategy_name].should eq('vsn')
72
- end
73
68
  end
74
69
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: g5_foundation_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Don Petersen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-06 00:00:00.000000000 Z
11
+ date: 2014-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -143,17 +143,16 @@ files:
143
143
  - lib/g5_foundation_client/fetcher.rb
144
144
  - lib/g5_foundation_client/models/client.rb
145
145
  - lib/g5_foundation_client/models/findable_by_uid.rb
146
- - lib/g5_foundation_client/models/integration_setting.rb
147
146
  - lib/g5_foundation_client/models/location.rb
148
147
  - lib/g5_foundation_client/record_not_found_exception.rb
149
148
  - lib/g5_foundation_client/rspec.rb
150
149
  - lib/g5_foundation_client/rspec/factories.rb
151
150
  - lib/g5_foundation_client/version.rb
152
151
  - spec/fixtures/hub-client.json
152
+ - spec/fixtures/hub-clients.json
153
153
  - spec/fixtures/hub-location.json
154
154
  - spec/lib/g5_foundation_client/fetcher_spec.rb
155
155
  - spec/lib/g5_foundation_client/models/client_spec.rb
156
- - spec/lib/g5_foundation_client/models/integration_setting_spec.rb
157
156
  - spec/lib/g5_foundation_client/models/location_spec.rb
158
157
  - spec/lib/g5_foundation_client_spec.rb
159
158
  - spec/spec_helper.rb
@@ -183,10 +182,10 @@ specification_version: 4
183
182
  summary: Client gem to interact with G5 services.
184
183
  test_files:
185
184
  - spec/fixtures/hub-client.json
185
+ - spec/fixtures/hub-clients.json
186
186
  - spec/fixtures/hub-location.json
187
187
  - spec/lib/g5_foundation_client/fetcher_spec.rb
188
188
  - spec/lib/g5_foundation_client/models/client_spec.rb
189
- - spec/lib/g5_foundation_client/models/integration_setting_spec.rb
190
189
  - spec/lib/g5_foundation_client/models/location_spec.rb
191
190
  - spec/lib/g5_foundation_client_spec.rb
192
191
  - spec/spec_helper.rb
@@ -1,30 +0,0 @@
1
- class G5FoundationClient::IntegrationSetting
2
- attr_accessor :integration_setting_hash
3
- attr_accessor :location
4
-
5
- def initialize(attrs)
6
- self.location = attrs.delete(:location) || attrs.delete('location')
7
- self.integration_setting_hash = ActiveSupport::HashWithIndifferentAccess.new attrs
8
- end
9
-
10
- def to_settings_hash
11
- self.integration_setting_hash
12
- end
13
-
14
- def lead?
15
- 'lead' == self.vendor_action
16
- end
17
-
18
- def inventory?
19
- 'inventory' == self.vendor_action
20
- end
21
-
22
- [:location_uid, :urn, :uid, :job_frequency_in_minutes, :vendor_action, :strategy_name,
23
- :vendor_endpoint, :vendor_user_name, :vendor_password].each do |field|
24
- define_method(field) { self.integration_setting_hash[field] }
25
- end
26
-
27
- def vendor_action
28
- self.integration_setting_hash[:vendor_action]
29
- end
30
- end
@@ -1,71 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe G5FoundationClient::IntegrationSetting do
4
- before { G5FoundationClient.access_token = 'token' }
5
-
6
- describe 'instantiating with a hash' do
7
- let(:uid) { 'http://uid-is.com' }
8
- let(:urn) { 'is' }
9
- let(:job_frequency_in_minutes) { 60 }
10
- let(:service_url) { 'http://inventory.service.example.com' }
11
- let(:location) { 'location' }
12
- let(:location_uid) { 'location-uid' }
13
- let(:strategy_name) { 'Centershift' }
14
- let(:vendor_endpoint) { 'http://centershift.example.com' }
15
- let(:vendor_user_name) { 'uname' }
16
- let(:vendor_password) { 'pw' }
17
- let(:vendor_action) { 'inventory' }
18
- let(:custom_integration_settings) { {foo: 'bar'} }
19
- let(:init_hash) { {service_url: service_url,
20
- location: location,
21
- job_frequency_in_minutes: job_frequency_in_minutes,
22
- strategy_name: strategy_name,
23
- vendor_endpoint: vendor_endpoint,
24
- vendor_user_name: vendor_user_name,
25
- vendor_password: vendor_password,
26
- vendor_action: 'inventory',
27
- location_uid: location_uid,
28
- uid: uid,
29
- urn: urn
30
- } }
31
-
32
- let(:expected_hash) do
33
- hash = init_hash.dup
34
- hash.delete(:location)
35
- hash.keys.each do |key|
36
- hash[key.to_s] = hash.delete(key)
37
- end
38
- hash
39
- end
40
-
41
- subject { G5FoundationClient::IntegrationSetting.new(init_hash) }
42
-
43
- its(:job_frequency_in_minutes) { should eql(job_frequency_in_minutes) }
44
- its(:location) { should eql(location) }
45
- its(:location_uid) { should eql(location_uid) }
46
- its(:uid) { should eql(uid) }
47
- its(:urn) { should eql(urn) }
48
- its(:vendor_action) { should eql(vendor_action) }
49
- its(:vendor_endpoint) { should eql(vendor_endpoint) }
50
- its(:vendor_user_name) { should eql(vendor_user_name) }
51
- its(:vendor_password) { should eql(vendor_password) }
52
- its(:strategy_name) { should eql(strategy_name) }
53
- its(:to_settings_hash) { should eq(expected_hash) }
54
- its(:inventory?) { should be_true }
55
- its(:lead?) { should be_false }
56
- end
57
-
58
- describe 'vendor actions' do
59
- context 'inventory' do
60
- subject { G5FoundationClient::IntegrationSetting.new(vendor_action: 'inventory') }
61
- its(:inventory?) { should be_true }
62
- its(:lead?) { should be_false }
63
- end
64
-
65
- context 'lead' do
66
- subject { G5FoundationClient::IntegrationSetting.new(vendor_action: 'lead') }
67
- its(:inventory?) { should be_false }
68
- its(:lead?) { should be_true }
69
- end
70
- end
71
- end