MuranoCLI 3.0.2 → 3.0.4

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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +30 -59
  3. data/Gemfile +9 -3
  4. data/MuranoCLI.gemspec +11 -4
  5. data/bin/murano +2 -90
  6. data/lib/MrMurano.rb +5 -1
  7. data/lib/MrMurano/{spec_commander.rb → Commander-Entry.rb} +1 -2
  8. data/lib/MrMurano/Solution.rb +12 -15
  9. data/lib/MrMurano/SolutionId.rb +1 -5
  10. data/lib/MrMurano/SyncAllowed.rb +2 -2
  11. data/lib/MrMurano/SyncUpDown.rb +6 -3
  12. data/lib/MrMurano/progress.rb +11 -2
  13. data/lib/MrMurano/verbosing.rb +3 -2
  14. data/lib/MrMurano/version.rb +2 -2
  15. data/spec/Account-Passwords_spec.rb +34 -48
  16. data/spec/Account_spec.rb +58 -63
  17. data/spec/Business_spec.rb +151 -139
  18. data/spec/ConfigFile_spec.rb +15 -11
  19. data/spec/ConfigMigrate_spec.rb +23 -12
  20. data/spec/Config_spec.rb +57 -54
  21. data/spec/Content_spec.rb +233 -201
  22. data/spec/GatewayBase_spec.rb +35 -27
  23. data/spec/GatewayDevice_spec.rb +149 -149
  24. data/spec/GatewayResource_spec.rb +115 -102
  25. data/spec/GatewaySettings_spec.rb +69 -62
  26. data/spec/Http_spec.rb +66 -56
  27. data/spec/MakePretties_spec.rb +82 -73
  28. data/spec/Mock_spec.rb +38 -29
  29. data/spec/ProjectFile_spec.rb +118 -106
  30. data/spec/Setting_spec.rb +24 -15
  31. data/spec/Solution-ServiceConfig_spec.rb +168 -140
  32. data/spec/Solution-ServiceEventHandler_spec.rb +186 -188
  33. data/spec/Solution-ServiceModules_spec.rb +314 -232
  34. data/spec/Solution-UsersRoles_spec.rb +136 -86
  35. data/spec/Solution_spec.rb +78 -50
  36. data/spec/SyncRoot_spec.rb +26 -24
  37. data/spec/SyncUpDown_spec.rb +268 -249
  38. data/spec/Verbosing_spec.rb +95 -93
  39. data/spec/Webservice-Cors_spec.rb +141 -95
  40. data/spec/Webservice-Endpoint_spec.rb +382 -346
  41. data/spec/Webservice-File_spec.rb +148 -109
  42. data/spec/Webservice-Setting_spec.rb +47 -41
  43. data/spec/cmd_business_spec.rb +17 -17
  44. data/spec/cmd_common.rb +27 -7
  45. data/spec/cmd_config_spec.rb +31 -20
  46. data/spec/cmd_content_spec.rb +80 -68
  47. data/spec/cmd_cors_spec.rb +11 -5
  48. data/spec/cmd_device_spec.rb +16 -14
  49. data/spec/cmd_domain_spec.rb +10 -8
  50. data/spec/cmd_exchange_spec.rb +3 -3
  51. data/spec/cmd_init_spec.rb +100 -101
  52. data/spec/cmd_keystore_spec.rb +17 -12
  53. data/spec/cmd_link_spec.rb +22 -37
  54. data/spec/cmd_password_spec.rb +11 -7
  55. data/spec/cmd_setting_application_spec.rb +47 -33
  56. data/spec/cmd_setting_product_spec.rb +32 -27
  57. data/spec/cmd_status_spec.rb +125 -114
  58. data/spec/cmd_syncdown_spec.rb +70 -65
  59. data/spec/cmd_syncup_spec.rb +19 -15
  60. data/spec/cmd_usage_spec.rb +14 -10
  61. metadata +29 -15
@@ -1,3 +1,10 @@
1
+ # Last Modified: 2017.09.12 /coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ # Copyright © 2016-2017 Exosite LLC.
5
+ # License: MIT. See LICENSE.txt.
6
+ # vim:tw=0:ts=2:sw=2:et:ai
7
+
1
8
  require 'tempfile'
2
9
  require 'yaml'
3
10
  require 'MrMurano/version'
@@ -7,11 +14,14 @@ require 'MrMurano/SyncRoot'
7
14
  require 'MrMurano/SyncUpDown'
8
15
  require '_workspace'
9
16
 
17
+ # rubocop:disable Style/ClassAndModuleChildren
18
+ # "Use nested module/class definitions instead of compact style."
10
19
  module ::MrMurano
11
20
  module Testset
12
21
  class Settings
13
22
  def specific
14
23
  end
24
+
15
25
  def specific=(x)
16
26
  end
17
27
  end
@@ -21,7 +31,7 @@ module ::MrMurano
21
31
  end
22
32
 
23
33
  RSpec.describe MrMurano::Setting do
24
- include_context "WORKSPACE"
34
+ include_context 'WORKSPACE'
25
35
  before(:example) do
26
36
  MrMurano::SyncRoot.instance.reset
27
37
  $cfg = MrMurano::Config.new
@@ -32,37 +42,37 @@ RSpec.describe MrMurano::Setting do
32
42
  @srv = MrMurano::Setting.new
33
43
  end
34
44
 
35
- context "maps service name" do
36
- it "device2 into Gateway" do
45
+ context 'maps service name' do
46
+ it 'device2 into Gateway' do
37
47
  ret = @srv.mapservice('device2')
38
48
  expect(ret).to eq('Gateway')
39
49
  end
40
50
 
41
- it "gaTeWaY into Gateway" do
51
+ it 'gaTeWaY into Gateway' do
42
52
  ret = @srv.mapservice('gaTeWaY')
43
53
  expect(ret).to eq('Gateway')
44
54
  end
45
55
 
46
- it "WeBServICe into Webservice" do
56
+ it 'WeBServICe into Webservice' do
47
57
  ret = @srv.mapservice('WeBServICe')
48
58
  expect(ret).to eq('Webservice')
49
59
  end
50
60
 
51
- it "bob into Bob" do
61
+ it 'bob into Bob' do
52
62
  ret = @srv.mapservice('bob')
53
63
  expect(ret).to eq('Bob')
54
64
  end
55
65
  end
56
66
 
57
- context "read" do
67
+ context 'read' do
58
68
  it "displays error when Service doesn't exist" do
59
- expect(@srv).to receive(:error).with("No Settings on \"Fiddlingsticks\"")
69
+ expect(@srv).to receive(:error).with('No Settings on "Fiddlingsticks"')
60
70
  ret = @srv.read('Fiddlingsticks', 'specific')
61
71
  expect(ret).to be_nil
62
72
  end
63
73
 
64
74
  it "displays error when Service doesn't have any Settings" do
65
- expect(@srv).to receive(:error).with("No Settings on \"Testsettwo\"")
75
+ expect(@srv).to receive(:error).with('No Settings on "Testsettwo"')
66
76
  ret = @srv.read('Testsettwo', 'specific')
67
77
  expect(ret).to be_nil
68
78
  end
@@ -73,22 +83,22 @@ RSpec.describe MrMurano::Setting do
73
83
  expect(ret).to be_nil
74
84
  end
75
85
 
76
- it "the settings" do
86
+ it 'the settings' do
77
87
  expect_any_instance_of(MrMurano::Testset::Settings).to receive(:specific).and_return(4)
78
88
  ret = @srv.read('Testset', 'specific')
79
89
  expect(ret).to eq(4)
80
90
  end
81
91
  end
82
92
 
83
- context "writes" do
93
+ context 'writes' do
84
94
  it "displays error when Service doesn't exist" do
85
- expect(@srv).to receive(:error).with("No Settings on \"Fiddlingsticks\"")
95
+ expect(@srv).to receive(:error).with('No Settings on "Fiddlingsticks"')
86
96
  ret = @srv.write('Fiddlingsticks', 'specific', 4)
87
97
  expect(ret).to be_nil
88
98
  end
89
99
 
90
100
  it "displays error when Service doesn't have any Settings" do
91
- expect(@srv).to receive(:error).with("No Settings on \"Testsettwo\"")
101
+ expect(@srv).to receive(:error).with('No Settings on "Testsettwo"')
92
102
  ret = @srv.write('Testsettwo', 'specific', 4)
93
103
  expect(ret).to be_nil
94
104
  end
@@ -99,7 +109,7 @@ RSpec.describe MrMurano::Setting do
99
109
  expect(ret).to be_nil
100
110
  end
101
111
 
102
- it "the settings" do
112
+ it 'the settings' do
103
113
  expect_any_instance_of(MrMurano::Testset::Settings).to receive(:specific=).with(4).and_return(4)
104
114
  ret = @srv.write('Testset', 'specific', 4)
105
115
  expect(ret).to eq(4)
@@ -107,4 +117,3 @@ RSpec.describe MrMurano::Setting do
107
117
  end
108
118
  end
109
119
 
110
- # vim: set ai et sw=2 ts=2 :
@@ -1,3 +1,10 @@
1
+ # Last Modified: 2017.09.12 /coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ # Copyright © 2016-2017 Exosite LLC.
5
+ # License: MIT. See LICENSE.txt.
6
+ # vim:tw=0:ts=2:sw=2:et:ai
7
+
1
8
  require 'tempfile'
2
9
  require 'MrMurano/version'
3
10
  require 'MrMurano/ProjectFile'
@@ -6,7 +13,7 @@ require 'MrMurano/SyncRoot'
6
13
  require '_workspace'
7
14
 
8
15
  RSpec.describe MrMurano::ServiceConfig do
9
- include_context "WORKSPACE"
16
+ include_context 'WORKSPACE'
10
17
  before(:example) do
11
18
  MrMurano::SyncRoot.instance.reset
12
19
  $cfg = MrMurano::Config.new
@@ -21,221 +28,242 @@ RSpec.describe MrMurano::ServiceConfig do
21
28
  # ServiceConfig needs an api_id, else one could instantiate
22
29
  # ServiceConfigApplication or ServiceConfigProduct.
23
30
  @srv = MrMurano::ServiceConfig.new('XYZ')
24
- allow(@srv).to receive(:token).and_return("TTTTTTTTTT")
31
+ allow(@srv).to receive(:token).and_return('TTTTTTTTTT')
25
32
  end
26
33
 
27
- it "initializes" do
34
+ it 'initializes' do
28
35
  uri = @srv.endpoint('/')
29
- expect(uri.to_s).to eq("https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/")
36
+ expect(uri.to_s).to eq('https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/')
30
37
  end
31
38
 
32
- it "lists" do
33
- body = {:items=>[{:id=>"9K0",
34
- :name=>"debug",
35
- :alias=>"XYZ_debug",
36
- :solution_id=>"XYZ",
37
- :service=>"device",
38
- :status=>"ready",
39
- :created_at=>"2016-07-07T19:16:19.479Z",
40
- :updated_at=>"2016-09-12T13:26:55.868Z",
41
- :deleted_at=>nil}],
42
- :total=>1}
43
- stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig").
44
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
45
- 'Content-Type'=>'application/json'}).
46
- to_return(body: body.to_json)
39
+ it 'lists' do
40
+ body = {
41
+ items: [
42
+ {
43
+ id: '9K0',
44
+ name: 'debug',
45
+ alias: 'XYZ_debug',
46
+ solution_id: 'XYZ',
47
+ service: 'device',
48
+ status: 'ready',
49
+ created_at: '2016-07-07T19:16:19.479Z',
50
+ updated_at: '2016-09-12T13:26:55.868Z',
51
+ deleted_at: nil,
52
+ },
53
+ ],
54
+ total: 1,
55
+ }
56
+ stub_request(
57
+ :get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig'
58
+ ).with(
59
+ headers: { 'Authorization' => 'token TTTTTTTTTT',
60
+ 'Content-Type' => 'application/json', }
61
+ ).to_return(body: body.to_json)
47
62
 
48
63
  ret = @srv.list
49
64
  expect(ret).to eq(body[:items])
50
65
  end
51
66
 
52
- it "fetches" do
53
- body = {:id=>"9K0",
54
- :name=>"debug",
55
- :alias=>"XYZ_debug",
56
- :solution_id=>"XYZ",
57
- :service=>"device",
58
- :status=>"ready",
59
- :created_at=>"2016-07-07T19:16:19.479Z",
60
- :updated_at=>"2016-09-12T13:26:55.868Z"
67
+ it 'fetches' do
68
+ body = {
69
+ id: '9K0',
70
+ name: 'debug',
71
+ alias: 'XYZ_debug',
72
+ solution_id: 'XYZ',
73
+ service: 'device',
74
+ status: 'ready',
75
+ created_at: '2016-07-07T19:16:19.479Z',
76
+ updated_at: '2016-09-12T13:26:55.868Z',
61
77
  }
62
- stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0").
63
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
64
- 'Content-Type'=>'application/json'}).
65
- to_return(body: body.to_json)
78
+ stub_request(
79
+ :get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0'
80
+ ).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
81
+ 'Content-Type' => 'application/json', }).to_return(body: body.to_json)
66
82
 
67
83
  ret = @srv.fetch('9K0')
68
84
  expect(ret).to eq(body)
69
85
  end
70
86
 
71
- it "creates" do
72
- body = {:id=>"9K0",
73
- :name=>"debug",
74
- :alias=>"XYZ_debug",
75
- :solution_id=>"XYZ",
76
- :service=>"device",
77
- :status=>"ready",
78
- :created_at=>"2016-07-07T19:16:19.479Z",
79
- :updated_at=>"2016-09-12T13:26:55.868Z"
87
+ it 'creates' do
88
+ body = {
89
+ id: '9K0',
90
+ name: 'debug',
91
+ alias: 'XYZ_debug',
92
+ solution_id: 'XYZ',
93
+ service: 'device',
94
+ status: 'ready',
95
+ created_at: '2016-07-07T19:16:19.479Z',
96
+ updated_at: '2016-09-12T13:26:55.868Z',
80
97
  }
81
98
  # VERIFY/2017-07-03: Does this POST now need a trailing path delimiter?
82
99
  #stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig").
83
- stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/").
84
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
85
- 'Content-Type'=>'application/json'}).
86
- to_return(body: body.to_json)
100
+ stub_request(
101
+ :post, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/'
102
+ ).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
103
+ 'Content-Type' => 'application/json', }).to_return(body: body.to_json)
87
104
 
88
105
  ret = @srv.create('p4q0m2ruyoxierh')
89
106
  expect(ret).to eq(body)
90
107
  end
91
108
 
92
- it "removes" do
109
+ it 'removes' do
93
110
  body = {}
94
- stub_request(:delete, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0").
95
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
96
- 'Content-Type'=>'application/json'}).
97
- to_return(body: body.to_json)
111
+ stub_request(
112
+ :delete, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0'
113
+ ).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
114
+ 'Content-Type' => 'application/json', }).to_return(body: body.to_json)
98
115
 
99
116
  ret = @srv.remove('9K0')
100
117
  expect(ret).to eq(body)
101
118
  end
102
119
 
103
- it "gets id from service" do
104
- body = {:items=>[{:id=>"9K0",
105
- :name=>"debug",
106
- :alias=>"XYZ_debug",
107
- :solution_id=>"XYZ",
108
- :service=>"device",
109
- :status=>"ready",
110
- :created_at=>"2016-07-07T19:16:19.479Z",
111
- :updated_at=>"2016-09-12T13:26:55.868Z",
112
- :deleted_at=>nil}],
113
- :total=>1}
114
- stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig").
115
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
116
- 'Content-Type'=>'application/json'}).
117
- to_return(body: body.to_json)
120
+ it 'gets id from service' do
121
+ body = {
122
+ items: [
123
+ {
124
+ id: '9K0',
125
+ name: 'debug',
126
+ alias: 'XYZ_debug',
127
+ solution_id: 'XYZ',
128
+ service: 'device',
129
+ status: 'ready',
130
+ created_at: '2016-07-07T19:16:19.479Z',
131
+ updated_at: '2016-09-12T13:26:55.868Z',
132
+ deleted_at: nil,
133
+ },
134
+ ],
135
+ total: 1,
136
+ }
137
+ stub_request(
138
+ :get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig'
139
+ ).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
140
+ 'Content-Type' => 'application/json', }).to_return(body: body.to_json)
118
141
 
119
142
  ret = @srv.scid_for_name('device')
120
- expect(ret).to eq("9K0")
143
+ expect(ret).to eq('9K0')
121
144
  end
122
145
 
123
- it "gets nil if not there" do
124
- body = {:items=>[{:id=>"9K0",
125
- :name=>"debug",
126
- :alias=>"XYZ_debug",
127
- :solution_id=>"XYZ",
128
- :service=>"device",
129
- :status=>"ready",
130
- :created_at=>"2016-07-07T19:16:19.479Z",
131
- :updated_at=>"2016-09-12T13:26:55.868Z",
132
- :deleted_at=>nil}],
133
- :total=>1}
134
- stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig").
135
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
136
- 'Content-Type'=>'application/json'}).
137
- to_return(body: body.to_json)
146
+ it 'gets nil if not there' do
147
+ body = {
148
+ items: [
149
+ {
150
+ id: '9K0',
151
+ name: 'debug',
152
+ alias: 'XYZ_debug',
153
+ solution_id: 'XYZ',
154
+ service: 'device',
155
+ status: 'ready',
156
+ created_at: '2016-07-07T19:16:19.479Z',
157
+ updated_at: '2016-09-12T13:26:55.868Z',
158
+ deleted_at: nil,
159
+ },
160
+ ],
161
+ total: 1,
162
+ }
163
+ stub_request(
164
+ :get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig'
165
+ ).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
166
+ 'Content-Type' => 'application/json', }).to_return(body: body.to_json)
138
167
 
139
168
  ret = @srv.scid_for_name('debug')
140
169
  expect(ret).to eq(nil)
141
170
  end
142
171
 
143
- it "gets info" do
144
- body = {:calls=>{:daily=>0, :monthly=>0, :total=>0}}
145
- stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/info").
146
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
147
- 'Content-Type'=>'application/json'}).
148
- to_return(body: body.to_json)
172
+ it 'gets info' do
173
+ body = { calls: { daily: 0, monthly: 0, total: 0 } }
174
+ stub_request(
175
+ :get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/info'
176
+ ).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
177
+ 'Content-Type' => 'application/json', }).to_return(body: body.to_json)
149
178
 
150
179
  ret = @srv.info('9K0')
151
180
  expect(ret).to eq(body)
152
181
  end
153
182
 
154
- context "calls" do
183
+ context 'calls' do
155
184
  before(:example) do
156
- allow(@srv).to receive(:scid).and_return("9K0")
185
+ allow(@srv).to receive(:scid).and_return('9K0')
157
186
  end
158
- it "a get" do
159
- body = {:calls=>{:daily=>0, :monthly=>0, :total=>0}}
160
- stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/info").
161
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
162
- 'Content-Type'=>'application/json'}).
163
- to_return(body: body.to_json)
187
+ it 'a get' do
188
+ body = { calls: { daily: 0, monthly: 0, total: 0 } }
189
+ stub_request(
190
+ :get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/info'
191
+ ).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
192
+ 'Content-Type' => 'application/json', }).to_return(body: body.to_json)
164
193
 
165
194
  ret = @srv.call(:info)
166
195
  expect(ret).to eq(body)
167
196
  end
168
197
 
169
- it "a get with query" do
170
- body = {:calls=>{:daily=>0, :monthly=>0, :total=>0}}
171
- stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/ask?q=what").
172
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
173
- 'Content-Type'=>'application/json'}).
174
- to_return(body: body.to_json)
198
+ it 'a get with query' do
199
+ body = { calls: { daily: 0, monthly: 0, total: 0 } }
200
+ stub_request(
201
+ :get, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/ask?q=what'
202
+ ).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
203
+ 'Content-Type' => 'application/json', }).to_return(body: body.to_json)
175
204
 
176
- ret = @srv.call(:ask, :get, {:q=>'what'})
205
+ ret = @srv.call(:ask, :get, q: 'what')
177
206
  expect(ret).to eq(body)
178
207
  end
179
208
 
180
- it "a post" do
181
- body = {:calls=>{:daily=>0, :monthly=>0, :total=>0}}
182
- stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/ask").
183
- with(:body => JSON.generate({:q=> 'what'}),
184
- :headers=>{'Authorization'=>'token TTTTTTTTTT',
185
- 'Content-Type'=>'application/json'}).
186
- to_return(body: body.to_json)
209
+ it 'a post' do
210
+ body = { calls: { daily: 0, monthly: 0, total: 0 } }
211
+ stub_request(
212
+ :post, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/ask'
213
+ ).with(body: JSON.generate(q: 'what'),
214
+ headers: { 'Authorization' => 'token TTTTTTTTTT',
215
+ 'Content-Type' => 'application/json', }).to_return(body: body.to_json)
187
216
 
188
- ret = @srv.call(:ask, :post, {:q=>'what'})
217
+ ret = @srv.call(:ask, :post, q: 'what')
189
218
  expect(ret).to eq(body)
190
219
  end
191
220
 
192
- it "a post without data" do
193
- body = {:calls=>{:daily=>0, :monthly=>0, :total=>0}}
194
- stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/ask").
195
- with(:body => JSON.generate({}),
196
- :headers=>{'Authorization'=>'token TTTTTTTTTT',
197
- 'Content-Type'=>'application/json'}).
198
- to_return(body: body.to_json)
221
+ it 'a post without data' do
222
+ body = { calls: { daily: 0, monthly: 0, total: 0 } }
223
+ stub_request(
224
+ :post, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/ask'
225
+ ).with(body: JSON.generate({}),
226
+ headers: { 'Authorization' => 'token TTTTTTTTTT',
227
+ 'Content-Type' => 'application/json', }).to_return(body: body.to_json)
199
228
 
200
229
  ret = @srv.call(:ask, :post)
201
230
  expect(ret).to eq(body)
202
231
  end
203
232
 
204
- it "a put" do
205
- body = {:calls=>{:daily=>0, :monthly=>0, :total=>0}}
206
- stub_request(:put, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/ask").
207
- with(:body => JSON.generate({:q=> 'what'}),
208
- :headers=>{'Authorization'=>'token TTTTTTTTTT',
209
- 'Content-Type'=>'application/json'}).
210
- to_return(body: body.to_json)
233
+ it 'a put' do
234
+ body = { calls: { daily: 0, monthly: 0, total: 0 } }
235
+ stub_request(
236
+ :put, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/ask'
237
+ ).with(body: JSON.generate(q: 'what'),
238
+ headers: { 'Authorization' => 'token TTTTTTTTTT',
239
+ 'Content-Type' => 'application/json', }).to_return(body: body.to_json)
211
240
 
212
- ret = @srv.call(:ask, :put, {:q=>'what'})
241
+ ret = @srv.call(:ask, :put, q: 'what')
213
242
  expect(ret).to eq(body)
214
243
  end
215
244
 
216
- it "a put without data" do
217
- body = {:calls=>{:daily=>0, :monthly=>0, :total=>0}}
218
- stub_request(:put, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/ask").
219
- with(:body => JSON.generate({}),
220
- :headers=>{'Authorization'=>'token TTTTTTTTTT',
221
- 'Content-Type'=>'application/json'}).
222
- to_return(body: body.to_json)
245
+ it 'a put without data' do
246
+ body = { calls: { daily: 0, monthly: 0, total: 0 } }
247
+ stub_request(
248
+ :put, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/ask'
249
+ ).with(body: JSON.generate({}),
250
+ headers: { 'Authorization' => 'token TTTTTTTTTT',
251
+ 'Content-Type' => 'application/json', }).to_return(body: body.to_json)
223
252
 
224
253
  ret = @srv.call(:ask, :put)
225
254
  expect(ret).to eq(body)
226
255
  end
227
256
 
228
- it "a delete" do
229
- body = {:calls=>{:daily=>0, :monthly=>0, :total=>0}}
230
- stub_request(:delete, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/gone").
231
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
232
- 'Content-Type'=>'application/json'}).
233
- to_return(body: body.to_json)
257
+ it 'a delete' do
258
+ body = { calls: { daily: 0, monthly: 0, total: 0 } }
259
+ stub_request(
260
+ :delete, 'https://bizapi.hosted.exosite.io/api:1/solution/XYZ/serviceconfig/9K0/call/gone'
261
+ ).with(headers: { 'Authorization' => 'token TTTTTTTTTT',
262
+ 'Content-Type' => 'application/json', }).to_return(body: body.to_json)
234
263
 
235
264
  ret = @srv.call(:gone, :delete)
236
265
  expect(ret).to eq(body)
237
266
  end
238
267
  end
239
-
240
268
  end
241
- # vim: set ai et sw=2 ts=2 :
269
+