flowthings 0.1.1 → 0.1.2
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/flowthings/client.rb +5 -5
- data/lib/flowthings/crud/aggregate.rb +4 -4
- data/lib/flowthings/crud/base.rb +13 -13
- data/lib/flowthings/crud/extended_methods.rb +6 -2
- data/lib/flowthings/crud/find.rb +7 -3
- data/lib/flowthings/crud/member_update.rb +9 -6
- data/lib/flowthings/crud/simulate.rb +8 -4
- data/lib/flowthings/platform_objects/platform_object_interface.rb +1 -1
- data/lib/flowthings/request.rb +7 -8
- data/lib/flowthings/utils/crud_utils.rb +1 -1
- data/lib/flowthings/version.rb +1 -1
- data/spec/platform_objects/drop_spec.rb +2 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04e66aab7534d9228bf1544aa872899bc69e3f27
|
4
|
+
data.tar.gz: 36a659f2b378c452339156f8dcc9a03803e18bd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b5e7cb12d9e63ad180491756a2a497787edcc3022291d696abb42994aceb7119bf87dae30828bd6098aea1a01b49ece4690119b647184d9603887fa6ab337b6
|
7
|
+
data.tar.gz: 8d3ed91dfcce1b1aa697725488a28909986043d326ebb464c8cc396c918f6264e0d1aac4f2a6ddf562e9ac50889fff405e2060b05f9ff3f9885557ae0bf1982a
|
data/lib/flowthings/client.rb
CHANGED
@@ -16,10 +16,10 @@ module Flowthings
|
|
16
16
|
|
17
17
|
def initialize(options={})
|
18
18
|
@services = [ApiTask, Drop, Flow, Group, Identity, Mqtt, Share, Token, Track]
|
19
|
-
merged_options = Flowthings.options.merge
|
19
|
+
merged_options = Flowthings.options.merge options
|
20
20
|
|
21
21
|
Configuration::VALID_CONFIG_KEYS.each do |key|
|
22
|
-
send
|
22
|
+
send "#{key}=", merged_options[key]
|
23
23
|
end
|
24
24
|
|
25
25
|
service_factory
|
@@ -29,7 +29,7 @@ module Flowthings
|
|
29
29
|
def get_options
|
30
30
|
opts = {}
|
31
31
|
Configuration::VALID_CONFIG_KEYS.each do |key|
|
32
|
-
opts[key.to_sym] = send
|
32
|
+
opts[key.to_sym] = send "#{key}"
|
33
33
|
end
|
34
34
|
|
35
35
|
opts
|
@@ -42,13 +42,13 @@ module Flowthings
|
|
42
42
|
service_name = service.name.underscore.split("/")[1]
|
43
43
|
|
44
44
|
if service_name == "drop"
|
45
|
-
instance_eval
|
45
|
+
instance_eval <<-EOS
|
46
46
|
def #{service_name}(flowId)
|
47
47
|
#{service}.new flowId, connection, get_options
|
48
48
|
end
|
49
49
|
EOS
|
50
50
|
else
|
51
|
-
instance_eval
|
51
|
+
instance_eval <<-EOS
|
52
52
|
def #{service_name}
|
53
53
|
#{service}.new connection, get_options
|
54
54
|
end
|
@@ -6,11 +6,11 @@ module Flowthings
|
|
6
6
|
include Flowthings::CrudUtils
|
7
7
|
|
8
8
|
def aggregate(data, params={})
|
9
|
-
path = mk_path
|
10
|
-
params = mk_params
|
11
|
-
data = mk_data
|
9
|
+
path = mk_path tail: "aggregate"
|
10
|
+
params = mk_params params
|
11
|
+
data = mk_data data
|
12
12
|
|
13
|
-
platform_post
|
13
|
+
platform_post path, params=params, data=data
|
14
14
|
end
|
15
15
|
|
16
16
|
end
|
data/lib/flowthings/crud/base.rb
CHANGED
@@ -7,32 +7,32 @@ module Flowthings
|
|
7
7
|
|
8
8
|
def create(data, params={})
|
9
9
|
path = mk_path
|
10
|
-
params = mk_params
|
11
|
-
data = mk_data
|
10
|
+
params = mk_params params
|
11
|
+
data = mk_data data
|
12
12
|
|
13
|
-
platform_post
|
13
|
+
platform_post path, params=params, data=data
|
14
14
|
end
|
15
15
|
|
16
16
|
def read(id, params={})
|
17
|
-
path = mk_path
|
18
|
-
params = mk_params
|
17
|
+
path = mk_path id: id
|
18
|
+
params = mk_params params
|
19
19
|
|
20
|
-
platform_get
|
20
|
+
platform_get path, params=params
|
21
21
|
end
|
22
22
|
|
23
23
|
def update(id, data, params={})
|
24
|
-
path = mk_path
|
25
|
-
params = mk_params
|
26
|
-
data = mk_data
|
24
|
+
path = mk_path id: id
|
25
|
+
params = mk_params params
|
26
|
+
data = mk_data data
|
27
27
|
|
28
|
-
platform_put
|
28
|
+
platform_put path, params=params, data=data
|
29
29
|
end
|
30
30
|
|
31
31
|
def destroy(id, params={})
|
32
|
-
path = mk_path
|
33
|
-
params = mk_params
|
32
|
+
path = mk_path id: id
|
33
|
+
params = mk_params params
|
34
34
|
|
35
|
-
platform_delete
|
35
|
+
platform_delete path, params=params
|
36
36
|
end
|
37
37
|
|
38
38
|
alias_method :delete, :destroy
|
@@ -1,12 +1,16 @@
|
|
1
|
+
require 'flowthings/utils/crud_utils'
|
2
|
+
|
1
3
|
module Flowthings
|
2
4
|
module Crud
|
3
5
|
module ExtendedMethods
|
6
|
+
include Flowthings::CrudUtils
|
7
|
+
|
4
8
|
def delete_all(params={})
|
5
9
|
end
|
6
10
|
|
7
11
|
def find_many(filters={}, params={})
|
8
12
|
path = mk_path
|
9
|
-
params = mk_params
|
13
|
+
params = mk_params params
|
10
14
|
data = []
|
11
15
|
|
12
16
|
@flowIds.each do flowId
|
@@ -19,7 +23,7 @@ module Flowthings
|
|
19
23
|
end
|
20
24
|
|
21
25
|
|
22
|
-
platform_mget
|
26
|
+
platform_mget path, params=params, data=data
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
data/lib/flowthings/crud/find.rb
CHANGED
@@ -1,12 +1,16 @@
|
|
1
|
+
require 'flowthings/utils/crud_utils'
|
2
|
+
|
1
3
|
module Flowthings
|
2
4
|
module Crud
|
3
5
|
module Find
|
6
|
+
include Flowthings::CrudUtils
|
7
|
+
|
4
8
|
def find(params={})
|
5
9
|
path_params = {}
|
6
|
-
path = mk_path
|
7
|
-
params = mk_params
|
10
|
+
path = mk_path path_params
|
11
|
+
params = mk_params params
|
8
12
|
|
9
|
-
platform_get
|
13
|
+
platform_get path, params=params
|
10
14
|
end
|
11
15
|
end
|
12
16
|
end
|
@@ -1,13 +1,16 @@
|
|
1
|
+
require 'flowthings/utils/crud_utils'
|
2
|
+
|
1
3
|
module Flowthings
|
2
4
|
module Crud
|
3
5
|
module MemberUpdate
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
include Flowthings::CrudUtils
|
7
|
+
|
8
|
+
def member_update(id, member_name, data, params={})
|
9
|
+
path = mk_path tail: member_name, id: id
|
10
|
+
params = mk_params params
|
11
|
+
data = mk_data data
|
9
12
|
|
10
|
-
platform_put
|
13
|
+
platform_put path, params=params, data=data
|
11
14
|
end
|
12
15
|
end
|
13
16
|
end
|
@@ -1,12 +1,16 @@
|
|
1
|
+
require 'flowthings/utils/crud_utils'
|
2
|
+
|
1
3
|
module Flowthings
|
2
4
|
module Crud
|
3
5
|
module Simulate
|
6
|
+
include Flowthings::CrudUtils
|
7
|
+
|
4
8
|
def simulate(data, params={})
|
5
|
-
path = mk_path
|
6
|
-
params = mk_params
|
7
|
-
data = mk_data
|
9
|
+
path = mk_path tail: "simulate"
|
10
|
+
params = mk_params params
|
11
|
+
data = mk_data data
|
8
12
|
|
9
|
-
platform_post
|
13
|
+
platform_post path, params=params, data=data
|
10
14
|
end
|
11
15
|
end
|
12
16
|
end
|
data/lib/flowthings/request.rb
CHANGED
@@ -11,23 +11,23 @@ module Flowthings
|
|
11
11
|
private
|
12
12
|
|
13
13
|
def platform_get(path, params={}, options={})
|
14
|
-
request
|
14
|
+
request :get, path, params, options
|
15
15
|
end
|
16
16
|
|
17
17
|
def platform_post(path, data, params={}, options={})
|
18
|
-
request
|
18
|
+
request :post, path, params, options, data=data
|
19
19
|
end
|
20
20
|
|
21
21
|
def platform_put(path, data, params={}, options={})
|
22
|
-
request
|
22
|
+
request :put, path, params, options, data=data
|
23
23
|
end
|
24
24
|
|
25
25
|
def platform_mget(path, data, params={}, options={})
|
26
|
-
request
|
26
|
+
request :mget, path, params, options, data=data
|
27
27
|
end
|
28
28
|
|
29
29
|
def platform_delete(path, params={}, options={})
|
30
|
-
request
|
30
|
+
request :delete, path, params, options
|
31
31
|
end
|
32
32
|
|
33
33
|
def request(method, path, params, options, data={})
|
@@ -39,15 +39,14 @@ module Flowthings
|
|
39
39
|
method: method.to_sym)
|
40
40
|
when :post, :put, :mget
|
41
41
|
body = params unless params.empty?
|
42
|
-
body = JSON.generate
|
42
|
+
body = JSON.generate body
|
43
43
|
response = @connection.request(path: path,
|
44
44
|
query: params,
|
45
45
|
method: method.to_sym,
|
46
46
|
body: body)
|
47
47
|
end
|
48
48
|
|
49
|
-
raise_error
|
50
|
-
|
49
|
+
raise_error response
|
51
50
|
|
52
51
|
response = response.data
|
53
52
|
|
data/lib/flowthings/version.rb
CHANGED
@@ -67,11 +67,6 @@ describe Flowthings::Drop do
|
|
67
67
|
}
|
68
68
|
}
|
69
69
|
}
|
70
|
-
|
71
|
-
@aggregation = {
|
72
|
-
"filter": "EXISTS elem_name",
|
73
|
-
"output": ["$count"]
|
74
|
-
}
|
75
70
|
end
|
76
71
|
|
77
72
|
after(:example) do
|
@@ -119,8 +114,8 @@ describe Flowthings::Drop do
|
|
119
114
|
@api.drop(@flowId).create(@drop)
|
120
115
|
|
121
116
|
@aggregation = {
|
122
|
-
"filter"
|
123
|
-
"output"
|
117
|
+
"filter" => "EXISTS elem_name",
|
118
|
+
"output" => ["$count"]
|
124
119
|
}
|
125
120
|
end
|
126
121
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flowthings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Meyer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|