pvdgm-svc-client 0.1.6
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 +7 -0
- data/.document +5 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +75 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +21 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/bin/service_mgr +8 -0
- data/bin/service_mgr_completion +86 -0
- data/bin/valid_commands +16 -0
- data/bin/valid_resources +11 -0
- data/lib/pvdgm-svc-client/base_resource.rb +118 -0
- data/lib/pvdgm-svc-client/prompters/account_mapping_prompter.rb +26 -0
- data/lib/pvdgm-svc-client/prompters/configured_account_prompter.rb +30 -0
- data/lib/pvdgm-svc-client/prompters/configured_facility_prompter.rb +30 -0
- data/lib/pvdgm-svc-client/prompters/facility_mapping_prompter.rb +26 -0
- data/lib/pvdgm-svc-client/prompters/public_key_prompter.rb +27 -0
- data/lib/pvdgm-svc-client/prompters/service_definition_prompter.rb +30 -0
- data/lib/pvdgm-svc-client/prompters/service_prompter.rb +26 -0
- data/lib/pvdgm-svc-client/prompters/sltc_provider_prompter.rb +24 -0
- data/lib/pvdgm-svc-client/prompters/sltc_registration_prompter.rb +26 -0
- data/lib/pvdgm-svc-client/prompters/third_party_prompter.rb +26 -0
- data/lib/pvdgm-svc-client/resources/account_mapping.rb +83 -0
- data/lib/pvdgm-svc-client/resources/assessment_request.rb +61 -0
- data/lib/pvdgm-svc-client/resources/available_file.rb +48 -0
- data/lib/pvdgm-svc-client/resources/configured_account.rb +118 -0
- data/lib/pvdgm-svc-client/resources/configured_facility.rb +118 -0
- data/lib/pvdgm-svc-client/resources/facility_mapping.rb +90 -0
- data/lib/pvdgm-svc-client/resources/mds_pull_account.rb +55 -0
- data/lib/pvdgm-svc-client/resources/provider.rb +28 -0
- data/lib/pvdgm-svc-client/resources/public_key.rb +119 -0
- data/lib/pvdgm-svc-client/resources/service.rb +67 -0
- data/lib/pvdgm-svc-client/resources/service_definition.rb +147 -0
- data/lib/pvdgm-svc-client/resources/sltc_registration.rb +51 -0
- data/lib/pvdgm-svc-client/resources/third_party.rb +61 -0
- data/lib/pvdgm-svc-client/service_mgr_options.rb +157 -0
- data/lib/pvdgm-svc-client.rb +16 -0
- data/spec/base_resource_spec.rb +208 -0
- data/spec/service_mgr_options_spec.rb +266 -0
- data/spec/spec_helper.rb +22 -0
- metadata +202 -0
@@ -0,0 +1,208 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BaseResource do
|
4
|
+
|
5
|
+
context 'Private Methods' do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@cut = BaseResource.new({ use_ssl: false, server: 'localhost:3000', api_token: 'sltc_api_token'})
|
9
|
+
end
|
10
|
+
|
11
|
+
context '#invoke_rest' do
|
12
|
+
|
13
|
+
it "should return a raw string if a non-JSON response is made from the block" do
|
14
|
+
result = @cut.send(:invoke_rest, false) do
|
15
|
+
"abc123"
|
16
|
+
end
|
17
|
+
expect(result).to eq("abc123")
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should parse a response as JSON by default" do
|
21
|
+
result = @cut.send(:invoke_rest) do
|
22
|
+
'{ "message": "from the other side" }'
|
23
|
+
end
|
24
|
+
expect(result).to eq({ 'message' => 'from the other side' })
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should output an error message and exit if the JSON payload is invalid" do
|
28
|
+
expect {
|
29
|
+
@cut.send(:invoke_rest) do
|
30
|
+
'{ message => 3'
|
31
|
+
end
|
32
|
+
}.to raise_error(SystemExit)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should output an error message and exit if there is a non-403,404 exception" do
|
36
|
+
mock_response = double("Response")
|
37
|
+
mock_response.should_receive(:code).any_number_of_times.and_return(500)
|
38
|
+
mock_response.should_receive(:description).and_return("System error")
|
39
|
+
|
40
|
+
expect {
|
41
|
+
@cut.send(:invoke_rest) do
|
42
|
+
raise RestClient::Exception.new(mock_response, 500)
|
43
|
+
end
|
44
|
+
}.to raise_error(SystemExit)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should output an error message and exit if there is a 403 exception with no json" do
|
48
|
+
mock_response = double("Response")
|
49
|
+
mock_response.should_receive(:code).any_number_of_times.and_return(403)
|
50
|
+
mock_response.should_receive(:description).and_return("Some other error")
|
51
|
+
|
52
|
+
expect {
|
53
|
+
@cut.send(:invoke_rest, false) do
|
54
|
+
raise RestClient::Exception.new(mock_response, 403)
|
55
|
+
end
|
56
|
+
}.to raise_error(SystemExit)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should output an error message and exit if there is a 404 exception with error json" do
|
60
|
+
mock_response = double("Response")
|
61
|
+
mock_response.stub(:code).and_return(404)
|
62
|
+
mock_response.should_receive(:description).and_return("Some other error")
|
63
|
+
mock_response.should_receive(:http_body).and_return('{ "error" : "Error message" }')
|
64
|
+
|
65
|
+
expect {
|
66
|
+
@cut.send(:invoke_rest) do
|
67
|
+
raise RestClient::Exception.new(mock_response, 404)
|
68
|
+
end
|
69
|
+
}.to raise_error(SystemExit)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should output an error message and exit if there is a 403 exception with validation error json" do
|
73
|
+
mock_response = double("Response")
|
74
|
+
mock_response.should_receive(:code).any_number_of_times.and_return(403)
|
75
|
+
mock_response.should_receive(:description).and_return("Some other error")
|
76
|
+
mock_response.should_receive(:http_body).and_return('{ "validation_error" : { "name" : [ "Error 1", "Error 2" ] } }')
|
77
|
+
|
78
|
+
expect {
|
79
|
+
@cut.send(:invoke_rest) do
|
80
|
+
raise RestClient::Exception.new(mock_response, 403)
|
81
|
+
end
|
82
|
+
}.to raise_error(SystemExit)
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should output an error message and exit if there is a 403 exception with some other error json" do
|
86
|
+
mock_response = double("Response")
|
87
|
+
mock_response.should_receive(:code).any_number_of_times.and_return(403)
|
88
|
+
mock_response.should_receive(:description).and_return("Some other error")
|
89
|
+
mock_response.should_receive(:http_body).and_return('{ "other_error" : { "name" : [ "Error 1", "Error 2" ] } }')
|
90
|
+
|
91
|
+
expect {
|
92
|
+
@cut.send(:invoke_rest) do
|
93
|
+
raise RestClient::Exception.new(mock_response, 403)
|
94
|
+
end
|
95
|
+
}.to raise_error(SystemExit)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should output an error message and exit if there is a 403 exception with invalid validation error json" do
|
99
|
+
mock_response = double("Response")
|
100
|
+
mock_response.should_receive(:code).any_number_of_times.and_return(403)
|
101
|
+
mock_response.should_receive(:description).and_return("Some other error")
|
102
|
+
mock_response.should_receive(:http_body).any_number_of_times.and_return('{ "validation_error" : { "name" : "Error 1", "Error 2" ] } }')
|
103
|
+
|
104
|
+
expect {
|
105
|
+
@cut.send(:invoke_rest) do
|
106
|
+
raise RestClient::Exception.new(mock_response, 403)
|
107
|
+
end
|
108
|
+
}.to raise_error(SystemExit)
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should output an error message and exit if there is an unknown exception raised in the block" do
|
112
|
+
expect {
|
113
|
+
@cut.send(:invoke_rest) do
|
114
|
+
raise "Some unknown exception"
|
115
|
+
end
|
116
|
+
}.to raise_error(SystemExit)
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
context '#get' do
|
122
|
+
|
123
|
+
it "should return the response from the GET call" do
|
124
|
+
@cut.should_receive(:invoke_rest).with(true).and_yield
|
125
|
+
|
126
|
+
RestClient.should_receive(:get).
|
127
|
+
with('http://localhost:3000/tubes', {"Authorization"=>"Token token=\"sltc_api_token\"" }).
|
128
|
+
and_return({ hey: 'guy' })
|
129
|
+
|
130
|
+
expect(@cut.send(:get, 'tubes')).to eq({ hey: 'guy' })
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
context '#delete' do
|
136
|
+
|
137
|
+
it "should return the response from the DELETE call" do
|
138
|
+
@cut.should_receive(:invoke_rest).with(true).and_yield
|
139
|
+
|
140
|
+
RestClient.should_receive(:delete).
|
141
|
+
with('http://localhost:3000/tubes', {"Authorization"=>"Token token=\"sltc_api_token\"" }).
|
142
|
+
and_return({ hey: 'guy' })
|
143
|
+
|
144
|
+
expect(@cut.send(:delete, 'tubes')).to eq({ hey: 'guy' })
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
context '#post' do
|
150
|
+
|
151
|
+
it "should return the response from the POST call" do
|
152
|
+
@cut.should_receive(:invoke_rest).with(true).and_yield
|
153
|
+
|
154
|
+
RestClient.should_receive(:post).
|
155
|
+
with('http://localhost:3000/tubes',
|
156
|
+
{"param1"=>"pvalue"},
|
157
|
+
{"Authorization"=>"Token token=\"sltc_api_token\"" }).
|
158
|
+
and_return({ hey: 'guy' })
|
159
|
+
|
160
|
+
expect(@cut.send(:post, 'tubes', { 'param1' => 'pvalue' })).to eq({ hey: 'guy' })
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
context '#put' do
|
166
|
+
|
167
|
+
it "should return the response from the PUT call" do
|
168
|
+
@cut.should_receive(:invoke_rest).with(true).and_yield
|
169
|
+
|
170
|
+
RestClient.should_receive(:put).
|
171
|
+
with('http://localhost:3000/tubes',
|
172
|
+
{"param1"=>"pvalue"},
|
173
|
+
{"Authorization"=>"Token token=\"sltc_api_token\"" }).
|
174
|
+
and_return({ hey: 'guy' })
|
175
|
+
|
176
|
+
expect(@cut.send(:put, 'tubes', { 'param1' => 'pvalue' })).to eq({ hey: 'guy' })
|
177
|
+
end
|
178
|
+
|
179
|
+
end
|
180
|
+
|
181
|
+
context '#build_url' do
|
182
|
+
|
183
|
+
it "should return the properly formatted url" do
|
184
|
+
@cut.options[:use_ssl] = false
|
185
|
+
@cut.options[:server] = 'www.bob.com'
|
186
|
+
|
187
|
+
expect(@cut.send(:build_url, 'the_uri')).to eq('http://www.bob.com/the_uri')
|
188
|
+
|
189
|
+
@cut.options[:use_ssl] = true
|
190
|
+
|
191
|
+
expect(@cut.send(:build_url, 'the_uri')).to eq('https://www.bob.com/the_uri')
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
|
196
|
+
context '#authentication_headers' do
|
197
|
+
|
198
|
+
it "should return a hash containing the authentication headers" do
|
199
|
+
@cut.options[:api_token] = 'this is the token string'
|
200
|
+
expect(@cut.send(:authentication_headers)).
|
201
|
+
to eq( { 'Authorization' => "Token token=\"this is the token string\"" } )
|
202
|
+
end
|
203
|
+
|
204
|
+
end
|
205
|
+
|
206
|
+
end
|
207
|
+
|
208
|
+
end
|
@@ -0,0 +1,266 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ServiceMgrOptions do
|
4
|
+
|
5
|
+
# The current set of all resources. This automatically updates if new
|
6
|
+
# resources are added to the application
|
7
|
+
RESOURCES = Resources.constants.map { | const | ActiveSupport::Inflector.underscore(const.to_s) }
|
8
|
+
COMMANDS = RESOURCES.inject(Hash.new { | h, k | h[k] = [] }) do | acc, resource |
|
9
|
+
acc.tap do | a |
|
10
|
+
a[resource] = eval("Resources::#{ActiveSupport::Inflector.camelize(resource)}").instance_methods(false)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
before(:each) do
|
15
|
+
@cut = ServiceMgrOptions.new
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'Public Methods' do
|
19
|
+
|
20
|
+
context '#parse_options!' do
|
21
|
+
|
22
|
+
context 'without an api token' do
|
23
|
+
|
24
|
+
it "should raise an exception if no API token has been specified" do
|
25
|
+
argv = []
|
26
|
+
expect { @cut.parse_options!(argv) }.
|
27
|
+
to raise_error(SystemExit)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'with an api token' do
|
33
|
+
|
34
|
+
it "should provide a default resource and command if none is specified on the command line" do
|
35
|
+
argv = ['--token', 'the_token' ]
|
36
|
+
expect(@cut.parse_options!(argv)).
|
37
|
+
to eq([ { server: 'www.abaqis.com', use_ssl: true, api_token: 'the_token', trace: false }, # Default options
|
38
|
+
'service', # Default resource
|
39
|
+
'list' ]) # Default command
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should use the specified resource and infer the command when the command is not specified" do
|
43
|
+
argv = ['--token', 'the_token', 'service' ]
|
44
|
+
expect(@cut.parse_options!(argv)).
|
45
|
+
to eq([ { server: 'www.abaqis.com', use_ssl: true, api_token: 'the_token', trace: false }, # Default options
|
46
|
+
'service', # Specified resource
|
47
|
+
'list' ]) # Default command
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should use the specified resource and command when specified" do
|
51
|
+
argv = ['--token', 'the_token', 'service', 'show' ]
|
52
|
+
expect(@cut.parse_options!(argv)).
|
53
|
+
to eq([ { server: 'www.abaqis.com', use_ssl: true, api_token: 'the_token', trace: false }, # Default options
|
54
|
+
'service', # Specified resource
|
55
|
+
'show' ]) # Specified command
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should render the help display and exit when the help option is specified" do
|
59
|
+
argv = [ '--help' ]
|
60
|
+
expect { @cut.parse_options!(argv) }.
|
61
|
+
to raise_error(SystemExit)
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should set the server option" do
|
65
|
+
argv = ['--token', 'the_token', '--server', 'test.abaqis.int' ]
|
66
|
+
expect(@cut.parse_options!(argv)).
|
67
|
+
to eq([ { server: 'test.abaqis.int',
|
68
|
+
use_ssl: true,
|
69
|
+
api_token: 'the_token',
|
70
|
+
trace: false }, # Default options
|
71
|
+
'service', # Default resource
|
72
|
+
'list' ]) # Default command
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should set the server/ssl option for local testing" do
|
76
|
+
argv = ['--token', 'the_token', '--local']
|
77
|
+
expect(@cut.parse_options!(argv)).
|
78
|
+
to eq([ { server: 'localhost:3000',
|
79
|
+
use_ssl: false,
|
80
|
+
api_token: 'the_token',
|
81
|
+
trace: false }, # Default options
|
82
|
+
'service', # Default resource
|
83
|
+
'list' ]) # Default command
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should set the server/ssl option for uat testing" do
|
87
|
+
argv = ['--token', 'the_token', '--uat']
|
88
|
+
expect(@cut.parse_options!(argv)).
|
89
|
+
to eq([ { server: 'uat.abaqis.com',
|
90
|
+
use_ssl: true,
|
91
|
+
api_token: 'the_token',
|
92
|
+
trace: false }, # Default options
|
93
|
+
'service', # Default resource
|
94
|
+
'list' ]) # Default command
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should display the resources/commands and exit" do
|
98
|
+
argv = [ '--list' ]
|
99
|
+
expect { @cut.parse_options!(argv) }.
|
100
|
+
to raise_error(SystemExit)
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should set the trace option" do
|
104
|
+
argv = ['--token', 'the_token', '--trace']
|
105
|
+
expect(@cut.parse_options!(argv)).
|
106
|
+
to eq([ { server: 'www.abaqis.com',
|
107
|
+
use_ssl: true,
|
108
|
+
api_token: 'the_token',
|
109
|
+
trace: true }, # Default options
|
110
|
+
'service', # Default resource
|
111
|
+
'list' ]) # Default command
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should the set the account mapping id" do
|
115
|
+
argv = ['--token', 'the_token', '--account-mapping-id', "234"]
|
116
|
+
expect(@cut.parse_options!(argv)).
|
117
|
+
to eq([ { server: 'www.abaqis.com',
|
118
|
+
use_ssl: true,
|
119
|
+
api_token: 'the_token',
|
120
|
+
trace: false,
|
121
|
+
account_mapping_id: "234" }, # Default options
|
122
|
+
'service', # Default resource
|
123
|
+
'list' ]) # Default command
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should the set the configured account id" do
|
127
|
+
argv = ['--token', 'the_token', '--configured-account-id', "234"]
|
128
|
+
expect(@cut.parse_options!(argv)).
|
129
|
+
to eq([ { server: 'www.abaqis.com',
|
130
|
+
use_ssl: true,
|
131
|
+
api_token: 'the_token',
|
132
|
+
trace: false,
|
133
|
+
configured_account_id: "234" }, # Default options
|
134
|
+
'service', # Default resource
|
135
|
+
'list' ]) # Default command
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should the set the facility mapping id" do
|
139
|
+
argv = ['--token', 'the_token', '--facility-mapping-id', "234"]
|
140
|
+
expect(@cut.parse_options!(argv)).
|
141
|
+
to eq([ { server: 'www.abaqis.com',
|
142
|
+
use_ssl: true,
|
143
|
+
api_token: 'the_token',
|
144
|
+
trace: false,
|
145
|
+
facility_mapping_id: "234" }, # Default options
|
146
|
+
'service', # Default resource
|
147
|
+
'list' ]) # Default command
|
148
|
+
end
|
149
|
+
|
150
|
+
it "should the set the service definition id" do
|
151
|
+
argv = ['--token', 'the_token', '--service-definition-id', "234"]
|
152
|
+
expect(@cut.parse_options!(argv)).
|
153
|
+
to eq([ { server: 'www.abaqis.com',
|
154
|
+
use_ssl: true,
|
155
|
+
api_token: 'the_token',
|
156
|
+
trace: false,
|
157
|
+
service_definition_id: "234" }, # Default options
|
158
|
+
'service', # Default resource
|
159
|
+
'list' ]) # Default command
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should the set the service id" do
|
163
|
+
argv = ['--token', 'the_token', '--service-id', "234"]
|
164
|
+
expect(@cut.parse_options!(argv)).
|
165
|
+
to eq([ { server: 'www.abaqis.com',
|
166
|
+
use_ssl: true,
|
167
|
+
api_token: 'the_token',
|
168
|
+
trace: false,
|
169
|
+
service_id: "234" }, # Default options
|
170
|
+
'service', # Default resource
|
171
|
+
'list' ]) # Default command
|
172
|
+
end
|
173
|
+
|
174
|
+
it "should the set the third party id" do
|
175
|
+
argv = ['--token', 'the_token', '--third-party-id', "234"]
|
176
|
+
expect(@cut.parse_options!(argv)).
|
177
|
+
to eq([ { server: 'www.abaqis.com',
|
178
|
+
use_ssl: true,
|
179
|
+
api_token: 'the_token',
|
180
|
+
trace: false,
|
181
|
+
third_party_id: "234" }, # Default options
|
182
|
+
'service', # Default resource
|
183
|
+
'list' ]) # Default command
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|
189
|
+
|
190
|
+
context '#invoke_command' do
|
191
|
+
|
192
|
+
it "should construct the resource with the options and invoke the command on the resource" do
|
193
|
+
@cut.should_receive(:parse_options!).
|
194
|
+
and_return( [ { }, 'service', 'list' ] )
|
195
|
+
|
196
|
+
mock_service = double("Service")
|
197
|
+
mock_service.should_receive(:send).
|
198
|
+
with(:list)
|
199
|
+
|
200
|
+
Resources::Service.should_receive(:new).
|
201
|
+
with({}).
|
202
|
+
and_return(mock_service)
|
203
|
+
|
204
|
+
@cut.invoke_command
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
context 'Private Methods' do
|
211
|
+
|
212
|
+
context '#valid_command?' do
|
213
|
+
|
214
|
+
it "should return true if the specified resource has the specified command" do
|
215
|
+
COMMANDS.each_pair do | resource, commands |
|
216
|
+
commands.each do | command |
|
217
|
+
expect(@cut.send(:valid_command?, resource, command.to_s)).
|
218
|
+
to be_true, "'#{command}' should be a valid command for resource '#{resource}'"
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
it "should return false if the specified resource doesn't have the specified command" do
|
224
|
+
expect(@cut.send(:valid_command?, 'service', 'invalid_command')).
|
225
|
+
to be_false
|
226
|
+
end
|
227
|
+
|
228
|
+
it "should return false if the specified resource is nil" do
|
229
|
+
expect(@cut.send(:valid_command?, nil, 'list')).
|
230
|
+
to be_false
|
231
|
+
end
|
232
|
+
|
233
|
+
it "should return false if the specified command is nil" do
|
234
|
+
expect(@cut.send(:valid_command?, 'service', nil)).
|
235
|
+
to be_false
|
236
|
+
end
|
237
|
+
|
238
|
+
it "should do something horrible if the resource name is bogus" do
|
239
|
+
expect { @cut.send(:valid_command?, 'bottle', 'list') }.
|
240
|
+
to raise_error(NameError)
|
241
|
+
end
|
242
|
+
|
243
|
+
end
|
244
|
+
|
245
|
+
context '#valid_resource' do
|
246
|
+
|
247
|
+
it "should return true if the specified resource is valid" do
|
248
|
+
expect(@cut.send(:valid_resource?, 'service')).
|
249
|
+
to be_true
|
250
|
+
end
|
251
|
+
|
252
|
+
it "should return false if the specified resource is not valid" do
|
253
|
+
expect(@cut.send(:valid_resource?, 'servicer')).
|
254
|
+
to be_false
|
255
|
+
end
|
256
|
+
|
257
|
+
it "should return false if the specified resource is nil" do
|
258
|
+
expect(@cut.send(:valid_resource?, nil)).
|
259
|
+
to be_false
|
260
|
+
end
|
261
|
+
|
262
|
+
end
|
263
|
+
|
264
|
+
end
|
265
|
+
|
266
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
|
4
|
+
# Here's the deal. We need to make sure that the API_TOKEN is not set
|
5
|
+
# environment before the tests are run. In fact, the ENV['API_TOKEN']
|
6
|
+
# must be cleared before the ServiceMgrOptions class is loaded. That's
|
7
|
+
# why we do it before the requires.
|
8
|
+
#
|
9
|
+
# I'm just sayin'
|
10
|
+
#
|
11
|
+
ENV.delete('API_TOKEN')
|
12
|
+
|
13
|
+
require 'rspec'
|
14
|
+
require 'pvdgm-svc-client'
|
15
|
+
|
16
|
+
# Requires supporting files with custom matchers and macros, etc,
|
17
|
+
# in ./support/ and its subdirectories.
|
18
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
19
|
+
|
20
|
+
RSpec.configure do |config|
|
21
|
+
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pvdgm-svc-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dave Sieh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.2.14
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.2.14
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: terminal-table
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: highline
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rdoc
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.12'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.12'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: bundler
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: jeweler
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.8.7
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.8.7
|
125
|
+
description: This gem provides command line and other types of tools to support the
|
126
|
+
Service Engine.
|
127
|
+
email: dave.sieh@providigm.com
|
128
|
+
executables:
|
129
|
+
- service_mgr
|
130
|
+
- service_mgr_completion
|
131
|
+
- valid_commands
|
132
|
+
- valid_resources
|
133
|
+
extensions: []
|
134
|
+
extra_rdoc_files:
|
135
|
+
- LICENSE.txt
|
136
|
+
- README.rdoc
|
137
|
+
files:
|
138
|
+
- ".document"
|
139
|
+
- Gemfile
|
140
|
+
- Gemfile.lock
|
141
|
+
- LICENSE.txt
|
142
|
+
- README.rdoc
|
143
|
+
- Rakefile
|
144
|
+
- VERSION
|
145
|
+
- bin/service_mgr
|
146
|
+
- bin/service_mgr_completion
|
147
|
+
- bin/valid_commands
|
148
|
+
- bin/valid_resources
|
149
|
+
- lib/pvdgm-svc-client.rb
|
150
|
+
- lib/pvdgm-svc-client/base_resource.rb
|
151
|
+
- lib/pvdgm-svc-client/prompters/account_mapping_prompter.rb
|
152
|
+
- lib/pvdgm-svc-client/prompters/configured_account_prompter.rb
|
153
|
+
- lib/pvdgm-svc-client/prompters/configured_facility_prompter.rb
|
154
|
+
- lib/pvdgm-svc-client/prompters/facility_mapping_prompter.rb
|
155
|
+
- lib/pvdgm-svc-client/prompters/public_key_prompter.rb
|
156
|
+
- lib/pvdgm-svc-client/prompters/service_definition_prompter.rb
|
157
|
+
- lib/pvdgm-svc-client/prompters/service_prompter.rb
|
158
|
+
- lib/pvdgm-svc-client/prompters/sltc_provider_prompter.rb
|
159
|
+
- lib/pvdgm-svc-client/prompters/sltc_registration_prompter.rb
|
160
|
+
- lib/pvdgm-svc-client/prompters/third_party_prompter.rb
|
161
|
+
- lib/pvdgm-svc-client/resources/account_mapping.rb
|
162
|
+
- lib/pvdgm-svc-client/resources/assessment_request.rb
|
163
|
+
- lib/pvdgm-svc-client/resources/available_file.rb
|
164
|
+
- lib/pvdgm-svc-client/resources/configured_account.rb
|
165
|
+
- lib/pvdgm-svc-client/resources/configured_facility.rb
|
166
|
+
- lib/pvdgm-svc-client/resources/facility_mapping.rb
|
167
|
+
- lib/pvdgm-svc-client/resources/mds_pull_account.rb
|
168
|
+
- lib/pvdgm-svc-client/resources/provider.rb
|
169
|
+
- lib/pvdgm-svc-client/resources/public_key.rb
|
170
|
+
- lib/pvdgm-svc-client/resources/service.rb
|
171
|
+
- lib/pvdgm-svc-client/resources/service_definition.rb
|
172
|
+
- lib/pvdgm-svc-client/resources/sltc_registration.rb
|
173
|
+
- lib/pvdgm-svc-client/resources/third_party.rb
|
174
|
+
- lib/pvdgm-svc-client/service_mgr_options.rb
|
175
|
+
- spec/base_resource_spec.rb
|
176
|
+
- spec/service_mgr_options_spec.rb
|
177
|
+
- spec/spec_helper.rb
|
178
|
+
homepage: http://github.com/GitHubAdmin/pvdgm-svc-client
|
179
|
+
licenses:
|
180
|
+
- MIT
|
181
|
+
metadata: {}
|
182
|
+
post_install_message:
|
183
|
+
rdoc_options: []
|
184
|
+
require_paths:
|
185
|
+
- lib
|
186
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - ">="
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
191
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - ">="
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: '0'
|
196
|
+
requirements: []
|
197
|
+
rubyforge_project:
|
198
|
+
rubygems_version: 2.2.2
|
199
|
+
signing_key:
|
200
|
+
specification_version: 4
|
201
|
+
summary: Command-line client tools to support the Service Engine
|
202
|
+
test_files: []
|