koko-ai-ruby 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +5 -0
- data/lib/koko/tracker/client.rb +6 -6
- data/lib/koko/tracker/version.rb +1 -1
- data/spec/koko/tracking/client_spec.rb +5 -5
- data/spec/spec_helper.rb +1 -1
- 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: bbab8eb849d6a88baf77197a3626975c3376238d
|
4
|
+
data.tar.gz: 87c099458959d5efe6f655b7a1cd622ca2d6fbc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb14079af0a2669d54eab7e731b0f52ed664f37f02dfde0e440d4fc9599126eddc13c487a3eb419fa7717d1447af93539b2e30c3b6c000d22de730982f4ede4d
|
7
|
+
data.tar.gz: 3d9196f33b107d62d89e4806be3da1ea70fc08902483d2020cbc9098d33cd8202bbdc9797579fc4a9c2b463cb31e3ab7a60899efd0623c503b9a5f2102bc6b73
|
data/History.md
CHANGED
data/lib/koko/tracker/client.rb
CHANGED
@@ -28,9 +28,9 @@ module Koko
|
|
28
28
|
def track_content attrs, &block
|
29
29
|
symbolize_keys! attrs
|
30
30
|
|
31
|
-
timestamp = attrs[:created_at] || Time.
|
31
|
+
timestamp = attrs[:created_at] || Time.now
|
32
32
|
check_timestamp! timestamp
|
33
|
-
attrs[:created_at] = timestamp
|
33
|
+
attrs[:created_at] = timestamp
|
34
34
|
|
35
35
|
response = handle_response(Request.new(path: '/track/content').post(@auth, attrs))
|
36
36
|
|
@@ -47,9 +47,9 @@ module Koko
|
|
47
47
|
def track_flag attrs
|
48
48
|
symbolize_keys! attrs
|
49
49
|
|
50
|
-
timestamp = attrs[:created_at] || Time.
|
50
|
+
timestamp = attrs[:created_at] || Time.now
|
51
51
|
check_timestamp! timestamp
|
52
|
-
attrs[:created_at] = timestamp
|
52
|
+
attrs[:created_at] = timestamp
|
53
53
|
|
54
54
|
handle_response(Request.new(path: '/track/flag').post(@auth, attrs))
|
55
55
|
|
@@ -62,9 +62,9 @@ module Koko
|
|
62
62
|
def track_moderation attrs
|
63
63
|
symbolize_keys! attrs
|
64
64
|
|
65
|
-
timestamp = attrs[:created_at] || Time.
|
65
|
+
timestamp = attrs[:created_at] || Time.now
|
66
66
|
check_timestamp! timestamp
|
67
|
-
attrs[:created_at] = timestamp
|
67
|
+
attrs[:created_at] = timestamp
|
68
68
|
|
69
69
|
handle_response(Request.new(path: '/track/moderation').post(@auth, attrs))
|
70
70
|
|
data/lib/koko/tracker/version.rb
CHANGED
@@ -52,14 +52,14 @@ module Koko
|
|
52
52
|
it 'uses the current time if no timestamp is given' do
|
53
53
|
client.track_content(Factory.content.merge("created_at" => nil))
|
54
54
|
|
55
|
-
expected_body = JSON.generate(Factory.content.merge("created_at" => Time.now
|
55
|
+
expected_body = JSON.generate(Factory.content.merge("created_at" => Time.now))
|
56
56
|
expect(WebMock).to have_requested(:post, "https://#{Defaults::Request.host}/track/content").with(body: expected_body)
|
57
57
|
end
|
58
58
|
|
59
|
-
it 'makes the correct request converting created_at time to
|
59
|
+
it 'makes the correct request converting created_at time to iso8601 string' do
|
60
60
|
client.track_content Factory.content
|
61
61
|
|
62
|
-
expected_body = JSON.generate(Factory.content.merge("created_at" => Factory.content["created_at"]
|
62
|
+
expected_body = JSON.generate(Factory.content.merge("created_at" => Factory.content["created_at"]))
|
63
63
|
expect(WebMock).to have_requested(:post, "https://#{Defaults::Request.host}/track/content").with(body: expected_body)
|
64
64
|
end
|
65
65
|
|
@@ -92,7 +92,7 @@ module Koko
|
|
92
92
|
it 'makes the correct request converting created_at time to float' do
|
93
93
|
client.track_flag Factory.flag
|
94
94
|
|
95
|
-
expected_body = JSON.generate(Factory.flag.merge("created_at" => Factory.flag["created_at"]
|
95
|
+
expected_body = JSON.generate(Factory.flag.merge("created_at" => Factory.flag["created_at"]))
|
96
96
|
expect(WebMock).to have_requested(:post, "https://#{Defaults::Request.host}/track/flag").with(body: expected_body)
|
97
97
|
end
|
98
98
|
end
|
@@ -117,7 +117,7 @@ module Koko
|
|
117
117
|
it 'makes the correct request converting created_at time to float' do
|
118
118
|
client.track_moderation Factory.moderation
|
119
119
|
|
120
|
-
expected_body = JSON.generate(Factory.moderation.merge("created_at" => Factory.moderation["created_at"]
|
120
|
+
expected_body = JSON.generate(Factory.moderation.merge("created_at" => Factory.moderation["created_at"]))
|
121
121
|
expect(WebMock).to have_requested(:post, "https://#{Defaults::Request.host}/track/moderation").with(body: expected_body)
|
122
122
|
end
|
123
123
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: koko-ai-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|