MrMurano 1.7.2 → 1.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/MrMurano/Account.rb +1 -0
- data/lib/MrMurano/version.rb +1 -1
- data/spec/Account_spec.rb +132 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3655d17a1566a75cb7a89d79323b458514bcf1d2
|
4
|
+
data.tar.gz: ac90241aa199a014f6899e0f7fc4b182e355b867
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92587bd388f594bf9e86a76fa67173da14578cc2908f6354a358a6a22a023aa1342da2615f2a7ca694b4c5feebc5ecb5ed6da50301f2f382a706cae831451aa3
|
7
|
+
data.tar.gz: ddbc90d1af909be0e304220e8c31a4614faf85679974bb36046e1cc579ff33f5c0278e3c498d201a12bdfe3d58cf78d606fc8134d51b63e69c0b51da3da3415e
|
data/lib/MrMurano/Account.rb
CHANGED
@@ -140,6 +140,7 @@ module MrMurano
|
|
140
140
|
## Create a new solution
|
141
141
|
def new_solution(name, type='dataApi')
|
142
142
|
raise "Missing Bussiness ID" if $cfg['business.id'].nil?
|
143
|
+
raise "Solution name must be lowercase" unless name.downcase!.nil?
|
143
144
|
post('business/' + $cfg['business.id'] + '/solution/', {:label=>name, :type=>type})
|
144
145
|
end
|
145
146
|
|
data/lib/MrMurano/version.rb
CHANGED
@@ -0,0 +1,132 @@
|
|
1
|
+
require 'MrMurano/version'
|
2
|
+
require 'MrMurano/Config'
|
3
|
+
require 'MrMurano/Account'
|
4
|
+
|
5
|
+
RSpec.describe MrMurano::Account do
|
6
|
+
before(:example) do
|
7
|
+
$cfg = MrMurano::Config.new
|
8
|
+
$cfg.load
|
9
|
+
$cfg['net.host'] = 'bizapi.hosted.exosite.io'
|
10
|
+
$cfg['business.id'] = 'XYZxyz'
|
11
|
+
$cfg['product.id'] = 'XYZ'
|
12
|
+
|
13
|
+
@acc = MrMurano::Account.new
|
14
|
+
allow(@acc).to receive(:token).and_return("TTTTTTTTTT")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "initializes" do
|
18
|
+
uri = @acc.endPoint('')
|
19
|
+
expect(uri.to_s).to eq("https://bizapi.hosted.exosite.io/api:1/")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "lists bussiness" do
|
23
|
+
bizlist = [{"bizid"=>"XXX","role"=>"admin","name"=>"MPS"},
|
24
|
+
{"bizid"=>"YYY","role"=>"admin","name"=>"MAE"}]
|
25
|
+
stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/user/BoB@place.net/membership/").
|
26
|
+
to_return(body: bizlist )
|
27
|
+
|
28
|
+
$cfg['user.name'] = 'BoB@place.net'
|
29
|
+
ret = @acc.businesses
|
30
|
+
expect(ret).to eq(bizlist)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "lists products" do
|
34
|
+
prdlist = [{"bizid"=>"XYZxyz","type"=>"onepModel","pid"=>"ABC","modelId"=>"cde","label"=>"fts"},
|
35
|
+
{"bizid"=>"XYZxyz","type"=>"onepModel","pid"=>"fgh","modelId"=>"ijk","label"=>"lua-test"}]
|
36
|
+
stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/product/").
|
37
|
+
to_return(body: prdlist )
|
38
|
+
|
39
|
+
ret = @acc.products
|
40
|
+
expect(ret).to eq(prdlist)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "lists products; without biz.id" do
|
44
|
+
allow($cfg).to receive(:get).with('business.id').and_return(nil)
|
45
|
+
expect { @acc.products }.to raise_error("Missing Bussiness ID")
|
46
|
+
end
|
47
|
+
|
48
|
+
it "creates product" do
|
49
|
+
stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/product/").
|
50
|
+
with(:body => {:label=>'ONe', :type=>'onepModel'}).
|
51
|
+
to_return(body: "" )
|
52
|
+
|
53
|
+
ret = @acc.new_product("ONe")
|
54
|
+
expect(ret).to eq({})
|
55
|
+
end
|
56
|
+
|
57
|
+
it "creates product; without biz.id" do
|
58
|
+
allow($cfg).to receive(:get).with('business.id').and_return(nil)
|
59
|
+
expect { @acc.new_product("ONe") }.to raise_error("Missing Bussiness ID")
|
60
|
+
end
|
61
|
+
|
62
|
+
it "deletes product" do
|
63
|
+
stub_request(:delete, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/product/ONe").
|
64
|
+
to_return(body: "" )
|
65
|
+
|
66
|
+
ret = @acc.delete_product("ONe")
|
67
|
+
expect(ret).to eq({})
|
68
|
+
end
|
69
|
+
|
70
|
+
it "deletes product; without biz.id" do
|
71
|
+
allow($cfg).to receive(:get).with('business.id').and_return(nil)
|
72
|
+
expect { @acc.delete_product("ONe") }.to raise_error("Missing Bussiness ID")
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
it "lists solutions" do
|
77
|
+
sollist = [{"bizid"=>"XYZxyz",
|
78
|
+
"type"=>"dataApi",
|
79
|
+
"domain"=>"two.apps.exosite.io",
|
80
|
+
"apiId"=>"abc",
|
81
|
+
"sid"=>"def"},
|
82
|
+
{"bizid"=>"XYZxyz",
|
83
|
+
"type"=>"dataApi",
|
84
|
+
"domain"=>"one.apps.exosite.io",
|
85
|
+
"apiId"=>"ghi",
|
86
|
+
"sid"=>"jkl"}]
|
87
|
+
stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/").
|
88
|
+
to_return(body: sollist )
|
89
|
+
|
90
|
+
ret = @acc.solutions
|
91
|
+
expect(ret).to eq(sollist)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "lists solutions; without biz.id" do
|
95
|
+
allow($cfg).to receive(:get).with('business.id').and_return(nil)
|
96
|
+
expect { @acc.solutions }.to raise_error("Missing Bussiness ID")
|
97
|
+
end
|
98
|
+
|
99
|
+
it "creates solution" do
|
100
|
+
stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/").
|
101
|
+
with(:body => {:label=>'one', :type=>'dataApi'}).
|
102
|
+
to_return(body: "" )
|
103
|
+
|
104
|
+
ret = @acc.new_solution("one")
|
105
|
+
expect(ret).to eq({})
|
106
|
+
end
|
107
|
+
|
108
|
+
it "creates solution; with upper case" do
|
109
|
+
expect { @acc.new_solution("ONe") }.to raise_error("Solution name must be lowercase")
|
110
|
+
end
|
111
|
+
|
112
|
+
it "creates solution; without biz.id" do
|
113
|
+
allow($cfg).to receive(:get).with('business.id').and_return(nil)
|
114
|
+
expect { @acc.new_solution("one") }.to raise_error("Missing Bussiness ID")
|
115
|
+
end
|
116
|
+
|
117
|
+
it "deletes solution" do
|
118
|
+
stub_request(:delete, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/one").
|
119
|
+
to_return(body: "" )
|
120
|
+
|
121
|
+
ret = @acc.delete_solution("one")
|
122
|
+
expect(ret).to eq({})
|
123
|
+
end
|
124
|
+
|
125
|
+
it "deletes solution; without biz.id" do
|
126
|
+
allow($cfg).to receive(:get).with('business.id').and_return(nil)
|
127
|
+
expect { @acc.delete_solution("one") }.to raise_error("Missing Bussiness ID")
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
# vim: set ai et sw=2 ts=2 :
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: MrMurano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Conrad Tadpol Tilstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -241,6 +241,7 @@ files:
|
|
241
241
|
- lib/MrMurano/verbosing.rb
|
242
242
|
- lib/MrMurano/version.rb
|
243
243
|
- spec/Account-Passwords_spec.rb
|
244
|
+
- spec/Account_spec.rb
|
244
245
|
- spec/ConfigFile_spec.rb
|
245
246
|
- spec/Config_spec.rb
|
246
247
|
- spec/MakePretties_spec.rb
|
@@ -289,6 +290,7 @@ specification_version: 4
|
|
289
290
|
summary: Do more from the command line with Murano
|
290
291
|
test_files:
|
291
292
|
- spec/Account-Passwords_spec.rb
|
293
|
+
- spec/Account_spec.rb
|
292
294
|
- spec/ConfigFile_spec.rb
|
293
295
|
- spec/Config_spec.rb
|
294
296
|
- spec/MakePretties_spec.rb
|