test_machine_shop 0.0.4 → 0.0.5
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 +4 -4
- data/lib/machineshop.rb +2 -1
- data/lib/machineshop/util.rb +2 -1
- data/lib/machineshop/version.rb +2 -1
- data/machineshop.gemspec +1 -0
- data/spec/lib/rule_spec.rb +14 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adca9a122051a8f1c3250ac5d8ade37083fcbd99
|
4
|
+
data.tar.gz: 797aa382e1f62c3d3c3c8e14212b5338952cf91f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 010531071dcc4e5d6a81cd2f783d31cc363609146daaf71da5bc2a80c0115ffb6e16055015e3b310adc5f6192c0841ad70fe3569795510133f37a1cff07fca4f
|
7
|
+
data.tar.gz: 0e9095226906ca3e97a5e031bee551a66589dba7c66707e130309dbb5643344ed955f90673593e5d3ffff60243d78c2169031e77032170437b20922148bdf3bc
|
data/lib/machineshop.rb
CHANGED
@@ -33,7 +33,8 @@ require 'machineshop/mapping'
|
|
33
33
|
require 'machineshop/meter'
|
34
34
|
require 'machineshop/report'
|
35
35
|
require 'machineshop/customer'
|
36
|
-
require 'machineshop/rule'
|
36
|
+
# require 'machineshop/rule'
|
37
|
+
require 'machineshop/rules'
|
37
38
|
# require 'machineshop/user'
|
38
39
|
require 'machineshop/users'
|
39
40
|
require 'machineshop/utility'
|
data/lib/machineshop/util.rb
CHANGED
data/lib/machineshop/version.rb
CHANGED
data/machineshop.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
13
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "machineshop"
|
14
15
|
gem.name = "test_machine_shop"
|
15
16
|
gem.require_paths = ["lib"]
|
16
17
|
gem.version = MachineShop::VERSION
|
data/spec/lib/rule_spec.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
require_relative '../spec_helper'
|
2
2
|
|
3
3
|
#MachineShop.api_base_url= 'http://machineshop.dev:3000/api/v0'
|
4
|
-
MachineShop.api_base_url= 'http://stage.services.machineshop.io/api/v0'
|
4
|
+
# MachineShop.api_base_url= 'http://stage.services.machineshop.io/api/v0'
|
5
|
+
MachineShop.api_base_url= 'localhost:3000/api/v1'
|
5
6
|
|
6
7
|
#publisher_username = 'publisher@machineshop.com'
|
7
|
-
publisher_username = '
|
8
|
+
publisher_username = 'publisher@csr.com'
|
8
9
|
publisher_password = 'password'
|
9
10
|
|
10
11
|
MachineShop.configure do |config|
|
@@ -16,18 +17,18 @@ MachineShop.configure do |config|
|
|
16
17
|
#second
|
17
18
|
end
|
18
19
|
|
19
|
-
auth_token, user = MachineShop::
|
20
|
+
auth_token, user = MachineShop::Users.authenticate(
|
20
21
|
:email => publisher_username,
|
21
22
|
:password => publisher_password
|
22
23
|
)
|
23
24
|
|
24
25
|
|
25
|
-
describe MachineShop::
|
26
|
+
describe MachineShop::Rules do
|
26
27
|
|
27
28
|
rules=nil
|
28
29
|
|
29
30
|
it "should get all the rules " do
|
30
|
-
rules = MachineShop::
|
31
|
+
rules = MachineShop::Rules.all({},auth_token)
|
31
32
|
# puts "rules haru : #{rules}"
|
32
33
|
# ap "getting rules"
|
33
34
|
# ap rules.as_json
|
@@ -67,7 +68,7 @@ describe MachineShop::Rule do
|
|
67
68
|
}
|
68
69
|
|
69
70
|
# ap "creating rule "
|
70
|
-
createdRule = MachineShop::
|
71
|
+
createdRule = MachineShop::Rules.create(create_hash,auth_token)
|
71
72
|
|
72
73
|
# ap createdRule.as_json
|
73
74
|
|
@@ -78,8 +79,8 @@ describe MachineShop::Rule do
|
|
78
79
|
specificRule = nil
|
79
80
|
|
80
81
|
it "should get rule by id" do
|
81
|
-
# ruleById = MachineShop::
|
82
|
-
specificRule = MachineShop::
|
82
|
+
# ruleById = MachineShop::Rules.retrieve(rules[0].id,auth_token)
|
83
|
+
specificRule = MachineShop::Rules.retrieve("5395b4829818008e790000f9",auth_token)
|
83
84
|
# ap "retrieved rule"
|
84
85
|
# ap specificRule.as_json
|
85
86
|
specificRule.should_not be_nil
|
@@ -87,7 +88,7 @@ describe MachineShop::Rule do
|
|
87
88
|
end
|
88
89
|
|
89
90
|
it "should delete rule by" do
|
90
|
-
# ruleById = MachineShop::
|
91
|
+
# ruleById = MachineShop::Rules.retrieve(rules[0].id,auth_token)
|
91
92
|
delete = specificRule.delete
|
92
93
|
# ap "Deleted rule"
|
93
94
|
# ap delete.as_json
|
@@ -96,7 +97,7 @@ describe MachineShop::Rule do
|
|
96
97
|
end
|
97
98
|
|
98
99
|
it "should get get join rule conditions" do
|
99
|
-
test_data = MachineShop::
|
100
|
+
test_data = MachineShop::Rules.get_join_rule_conditions(auth_token)
|
100
101
|
# puts "rule comparison : #{test_data.inspect}"
|
101
102
|
test_data.should_not be_nil
|
102
103
|
|
@@ -104,7 +105,7 @@ describe MachineShop::Rule do
|
|
104
105
|
|
105
106
|
|
106
107
|
it "should get comparison rule_conditions" do
|
107
|
-
test_data = MachineShop::
|
108
|
+
test_data = MachineShop::Rules.get_comparison_rule_conditions(auth_token)
|
108
109
|
# ap "comparison rule condition :"
|
109
110
|
# ap test_data.as_json
|
110
111
|
test_data.should_not be_nil
|
@@ -113,7 +114,7 @@ describe MachineShop::Rule do
|
|
113
114
|
|
114
115
|
|
115
116
|
it "should get rule by device_id" do
|
116
|
-
test_data = MachineShop::
|
117
|
+
test_data = MachineShop::Rules.get_by_device_instance(auth_token,'52585e1d981800bab2000478')
|
117
118
|
# ap "rule by_device_instance :"
|
118
119
|
# ap test_data.as_json
|
119
120
|
test_data.should_not be_nil
|
@@ -121,7 +122,7 @@ describe MachineShop::Rule do
|
|
121
122
|
end
|
122
123
|
|
123
124
|
it "should get deleted rule" do
|
124
|
-
test_data = MachineShop::
|
125
|
+
test_data = MachineShop::Rules.get_deleted(auth_token)
|
125
126
|
# puts "deleted rule : #{test_data.inspect}"
|
126
127
|
test_data.should_not be_nil
|
127
128
|
|