machineshop 1.0.2 → 1.1.1
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/.gitignore +45 -0
- data/{Gemfile → machineshop/Gemfile} +0 -0
- data/{LICENSE → machineshop/LICENSE} +0 -0
- data/{Rakefile → machineshop/Rakefile} +0 -0
- data/{doc.txt → machineshop/doc.txt} +0 -0
- data/{lib → machineshop/lib}/machineshop.rb +29 -18
- data/{lib → machineshop/lib}/machineshop/api_operations/create.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/api_operations/delete.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/api_operations/list.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/api_operations/update.rb +0 -0
- data/machineshop/lib/machineshop/api_proxies.rb +20 -0
- data/{lib → machineshop/lib}/machineshop/api_resource.rb +1 -1
- data/{lib → machineshop/lib}/machineshop/configuration.rb +2 -1
- data/machineshop/lib/machineshop/custom_api.rb +28 -0
- data/machineshop/lib/machineshop/custom_apis.rb +21 -0
- data/{lib → machineshop/lib}/machineshop/customer.rb +1 -1
- data/machineshop/lib/machineshop/customers.rb +20 -0
- data/{lib → machineshop/lib}/machineshop/data_source_types.rb +12 -2
- data/machineshop/lib/machineshop/data_sources.rb +57 -0
- data/{lib → machineshop/lib}/machineshop/database.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/device.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/device_instance.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/end_points.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/errors/api_connection_error.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/errors/api_error.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/errors/authentication_error.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/errors/database_error.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/errors/invalid_request_error.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/errors/machineshop_error.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/errors/schema_error.rb +0 -0
- data/machineshop/lib/machineshop/gateway_configs.rb +34 -0
- data/machineshop/lib/machineshop/gateway_data_source_types.rb +18 -0
- data/machineshop/lib/machineshop/gateway_data_sources.rb +60 -0
- data/{lib → machineshop/lib}/machineshop/json.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/machineshop_cache.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/machineshop_object.rb +7 -2
- data/{lib → machineshop/lib}/machineshop/mapping.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/meter.rb +1 -2
- data/{lib → machineshop/lib}/machineshop/models/api_endpoint.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/models/api_request.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/models/schema.rb +2 -1
- data/machineshop/lib/machineshop/monitor.rb +39 -0
- data/machineshop/lib/machineshop/report.rb +11 -0
- data/{lib/machineshop/report.rb → machineshop/lib/machineshop/reports.rb} +3 -1
- data/machineshop/lib/machineshop/routes.rb +29 -0
- data/{lib → machineshop/lib}/machineshop/rule.rb +0 -0
- data/machineshop/lib/machineshop/rules.rb +56 -0
- data/{lib → machineshop/lib}/machineshop/user.rb +22 -4
- data/machineshop/lib/machineshop/users.rb +81 -0
- data/{lib → machineshop/lib}/machineshop/util.rb +22 -11
- data/{lib → machineshop/lib}/machineshop/utility.rb +0 -0
- data/{lib → machineshop/lib}/machineshop/version.rb +1 -1
- data/{machineshop.gemspec → machineshop/machineshop.gemspec} +2 -1
- data/{spec → machineshop/spec}/lib/api_calls_spec.rb +0 -0
- data/machineshop/spec/lib/api_proxies_spec.rb +91 -0
- data/machineshop/spec/lib/custom_api_spec.rb +0 -0
- data/machineshop/spec/lib/custom_api_vo_spec.rb +77 -0
- data/{spec → machineshop/spec}/lib/custom_endpoint_test.rb +0 -0
- data/{spec → machineshop/spec}/lib/customer_spec.rb +21 -8
- data/{spec → machineshop/spec}/lib/data_source.rb +0 -0
- data/{spec → machineshop/spec}/lib/data_source_type_spec.rb +0 -0
- data/{spec → machineshop/spec}/lib/database_spec.rb +0 -0
- data/{spec → machineshop/spec}/lib/device_instances.rb +0 -0
- data/{spec → machineshop/spec}/lib/device_spec.rb +0 -0
- data/{spec → machineshop/spec}/lib/endpoint_spec.rb +0 -0
- data/{spec → machineshop/spec}/lib/geocode_spec +0 -0
- data/machineshop/spec/lib/logo_spec.rb +51 -0
- data/{spec → machineshop/spec}/lib/mapping_spec.rb +0 -0
- data/{spec → machineshop/spec}/lib/meter_spec.rb +3 -3
- data/machineshop/spec/lib/monitor_spec.rb +50 -0
- data/machineshop/spec/lib/new_api_key.rb +28 -0
- data/machineshop/spec/lib/report_spec.rb +91 -0
- data/machineshop/spec/lib/reports_v1_spec.rb +65 -0
- data/machineshop/spec/lib/routes_spec.rb +26 -0
- data/{spec → machineshop/spec}/lib/rule_spec.rb +30 -24
- data/machineshop/spec/lib/user_spec.rb +99 -0
- data/machineshop/spec/lib/v1_rules_spec.rb +106 -0
- data/{spec → machineshop/spec}/spec_helper.rb +0 -0
- metadata +115 -110
- data/.idea/.name +0 -1
- data/.idea/.rakeTasks +0 -7
- data/.idea/compiler.xml +0 -23
- data/.idea/copyright/profiles_settings.xml +0 -5
- data/.idea/encodings.xml +0 -5
- data/.idea/inspectionProfiles/Project_Default.xml +0 -7
- data/.idea/inspectionProfiles/profiles_settings.xml +0 -7
- data/.idea/machineshop.iml +0 -194
- data/.idea/misc.xml +0 -5
- data/.idea/modules.xml +0 -9
- data/.idea/scopes/scope_settings.xml +0 -5
- data/.idea/vcs.xml +0 -7
- data/.idea/workspace.xml +0 -722
- data/lib/machineshop/data_sources.rb +0 -35
- data/lib/machineshop/users.rb +0 -43
- data/spec/lib/report_spec.rb +0 -52
- data/spec/lib/user_spec.rb +0 -58
@@ -0,0 +1,65 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
#MachineShop.api_base_url= 'http://machineshop.dev:3000/api/v0'
|
4
|
+
# MachineShop.api_base_url= 'http://stage.services.machineshop.io/api/v0'
|
5
|
+
MachineShop.api_base_url= 'http://localhost:3000/api/v1'
|
6
|
+
|
7
|
+
#publisher_username = 'publisher@machineshop.com'
|
8
|
+
publisher_username = 'publisher@csr.com'
|
9
|
+
publisher_password = 'password'
|
10
|
+
|
11
|
+
|
12
|
+
auth_token, user = MachineShop::Users.authenticate(
|
13
|
+
:email => publisher_username,
|
14
|
+
:password => publisher_password
|
15
|
+
)
|
16
|
+
|
17
|
+
reports=nil
|
18
|
+
|
19
|
+
describe MachineShop::Reports do
|
20
|
+
|
21
|
+
|
22
|
+
# it "should create report" do
|
23
|
+
|
24
|
+
# report_json = {
|
25
|
+
# :data_source_id=>"asdfds",
|
26
|
+
# :device_datetime=> "2014-8-24 15:22:27",
|
27
|
+
# :raw_data=> "video on",
|
28
|
+
# :payload=> {
|
29
|
+
# :video=> "1",
|
30
|
+
# :test_new=> "Demo test 10"
|
31
|
+
# }
|
32
|
+
|
33
|
+
# }
|
34
|
+
|
35
|
+
# ret = MachineShop::Reports.create(report_json, auth_token)
|
36
|
+
# ap ret
|
37
|
+
|
38
|
+
# end
|
39
|
+
|
40
|
+
it "should get all report data" do
|
41
|
+
element_data = MachineShop::Reports.all({}, auth_token)
|
42
|
+
reports=element_data
|
43
|
+
puts "element_data: #{element_data}"
|
44
|
+
|
45
|
+
element_data.should_not be_nil
|
46
|
+
element_data.should_not be_empty
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
it "should get report of specific device" do
|
52
|
+
element_data = MachineShop::Reports.all(
|
53
|
+
({
|
54
|
+
:data_source_id => '543e1437faf3d9695900001d',
|
55
|
+
# :per_page=>'1000',
|
56
|
+
# :created_at_between=>'2013-11-04T00:00:00_2014-03-19T17:02:00'
|
57
|
+
}), auth_token)
|
58
|
+
|
59
|
+
puts "element data of 543e1437faf3d9695900001d #{element_data} "
|
60
|
+
|
61
|
+
element_data.should_not be_nil
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
|
4
|
+
#MachineShop.api_base_url= 'http://machineshop.dev:3000/api/v0'
|
5
|
+
MachineShop.api_base_url= 'localhost:3000/api/v1'
|
6
|
+
|
7
|
+
#publisher_username = 'publisher@machineshop.com'
|
8
|
+
publisher_username = 'publisher@csr.com'
|
9
|
+
publisher_password = 'password'
|
10
|
+
|
11
|
+
|
12
|
+
auth_token, user = MachineShop::Users.authenticate(
|
13
|
+
:email => publisher_username,
|
14
|
+
:password => publisher_password
|
15
|
+
)
|
16
|
+
describe MachineShop::Routes do
|
17
|
+
|
18
|
+
it "should get all the CustomApis " do
|
19
|
+
routes = MachineShop::Routes.all({}, auth_token)
|
20
|
+
|
21
|
+
ap "Listing routes"
|
22
|
+
|
23
|
+
ap routes
|
24
|
+
routes.should_not be_nil
|
25
|
+
end
|
26
|
+
end
|
@@ -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|
|
@@ -12,22 +13,23 @@ MachineShop.configure do |config|
|
|
12
13
|
config.db_username="root"
|
13
14
|
config.db_password="root"
|
14
15
|
config.db_host= "localhost"
|
16
|
+
# config.enable_caching=true
|
15
17
|
config.expiry_time= lambda{10.seconds.ago}
|
16
18
|
#second
|
17
19
|
end
|
18
20
|
|
19
|
-
auth_token, user = MachineShop::
|
21
|
+
auth_token, user = MachineShop::Users.authenticate(
|
20
22
|
:email => publisher_username,
|
21
23
|
:password => publisher_password
|
22
24
|
)
|
23
25
|
|
24
26
|
|
25
|
-
describe MachineShop::
|
27
|
+
describe MachineShop::Rules do
|
26
28
|
|
27
29
|
rules=nil
|
28
30
|
|
29
31
|
it "should get all the rules " do
|
30
|
-
rules = MachineShop::
|
32
|
+
rules = MachineShop::Rules.all({},auth_token)
|
31
33
|
# puts "rules haru : #{rules}"
|
32
34
|
# ap "getting rules"
|
33
35
|
# ap rules.as_json
|
@@ -37,17 +39,24 @@ describe MachineShop::Rule do
|
|
37
39
|
end
|
38
40
|
|
39
41
|
|
42
|
+
it "should delete rule" do
|
43
|
+
del = MachineShop::Rules.delete_rule("54228a1afaf3d9bc38000009",auth_token)
|
44
|
+
ap del
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
|
40
49
|
|
41
50
|
|
42
51
|
it "should create rule" do
|
43
52
|
|
44
53
|
|
45
54
|
create_hash = {
|
46
|
-
:
|
47
|
-
:
|
55
|
+
:data_source_types=>["5410421afaf3d9a52b000030"],
|
56
|
+
:data_sources=>["5417d6effaf3d9e6b6000002","5416b294faf3d9ae140000ae"],
|
48
57
|
:rule=>{
|
49
58
|
:active=>true,
|
50
|
-
:description=>"
|
59
|
+
:description=>"bajratest_from_gem",
|
51
60
|
:condition=>{
|
52
61
|
:type=>"and_rule_condition",
|
53
62
|
:rule_conditions=>[{
|
@@ -67,7 +76,7 @@ describe MachineShop::Rule do
|
|
67
76
|
}
|
68
77
|
|
69
78
|
# ap "creating rule "
|
70
|
-
createdRule = MachineShop::
|
79
|
+
createdRule = MachineShop::Rules.create(create_hash,auth_token)
|
71
80
|
|
72
81
|
# ap createdRule.as_json
|
73
82
|
|
@@ -78,25 +87,22 @@ describe MachineShop::Rule do
|
|
78
87
|
specificRule = nil
|
79
88
|
|
80
89
|
it "should get rule by id" do
|
81
|
-
# ruleById = MachineShop::
|
82
|
-
specificRule = MachineShop::
|
90
|
+
# ruleById = MachineShop::Rules.retrieve(rules[0].id,auth_token)
|
91
|
+
specificRule = MachineShop::Rules.retrieve("5427e0e1faf3d9a1ee000008",auth_token)
|
83
92
|
# ap "retrieved rule"
|
84
93
|
# ap specificRule.as_json
|
85
94
|
specificRule.should_not be_nil
|
86
95
|
|
87
96
|
end
|
88
97
|
|
89
|
-
it "should delete rule by" do
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
delete.should_not be_nil
|
95
|
-
|
96
|
-
end
|
98
|
+
# it "should delete rule by" do
|
99
|
+
# delete = specificRule.delete
|
100
|
+
# # ap delete.as_json
|
101
|
+
# delete.should_not be_nil
|
102
|
+
# end
|
97
103
|
|
98
104
|
it "should get get join rule conditions" do
|
99
|
-
test_data = MachineShop::
|
105
|
+
test_data = MachineShop::Rules.get_join_rule_conditions(auth_token)
|
100
106
|
# puts "rule comparison : #{test_data.inspect}"
|
101
107
|
test_data.should_not be_nil
|
102
108
|
|
@@ -104,7 +110,7 @@ describe MachineShop::Rule do
|
|
104
110
|
|
105
111
|
|
106
112
|
it "should get comparison rule_conditions" do
|
107
|
-
test_data = MachineShop::
|
113
|
+
test_data = MachineShop::Rules.get_comparison_rule_conditions(auth_token)
|
108
114
|
# ap "comparison rule condition :"
|
109
115
|
# ap test_data.as_json
|
110
116
|
test_data.should_not be_nil
|
@@ -112,8 +118,8 @@ describe MachineShop::Rule do
|
|
112
118
|
end
|
113
119
|
|
114
120
|
|
115
|
-
it "should get rule by
|
116
|
-
test_data = MachineShop::
|
121
|
+
it "should get rule by data_source" do
|
122
|
+
test_data = MachineShop::Rules.get_by_data_source(auth_token,'5417d6effaf3d9e6b6000002')
|
117
123
|
# ap "rule by_device_instance :"
|
118
124
|
# ap test_data.as_json
|
119
125
|
test_data.should_not be_nil
|
@@ -121,7 +127,7 @@ describe MachineShop::Rule do
|
|
121
127
|
end
|
122
128
|
|
123
129
|
it "should get deleted rule" do
|
124
|
-
test_data = MachineShop::
|
130
|
+
test_data = MachineShop::Rules.get_deleted(auth_token)
|
125
131
|
# puts "deleted rule : #{test_data.inspect}"
|
126
132
|
test_data.should_not be_nil
|
127
133
|
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
|
4
|
+
#MachineShop.api_base_url= 'http://machineshop.dev:3000/api/v0'
|
5
|
+
# MachineShop.api_base_url= 'http://stage.services.machineshop.io/api/v0'
|
6
|
+
MachineShop.api_base_url= 'localhost:3000/api/v1'
|
7
|
+
|
8
|
+
#publisher_username = 'publisher@machineshop.com'
|
9
|
+
publisher_username = 'publisher@csr.com'
|
10
|
+
publisher_password = 'password'
|
11
|
+
|
12
|
+
describe MachineShop::Users do
|
13
|
+
auth_token = nil
|
14
|
+
user = nil
|
15
|
+
|
16
|
+
it "should allow a user to authenticate" do
|
17
|
+
auth_token.should be_nil
|
18
|
+
|
19
|
+
begin
|
20
|
+
|
21
|
+
auth_token, user = MachineShop::Users.authenticate(
|
22
|
+
:email => publisher_username,
|
23
|
+
:password => publisher_password
|
24
|
+
)
|
25
|
+
|
26
|
+
rescue Exception => e
|
27
|
+
ap "exception ------------"
|
28
|
+
# ap e.message
|
29
|
+
# ap e.http_status
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
ap "User Data"
|
34
|
+
# ap user.as_json
|
35
|
+
auth_token.should_not be_nil
|
36
|
+
user.should_not be_nil
|
37
|
+
# user.should be_kind_of MachineShop::Users
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should send instruction to reset password " do
|
41
|
+
begin
|
42
|
+
|
43
|
+
reset = MachineShop::Users.password_reset({email: "niroj@bajratechnologies.com", domain: "machineshop", send_email: true})
|
44
|
+
ap reset
|
45
|
+
rescue Exception => e
|
46
|
+
puts e
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should reset the password" do
|
51
|
+
begin
|
52
|
+
|
53
|
+
reset_complete = MachineShop::Users.password_reset_complete("5KexNcXpygS94T9wFF6a",{password: "new_password", password_confirmation: "new_password"})
|
54
|
+
ap reset_complete
|
55
|
+
rescue Exception => e
|
56
|
+
puts e
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
# tmpfile = "abc.png"
|
62
|
+
|
63
|
+
# logo = File.open(tmpfile, "r")
|
64
|
+
|
65
|
+
# it "should create logo" do
|
66
|
+
# logo = MachineShop::Users.create_user_logo(user.id,{logo: logo}, auth_token)
|
67
|
+
# end
|
68
|
+
|
69
|
+
|
70
|
+
it "should get all roles from a static instance" do
|
71
|
+
element_data = MachineShop::Users.all_roles(auth_token)
|
72
|
+
|
73
|
+
ap "all_roles: "
|
74
|
+
# ap element_data.as_json
|
75
|
+
puts element_data
|
76
|
+
|
77
|
+
element_data.should_not be_nil
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should get all roles from a user instance" do
|
81
|
+
|
82
|
+
ap " here user is : "
|
83
|
+
# ap user.as_json
|
84
|
+
element_data = user.all_roles
|
85
|
+
element_data.should_not be_nil
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should get a user for the user by id" do
|
89
|
+
element_data = MachineShop::Users.retrieve(user.id, auth_token)
|
90
|
+
|
91
|
+
ap "user retrieve"
|
92
|
+
# ap element_data.as_json
|
93
|
+
|
94
|
+
element_data.should_not be_nil
|
95
|
+
element_data.should be_kind_of MachineShop::Users
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
#MachineShop.api_base_url= 'http://machineshop.dev:3000/api/v0'
|
4
|
+
# MachineShop.api_base_url= 'http://stage.services.machineshop.io/api/v0'
|
5
|
+
MachineShop.api_base_url= 'localhost:3000/api/v1'
|
6
|
+
|
7
|
+
#publisher_username = 'publisher@machineshop.com'
|
8
|
+
publisher_username = 'publisher@csr.com'
|
9
|
+
publisher_password = 'password'
|
10
|
+
|
11
|
+
MachineShop.configure do |config|
|
12
|
+
config.db_name = "machineshop"
|
13
|
+
config.db_username="root"
|
14
|
+
config.db_password="root"
|
15
|
+
config.db_host= "localhost"
|
16
|
+
config.expiry_time= lambda{10.seconds.ago}
|
17
|
+
#second
|
18
|
+
end
|
19
|
+
|
20
|
+
auth_token, user = MachineShop::Users.authenticate(
|
21
|
+
:email => publisher_username,
|
22
|
+
:password => publisher_password
|
23
|
+
)
|
24
|
+
|
25
|
+
|
26
|
+
describe MachineShop::Rules do
|
27
|
+
|
28
|
+
rules=nil
|
29
|
+
|
30
|
+
it "should get all the rules " do
|
31
|
+
# rules = MachineShop::Rules.all({},auth_token)
|
32
|
+
# puts "rules haru : #{rules}"
|
33
|
+
# ap "getting rules"
|
34
|
+
# ap rules.as_json
|
35
|
+
rules.should_not be_nil
|
36
|
+
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
it "should create rule" do
|
44
|
+
|
45
|
+
create_hash = {
|
46
|
+
:data_source_types=>["52585e1d981800bab2000479"],
|
47
|
+
:data_sources=>["5417d6effaf3d9e6b6000002","5416b294faf3d9ae140000ae"],
|
48
|
+
:rule=>{
|
49
|
+
:active=>true,
|
50
|
+
:description=>"bajratest",
|
51
|
+
:condition=>{
|
52
|
+
:type=>"and_rule_condition",
|
53
|
+
:rule_conditions=>[{
|
54
|
+
|
55
|
+
:property=>"var",
|
56
|
+
:value=>"30",
|
57
|
+
:type=>"equal_rule_condition"
|
58
|
+
|
59
|
+
}]
|
60
|
+
},
|
61
|
+
:then_actions=>[{
|
62
|
+
:priority=>"1",
|
63
|
+
:send_to=>"abc@me.com",
|
64
|
+
:type=>"email_rule_action"
|
65
|
+
}]
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
# ap "creating rule "
|
70
|
+
# createdRule = MachineShop::Rules.create(create_hash,auth_token)
|
71
|
+
|
72
|
+
# ap "createdRule"
|
73
|
+
# ap createdRule
|
74
|
+
|
75
|
+
# ap createdRule.as_json
|
76
|
+
|
77
|
+
# createdRule.should_not be_nil
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should edit rule " do
|
82
|
+
|
83
|
+
edit_rule_json = {
|
84
|
+
:rule=>{
|
85
|
+
:description=>"ahah from gem",
|
86
|
+
:then_actions=>[{
|
87
|
+
:priority=>"2",
|
88
|
+
:send_to=>"hellothereabc@me.com",
|
89
|
+
:type=>"email_rule_action"
|
90
|
+
}]
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
updated = MachineShop::Rules.update("54228a1afaf3d9bc38000009",auth_token,edit_rule_json)
|
95
|
+
ap "updated rule response"
|
96
|
+
ap updated
|
97
|
+
|
98
|
+
# MachineShop::Rules.update(create_hash,auth_token)
|
99
|
+
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
specificRule = nil
|
104
|
+
|
105
|
+
|
106
|
+
end
|
File without changes
|
metadata
CHANGED
@@ -1,119 +1,119 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: machineshop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- machineshop
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mysql
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: addressable
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rest-client
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: multi_json
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 1.0.4
|
90
|
-
- - <
|
90
|
+
- - "<"
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '2'
|
93
93
|
type: :runtime
|
94
94
|
prerelease: false
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
-
- -
|
97
|
+
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: 1.0.4
|
100
|
-
- - <
|
100
|
+
- - "<"
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '2'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: activerecord
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: 3.2.12
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- -
|
114
|
+
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
116
|
+
version: 3.2.12
|
117
117
|
description: Wraps the machineshop API.
|
118
118
|
email:
|
119
119
|
- john@mach19.com
|
@@ -121,77 +121,98 @@ executables: []
|
|
121
121
|
extensions: []
|
122
122
|
extra_rdoc_files: []
|
123
123
|
files:
|
124
|
-
- .
|
125
|
-
- .idea/.rakeTasks
|
126
|
-
- .idea/compiler.xml
|
127
|
-
- .idea/copyright/profiles_settings.xml
|
128
|
-
- .idea/encodings.xml
|
129
|
-
- .idea/inspectionProfiles/Project_Default.xml
|
130
|
-
- .idea/inspectionProfiles/profiles_settings.xml
|
131
|
-
- .idea/machineshop.iml
|
132
|
-
- .idea/misc.xml
|
133
|
-
- .idea/modules.xml
|
134
|
-
- .idea/scopes/scope_settings.xml
|
135
|
-
- .idea/vcs.xml
|
136
|
-
- .idea/workspace.xml
|
137
|
-
- Gemfile
|
138
|
-
- LICENSE
|
124
|
+
- ".gitignore"
|
139
125
|
- README.md
|
140
|
-
-
|
141
|
-
-
|
142
|
-
-
|
143
|
-
-
|
144
|
-
-
|
145
|
-
-
|
146
|
-
-
|
147
|
-
-
|
148
|
-
-
|
149
|
-
-
|
150
|
-
-
|
151
|
-
-
|
152
|
-
-
|
153
|
-
-
|
154
|
-
-
|
155
|
-
-
|
156
|
-
-
|
157
|
-
- lib/machineshop
|
158
|
-
- lib/machineshop/
|
159
|
-
- lib/machineshop/
|
160
|
-
- lib/machineshop/
|
161
|
-
- lib/machineshop/
|
162
|
-
- lib/machineshop/
|
163
|
-
- lib/machineshop/
|
164
|
-
- lib/machineshop/
|
165
|
-
- lib/machineshop/
|
166
|
-
- lib/machineshop/
|
167
|
-
- lib/machineshop/
|
168
|
-
- lib/machineshop/
|
169
|
-
- lib/machineshop/
|
170
|
-
- lib/machineshop/
|
171
|
-
- lib/machineshop/
|
172
|
-
- lib/machineshop/
|
173
|
-
- lib/machineshop/
|
174
|
-
- lib/machineshop/
|
175
|
-
- lib/machineshop/
|
176
|
-
- lib/machineshop/
|
177
|
-
- lib/machineshop/
|
178
|
-
- machineshop.
|
179
|
-
-
|
180
|
-
-
|
181
|
-
-
|
182
|
-
-
|
183
|
-
-
|
184
|
-
-
|
185
|
-
-
|
186
|
-
-
|
187
|
-
-
|
188
|
-
-
|
189
|
-
-
|
190
|
-
-
|
191
|
-
-
|
192
|
-
-
|
193
|
-
-
|
194
|
-
-
|
126
|
+
- machineshop/.idea/.name
|
127
|
+
- machineshop/.idea/.rakeTasks
|
128
|
+
- machineshop/.idea/compiler.xml
|
129
|
+
- machineshop/.idea/copyright/profiles_settings.xml
|
130
|
+
- machineshop/.idea/encodings.xml
|
131
|
+
- machineshop/.idea/inspectionProfiles/Project_Default.xml
|
132
|
+
- machineshop/.idea/inspectionProfiles/profiles_settings.xml
|
133
|
+
- machineshop/.idea/machineshop.iml
|
134
|
+
- machineshop/.idea/misc.xml
|
135
|
+
- machineshop/.idea/modules.xml
|
136
|
+
- machineshop/.idea/scopes/scope_settings.xml
|
137
|
+
- machineshop/.idea/vcs.xml
|
138
|
+
- machineshop/.idea/workspace.xml
|
139
|
+
- machineshop/Gemfile
|
140
|
+
- machineshop/LICENSE
|
141
|
+
- machineshop/Rakefile
|
142
|
+
- machineshop/doc.txt
|
143
|
+
- machineshop/lib/machineshop.rb
|
144
|
+
- machineshop/lib/machineshop/api_operations/create.rb
|
145
|
+
- machineshop/lib/machineshop/api_operations/delete.rb
|
146
|
+
- machineshop/lib/machineshop/api_operations/list.rb
|
147
|
+
- machineshop/lib/machineshop/api_operations/update.rb
|
148
|
+
- machineshop/lib/machineshop/api_proxies.rb
|
149
|
+
- machineshop/lib/machineshop/api_resource.rb
|
150
|
+
- machineshop/lib/machineshop/configuration.rb
|
151
|
+
- machineshop/lib/machineshop/custom_api.rb
|
152
|
+
- machineshop/lib/machineshop/custom_apis.rb
|
153
|
+
- machineshop/lib/machineshop/customer.rb
|
154
|
+
- machineshop/lib/machineshop/customers.rb
|
155
|
+
- machineshop/lib/machineshop/data_source_types.rb
|
156
|
+
- machineshop/lib/machineshop/data_sources.rb
|
157
|
+
- machineshop/lib/machineshop/database.rb
|
158
|
+
- machineshop/lib/machineshop/device.rb
|
159
|
+
- machineshop/lib/machineshop/device_instance.rb
|
160
|
+
- machineshop/lib/machineshop/end_points.rb
|
161
|
+
- machineshop/lib/machineshop/errors/api_connection_error.rb
|
162
|
+
- machineshop/lib/machineshop/errors/api_error.rb
|
163
|
+
- machineshop/lib/machineshop/errors/authentication_error.rb
|
164
|
+
- machineshop/lib/machineshop/errors/database_error.rb
|
165
|
+
- machineshop/lib/machineshop/errors/invalid_request_error.rb
|
166
|
+
- machineshop/lib/machineshop/errors/machineshop_error.rb
|
167
|
+
- machineshop/lib/machineshop/errors/schema_error.rb
|
168
|
+
- machineshop/lib/machineshop/gateway_configs.rb
|
169
|
+
- machineshop/lib/machineshop/gateway_data_source_types.rb
|
170
|
+
- machineshop/lib/machineshop/gateway_data_sources.rb
|
171
|
+
- machineshop/lib/machineshop/json.rb
|
172
|
+
- machineshop/lib/machineshop/machineshop_cache.rb
|
173
|
+
- machineshop/lib/machineshop/machineshop_object.rb
|
174
|
+
- machineshop/lib/machineshop/mapping.rb
|
175
|
+
- machineshop/lib/machineshop/meter.rb
|
176
|
+
- machineshop/lib/machineshop/models/api_endpoint.rb
|
177
|
+
- machineshop/lib/machineshop/models/api_request.rb
|
178
|
+
- machineshop/lib/machineshop/models/schema.rb
|
179
|
+
- machineshop/lib/machineshop/monitor.rb
|
180
|
+
- machineshop/lib/machineshop/report.rb
|
181
|
+
- machineshop/lib/machineshop/reports.rb
|
182
|
+
- machineshop/lib/machineshop/routes.rb
|
183
|
+
- machineshop/lib/machineshop/rule.rb
|
184
|
+
- machineshop/lib/machineshop/rules.rb
|
185
|
+
- machineshop/lib/machineshop/user.rb
|
186
|
+
- machineshop/lib/machineshop/users.rb
|
187
|
+
- machineshop/lib/machineshop/util.rb
|
188
|
+
- machineshop/lib/machineshop/utility.rb
|
189
|
+
- machineshop/lib/machineshop/version.rb
|
190
|
+
- machineshop/machineshop.gemspec
|
191
|
+
- machineshop/spec/lib/api_calls_spec.rb
|
192
|
+
- machineshop/spec/lib/api_proxies_spec.rb
|
193
|
+
- machineshop/spec/lib/custom_api_spec.rb
|
194
|
+
- machineshop/spec/lib/custom_api_vo_spec.rb
|
195
|
+
- machineshop/spec/lib/custom_endpoint_test.rb
|
196
|
+
- machineshop/spec/lib/customer_spec.rb
|
197
|
+
- machineshop/spec/lib/data_source.rb
|
198
|
+
- machineshop/spec/lib/data_source_type_spec.rb
|
199
|
+
- machineshop/spec/lib/database_spec.rb
|
200
|
+
- machineshop/spec/lib/device_instances.rb
|
201
|
+
- machineshop/spec/lib/device_spec.rb
|
202
|
+
- machineshop/spec/lib/endpoint_spec.rb
|
203
|
+
- machineshop/spec/lib/geocode_spec
|
204
|
+
- machineshop/spec/lib/logo_spec.rb
|
205
|
+
- machineshop/spec/lib/mapping_spec.rb
|
206
|
+
- machineshop/spec/lib/meter_spec.rb
|
207
|
+
- machineshop/spec/lib/monitor_spec.rb
|
208
|
+
- machineshop/spec/lib/new_api_key.rb
|
209
|
+
- machineshop/spec/lib/report_spec.rb
|
210
|
+
- machineshop/spec/lib/reports_v1_spec.rb
|
211
|
+
- machineshop/spec/lib/routes_spec.rb
|
212
|
+
- machineshop/spec/lib/rule_spec.rb
|
213
|
+
- machineshop/spec/lib/user_spec.rb
|
214
|
+
- machineshop/spec/lib/v1_rules_spec.rb
|
215
|
+
- machineshop/spec/spec_helper.rb
|
195
216
|
homepage: ''
|
196
217
|
licenses: []
|
197
218
|
metadata: {}
|
@@ -201,35 +222,19 @@ require_paths:
|
|
201
222
|
- lib
|
202
223
|
required_ruby_version: !ruby/object:Gem::Requirement
|
203
224
|
requirements:
|
204
|
-
- -
|
225
|
+
- - ">="
|
205
226
|
- !ruby/object:Gem::Version
|
206
227
|
version: 1.9.3
|
207
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
229
|
requirements:
|
209
|
-
- -
|
230
|
+
- - ">="
|
210
231
|
- !ruby/object:Gem::Version
|
211
232
|
version: '0'
|
212
233
|
requirements:
|
213
234
|
- mysql, activerecord
|
214
235
|
rubyforge_project:
|
215
|
-
rubygems_version: 2.
|
236
|
+
rubygems_version: 2.5.1
|
216
237
|
signing_key:
|
217
238
|
specification_version: 4
|
218
239
|
summary: A convenient way to call into the machineshop API.
|
219
|
-
test_files:
|
220
|
-
- spec/lib/api_calls_spec.rb
|
221
|
-
- spec/lib/custom_endpoint_test.rb
|
222
|
-
- spec/lib/customer_spec.rb
|
223
|
-
- spec/lib/data_source.rb
|
224
|
-
- spec/lib/data_source_type_spec.rb
|
225
|
-
- spec/lib/database_spec.rb
|
226
|
-
- spec/lib/device_instances.rb
|
227
|
-
- spec/lib/device_spec.rb
|
228
|
-
- spec/lib/endpoint_spec.rb
|
229
|
-
- spec/lib/geocode_spec
|
230
|
-
- spec/lib/mapping_spec.rb
|
231
|
-
- spec/lib/meter_spec.rb
|
232
|
-
- spec/lib/report_spec.rb
|
233
|
-
- spec/lib/rule_spec.rb
|
234
|
-
- spec/lib/user_spec.rb
|
235
|
-
- spec/spec_helper.rb
|
240
|
+
test_files: []
|