flowthings 0.1.2 → 0.1.3
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/crud/aggregate.rb +1 -1
- data/lib/flowthings/crud/base.rb +2 -2
- data/lib/flowthings/crud/extended_methods.rb +1 -2
- data/lib/flowthings/crud/member_update.rb +1 -1
- data/lib/flowthings/crud/simulate.rb +1 -1
- data/lib/flowthings/request.rb +6 -5
- data/lib/flowthings/version.rb +1 -1
- data/spec/platform_objects/track_spec.rb +36 -0
- 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: df57d7b5ba229d83384f9aee0d7db3f5de4eecc5
|
4
|
+
data.tar.gz: 8155a192a5af95b160a6fb43ad65d913a2a80cb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e0894ba703afc9725c1887f903fbad2ca34a7932eea4820b3ba4306c84c7fbe712c087f4fc446ee496ac89b81d76cd8fa62b3c872f0e2acac3875f953486ba2
|
7
|
+
data.tar.gz: e0dae677e044e14793cb878b0b91d33901bcc80a60a1a6c28b1edd4587b314071029873b38b0a42f079e1e8ab727a45eeb156f16f26d3c0ef2c6f479b58c748a
|
data/lib/flowthings/crud/base.rb
CHANGED
@@ -10,7 +10,7 @@ module Flowthings
|
|
10
10
|
params = mk_params params
|
11
11
|
data = mk_data data
|
12
12
|
|
13
|
-
platform_post path,
|
13
|
+
platform_post path, data=data, params=params
|
14
14
|
end
|
15
15
|
|
16
16
|
def read(id, params={})
|
@@ -25,7 +25,7 @@ module Flowthings
|
|
25
25
|
params = mk_params params
|
26
26
|
data = mk_data data
|
27
27
|
|
28
|
-
platform_put path,
|
28
|
+
platform_put path, data=data, params=params
|
29
29
|
end
|
30
30
|
|
31
31
|
def destroy(id, params={})
|
@@ -4,7 +4,6 @@ module Flowthings
|
|
4
4
|
module Crud
|
5
5
|
module ExtendedMethods
|
6
6
|
include Flowthings::CrudUtils
|
7
|
-
|
8
7
|
def delete_all(params={})
|
9
8
|
end
|
10
9
|
|
@@ -23,7 +22,7 @@ module Flowthings
|
|
23
22
|
end
|
24
23
|
|
25
24
|
|
26
|
-
platform_mget path,
|
25
|
+
platform_mget path, data=data, params=params
|
27
26
|
end
|
28
27
|
end
|
29
28
|
end
|
data/lib/flowthings/request.rb
CHANGED
@@ -15,7 +15,7 @@ module Flowthings
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def platform_post(path, data, params={}, options={})
|
18
|
-
request :post, path, params, options, data=data
|
18
|
+
request :post, path=path, params=params, options=options, data=data
|
19
19
|
end
|
20
20
|
|
21
21
|
def platform_put(path, data, params={}, options={})
|
@@ -30,7 +30,7 @@ module Flowthings
|
|
30
30
|
request :delete, path, params, options
|
31
31
|
end
|
32
32
|
|
33
|
-
def request(method, path, params, options, data={})
|
33
|
+
def request(method, path, params={}, options={}, data={})
|
34
34
|
|
35
35
|
case method.to_sym
|
36
36
|
when :get, :delete
|
@@ -38,15 +38,16 @@ module Flowthings
|
|
38
38
|
query: params,
|
39
39
|
method: method.to_sym)
|
40
40
|
when :post, :put, :mget
|
41
|
-
body =
|
42
|
-
body = JSON.generate
|
41
|
+
body = data unless data.empty?
|
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
|
49
|
+
raise_error(response)
|
50
|
+
|
50
51
|
|
51
52
|
response = response.data
|
52
53
|
|
data/lib/flowthings/version.rb
CHANGED
@@ -11,6 +11,42 @@ describe Flowthings::Track do
|
|
11
11
|
})
|
12
12
|
end
|
13
13
|
|
14
|
+
describe ".create" do
|
15
|
+
before(:example) do
|
16
|
+
@path = "/" + @account_name + "/ruby-client-test"
|
17
|
+
@destination_path = "/" + @account_name + "/ruby-client-test/destination"
|
18
|
+
|
19
|
+
@flow = @api.flow.create "path" => @path, "description" => "description"
|
20
|
+
@destination_flow = @api.flow.create "path" => @destination_path, "description" => "description"
|
21
|
+
|
22
|
+
@flowId = @flow["id"]
|
23
|
+
@flowId_destination = @destination_flow["id"]
|
24
|
+
|
25
|
+
@track = {
|
26
|
+
"source" => @path,
|
27
|
+
"destination" => @destination_path,
|
28
|
+
"js" => "function (input_drop) {
|
29
|
+
var a = input_drop.elems.a.value;
|
30
|
+
input_drop.elems.b = a * 3;
|
31
|
+
return input_drop;
|
32
|
+
}"
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should create a track properly" do
|
37
|
+
@track_response = @api.track.create @track
|
38
|
+
|
39
|
+
expect(@track_response["js"]).not_to be_empty
|
40
|
+
expect(@track_response["source"]).to eq @path
|
41
|
+
expect(@track_response["destination"]).to eq @destination_path
|
42
|
+
end
|
43
|
+
|
44
|
+
after(:example) do
|
45
|
+
@api.flow.delete @flowId
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
14
50
|
describe ".simulate" do
|
15
51
|
it "should simulate track output" do
|
16
52
|
|