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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c54ed7434361e05ba756f1c830af98ff0d917828
4
- data.tar.gz: f8ed403d5383e586c2ba73ddf50c7a285a70f5e6
3
+ metadata.gz: bbab8eb849d6a88baf77197a3626975c3376238d
4
+ data.tar.gz: 87c099458959d5efe6f655b7a1cd622ca2d6fbc2
5
5
  SHA512:
6
- metadata.gz: 91c8a8d0745af0577a7c822aa369eb48c4ae09b2a535fa8e038d2f102b8aa802ab531e49fdc7578282c5f857bd0c38c4815d9165343a63102c02080266b7d4f5
7
- data.tar.gz: a60480e6670beff20f0ceb76f05f13ea712fbbb3c0769dc0f2f44f7d1ab926b93eb6fa2d1fd4e109271df22c01a4773abb34fd8d9db82487b07dc1e357f9308a
6
+ metadata.gz: fb14079af0a2669d54eab7e731b0f52ed664f37f02dfde0e440d4fc9599126eddc13c487a3eb419fa7717d1447af93539b2e30c3b6c000d22de730982f4ede4d
7
+ data.tar.gz: 3d9196f33b107d62d89e4806be3da1ea70fc08902483d2020cbc9098d33cd8202bbdc9797579fc4a9c2b463cb31e3ab7a60899efd0623c503b9a5f2102bc6b73
data/History.md CHANGED
@@ -13,3 +13,8 @@
13
13
  ==================
14
14
 
15
15
  * Remove unnecessary dependency
16
+
17
+ 0.0.4 / 2017-06-28
18
+ ==================
19
+
20
+ * Use Json default serialization for created_at time
@@ -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.new
31
+ timestamp = attrs[:created_at] || Time.now
32
32
  check_timestamp! timestamp
33
- attrs[:created_at] = timestamp.to_f
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.new
50
+ timestamp = attrs[:created_at] || Time.now
51
51
  check_timestamp! timestamp
52
- attrs[:created_at] = timestamp.to_f
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.new
65
+ timestamp = attrs[:created_at] || Time.now
66
66
  check_timestamp! timestamp
67
- attrs[:created_at] = timestamp.to_f
67
+ attrs[:created_at] = timestamp
68
68
 
69
69
  handle_response(Request.new(path: '/track/moderation').post(@auth, attrs))
70
70
 
@@ -1,5 +1,5 @@
1
1
  module Koko
2
2
  class Tracker
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
  end
5
5
  end
@@ -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.to_f))
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 float' do
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"].to_f))
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"].to_f))
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"].to_f))
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
@@ -45,7 +45,7 @@ module Koko
45
45
 
46
46
  def self.behavorial_classification
47
47
  {
48
- "behavorial_classification" => {
48
+ "classifiers" => {
49
49
  "id" => "123",
50
50
  "classification": [
51
51
  {
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.3
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-06-28 00:00:00.000000000 Z
11
+ date: 2017-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake