thumbtack 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/thumbtack/note.rb +2 -2
- data/lib/thumbtack/note_summary.rb +2 -2
- data/lib/thumbtack/post.rb +4 -4
- data/lib/thumbtack/posts.rb +2 -2
- data/lib/thumbtack/specification.rb +1 -1
- data/lib/thumbtack/types/boolean.rb +2 -2
- data/lib/thumbtack/types/date.rb +2 -2
- data/lib/thumbtack/types/date_time.rb +7 -5
- data/lib/thumbtack/types/identity.rb +2 -2
- data/lib/thumbtack/types/tags.rb +2 -2
- data/lib/thumbtack/version.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/test/thumbtack/specification_test.rb +1 -1
- data/test/thumbtack/types/boolean_test.rb +6 -6
- data/test/thumbtack/types/date_test.rb +4 -4
- data/test/thumbtack/types/date_time_test.rb +6 -6
- data/test/thumbtack/types/identity_test.rb +4 -4
- data/test/thumbtack/types/integer_test.rb +4 -4
- data/test/thumbtack/types/md5_test.rb +4 -4
- data/test/thumbtack/types/tags_test.rb +6 -6
- data/test/thumbtack/types/text_test.rb +4 -4
- data/test/thumbtack/types/title_test.rb +4 -4
- data/test/thumbtack/types/url_test.rb +4 -4
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 865dedec8bc24d93f1134a1a4b0515decd1ab4cb
|
4
|
+
data.tar.gz: 55d72d32a1a29eeee1578fb3736ba20f643f721d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5eb64b30a1a0f11dc500e9e48017467f807026e6526278c046602424a65fdc1bbd419f634a46323b86994181d6d80de59fe91f67312f9717695bb1c12ce0288d
|
7
|
+
data.tar.gz: 4d9462b77cfe56905794db3e876c93bd20a487a4ed5d510de210f37c714a5efeea55c60bd12eb5fe6b1f75ca787075262965ca8afc4d6dd2c95d9dfcb27cfb63
|
data/lib/thumbtack/note.rb
CHANGED
@@ -47,7 +47,7 @@ module Thumbtack
|
|
47
47
|
#
|
48
48
|
# @api public
|
49
49
|
def created_at
|
50
|
-
Types::DateTime.
|
50
|
+
Types::DateTime.deserialize_from_note(@created_at)
|
51
51
|
end
|
52
52
|
|
53
53
|
# The time at which the note was last updated
|
@@ -59,7 +59,7 @@ module Thumbtack
|
|
59
59
|
#
|
60
60
|
# @api public
|
61
61
|
def updated_at
|
62
|
-
Types::DateTime.
|
62
|
+
Types::DateTime.deserialize_from_note(@updated_at)
|
63
63
|
end
|
64
64
|
|
65
65
|
# 20 character hexadecimal SHA1 hash of the note text
|
@@ -47,7 +47,7 @@ module Thumbtack
|
|
47
47
|
#
|
48
48
|
# @api public
|
49
49
|
def created_at
|
50
|
-
Types::DateTime.
|
50
|
+
Types::DateTime.deserialize_from_note(@created_at)
|
51
51
|
end
|
52
52
|
|
53
53
|
# The time at which the note was last updated
|
@@ -59,7 +59,7 @@ module Thumbtack
|
|
59
59
|
#
|
60
60
|
# @api public
|
61
61
|
def updated_at
|
62
|
-
Types::DateTime.
|
62
|
+
Types::DateTime.deserialize_from_note(@updated_at)
|
63
63
|
end
|
64
64
|
|
65
65
|
# 20 character hexadecimal SHA1 hash of the note text
|
data/lib/thumbtack/post.rb
CHANGED
@@ -79,7 +79,7 @@ module Thumbtack
|
|
79
79
|
#
|
80
80
|
# @api public
|
81
81
|
def time
|
82
|
-
Types::DateTime.
|
82
|
+
Types::DateTime.deserialize(@time)
|
83
83
|
end
|
84
84
|
|
85
85
|
# If true, this post is public
|
@@ -91,7 +91,7 @@ module Thumbtack
|
|
91
91
|
#
|
92
92
|
# @api public
|
93
93
|
def shared
|
94
|
-
Types::Boolean.
|
94
|
+
Types::Boolean.deserialize(@shared)
|
95
95
|
end
|
96
96
|
|
97
97
|
# If true, this post is marked unread
|
@@ -103,7 +103,7 @@ module Thumbtack
|
|
103
103
|
#
|
104
104
|
# @api public
|
105
105
|
def toread
|
106
|
-
Types::Boolean.
|
106
|
+
Types::Boolean.deserialize(@toread)
|
107
107
|
end
|
108
108
|
|
109
109
|
# The tags for this post, space-seperated
|
@@ -115,7 +115,7 @@ module Thumbtack
|
|
115
115
|
#
|
116
116
|
# @api public
|
117
117
|
def tags
|
118
|
-
Types::Tags.
|
118
|
+
Types::Tags.deserialize(@tags)
|
119
119
|
end
|
120
120
|
|
121
121
|
# Creates a new Post from a Hash
|
data/lib/thumbtack/posts.rb
CHANGED
@@ -25,7 +25,7 @@ module Thumbtack
|
|
25
25
|
# @see https://pinboard.in/api/#posts_update
|
26
26
|
def update
|
27
27
|
response = @client.get('/posts/update')
|
28
|
-
Types::DateTime.
|
28
|
+
Types::DateTime.deserialize response.fetch('update_time')
|
29
29
|
end
|
30
30
|
|
31
31
|
# Add a bookmark
|
@@ -249,7 +249,7 @@ module Thumbtack
|
|
249
249
|
# @api private
|
250
250
|
def dates_with_counts_from(response)
|
251
251
|
entries = response.fetch('dates', EMPTY_HASH).map do |date, count|
|
252
|
-
[Types::Date.
|
252
|
+
[Types::Date.deserialize(date), count.to_i]
|
253
253
|
end
|
254
254
|
Hash[entries]
|
255
255
|
end
|
@@ -32,7 +32,7 @@ module Thumbtack
|
|
32
32
|
#
|
33
33
|
# @return [String]
|
34
34
|
# 'yes' if value is true, 'no' otherwise
|
35
|
-
def self.
|
35
|
+
def self.serialize(value)
|
36
36
|
case value
|
37
37
|
when TrueClass
|
38
38
|
'yes'
|
@@ -47,7 +47,7 @@ module Thumbtack
|
|
47
47
|
# Either 'yes' or 'no'
|
48
48
|
#
|
49
49
|
# @return [Boolean]
|
50
|
-
def self.
|
50
|
+
def self.deserialize(parameter)
|
51
51
|
case parameter
|
52
52
|
when 'yes'
|
53
53
|
true
|
data/lib/thumbtack/types/date.rb
CHANGED
@@ -33,7 +33,7 @@ module Thumbtack
|
|
33
33
|
#
|
34
34
|
# @return [String]
|
35
35
|
# the date with format yyyy-mm-dd
|
36
|
-
def self.
|
36
|
+
def self.serialize(value)
|
37
37
|
value.xmlschema
|
38
38
|
end
|
39
39
|
|
@@ -43,7 +43,7 @@ module Thumbtack
|
|
43
43
|
# the date with format yyyy-mm-dd
|
44
44
|
#
|
45
45
|
# @return [Date]
|
46
|
-
def self.
|
46
|
+
def self.deserialize(parameter)
|
47
47
|
::Date.xmlschema(parameter)
|
48
48
|
end
|
49
49
|
end
|
@@ -11,8 +11,10 @@ module Thumbtack
|
|
11
11
|
EARLIEST = ::DateTime.new(1, 1, 1)
|
12
12
|
# The latest allowable time
|
13
13
|
LATEST = ::DateTime.new(2100, 1, 1)
|
14
|
-
# Pinboard's date format
|
14
|
+
# Pinboard's date time format
|
15
15
|
FORMAT = '%Y-%m-%dT%H:%M:%SZ'.freeze
|
16
|
+
# Pinboard's date time format for notes
|
17
|
+
NOTE_FORMAT = '%Y-%m-%d %H:%M:%S'.freeze
|
16
18
|
|
17
19
|
# Validate a time
|
18
20
|
#
|
@@ -35,7 +37,7 @@ module Thumbtack
|
|
35
37
|
#
|
36
38
|
# @return [String]
|
37
39
|
# the time formatted yyyy-mm-ddTHH:MM:SSZ.
|
38
|
-
def self.
|
40
|
+
def self.serialize(value)
|
39
41
|
value.strftime(FORMAT)
|
40
42
|
end
|
41
43
|
|
@@ -45,7 +47,7 @@ module Thumbtack
|
|
45
47
|
# the time formatted yyyy-mm-ddTHH:MM:SSZ
|
46
48
|
#
|
47
49
|
# @return [DateTime]
|
48
|
-
def self.
|
50
|
+
def self.deserialize(parameter)
|
49
51
|
::DateTime.strptime(parameter)
|
50
52
|
end
|
51
53
|
|
@@ -55,8 +57,8 @@ module Thumbtack
|
|
55
57
|
# the time formatted yyyy-mm-dd HH:MM:SS
|
56
58
|
#
|
57
59
|
# @return [DateTime]
|
58
|
-
def self.
|
59
|
-
::DateTime.strptime(parameter,
|
60
|
+
def self.deserialize_from_note(parameter)
|
61
|
+
::DateTime.strptime(parameter, NOTE_FORMAT)
|
60
62
|
end
|
61
63
|
end
|
62
64
|
end
|
@@ -19,7 +19,7 @@ module Thumbtack
|
|
19
19
|
# the value to return
|
20
20
|
#
|
21
21
|
# @return [value]
|
22
|
-
def self.
|
22
|
+
def self.serialize(value)
|
23
23
|
value
|
24
24
|
end
|
25
25
|
|
@@ -29,7 +29,7 @@ module Thumbtack
|
|
29
29
|
# the parameter to return
|
30
30
|
#
|
31
31
|
# @return [parameter]
|
32
|
-
def self.
|
32
|
+
def self.deserialize(parameter)
|
33
33
|
parameter
|
34
34
|
end
|
35
35
|
end
|
data/lib/thumbtack/types/tags.rb
CHANGED
@@ -40,7 +40,7 @@ module Thumbtack
|
|
40
40
|
#
|
41
41
|
# @return [String]
|
42
42
|
# space-separated list of tags
|
43
|
-
def self.
|
43
|
+
def self.serialize(value)
|
44
44
|
Array(value).map(&:strip).join(SEPARATOR)
|
45
45
|
end
|
46
46
|
|
@@ -50,7 +50,7 @@ module Thumbtack
|
|
50
50
|
# space-separated list of tags
|
51
51
|
#
|
52
52
|
# @return [Array<String>]
|
53
|
-
def self.
|
53
|
+
def self.deserialize(parameter)
|
54
54
|
parameter.split(SEPARATOR)
|
55
55
|
end
|
56
56
|
|
data/lib/thumbtack/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -6,7 +6,7 @@ class SpecificationTest < Minitest::Test
|
|
6
6
|
def test_parameters
|
7
7
|
type_handler = Minitest::Mock.new
|
8
8
|
type_handler.expect(:validate, type_handler, ['value'])
|
9
|
-
type_handler.expect(:
|
9
|
+
type_handler.expect(:serialize, 'parameterized', ['value'])
|
10
10
|
|
11
11
|
assert_equal(
|
12
12
|
{ key: 'parameterized' },
|
@@ -16,13 +16,13 @@ class BooleanTest < Minitest::Test
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
20
|
-
assert_equal 'yes', Types::Boolean.
|
21
|
-
assert_equal 'no', Types::Boolean.
|
19
|
+
def test_serialize
|
20
|
+
assert_equal 'yes', Types::Boolean.serialize(true)
|
21
|
+
assert_equal 'no', Types::Boolean.serialize(false)
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
25
|
-
assert_equal true, Types::Boolean.
|
26
|
-
assert_equal false, Types::Boolean.
|
24
|
+
def test_deserialize
|
25
|
+
assert_equal true, Types::Boolean.deserialize('yes')
|
26
|
+
assert_equal false, Types::Boolean.deserialize('no')
|
27
27
|
end
|
28
28
|
end
|
@@ -15,13 +15,13 @@ class DateTest < Minitest::Test
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def test_serialize
|
19
19
|
assert_equal '2010-12-11',
|
20
|
-
Types::Date.
|
20
|
+
Types::Date.serialize(::Date.new(2010, 12, 11))
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def test_deserialize
|
24
24
|
assert_equal ::Date.new(2010, 12, 11),
|
25
|
-
Types::Date.
|
25
|
+
Types::Date.deserialize('2010-12-11')
|
26
26
|
end
|
27
27
|
end
|
@@ -15,19 +15,19 @@ class DateTimeTest < Minitest::Test
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def test_serialize
|
19
19
|
assert_equal '2010-12-11T19:48:02Z',
|
20
|
-
Types::DateTime.
|
20
|
+
Types::DateTime.serialize(
|
21
21
|
::DateTime.new(2010, 12, 11, 19, 48, 2))
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def test_deserialize
|
25
25
|
assert_equal ::DateTime.new(2010, 12, 11, 19, 48, 2),
|
26
|
-
Types::DateTime.
|
26
|
+
Types::DateTime.deserialize('2010-12-11T19:48:02Z')
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
29
|
+
def test_deserialize_from_note
|
30
30
|
assert_equal ::DateTime.new(2010, 12, 11, 19, 48, 2),
|
31
|
-
Types::DateTime.
|
31
|
+
Types::DateTime.deserialize_from_note('2010-12-11 19:48:02')
|
32
32
|
end
|
33
33
|
end
|
@@ -7,12 +7,12 @@ class IdentityTest < Minitest::Test
|
|
7
7
|
assert_equal Types::Identity, Types::Identity.validate('any value')
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
assert_equal 'any value', Types::Identity.
|
10
|
+
def test_serialize
|
11
|
+
assert_equal 'any value', Types::Identity.serialize('any value')
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def test_deserialize
|
15
15
|
assert_equal 'any parameter',
|
16
|
-
Types::Identity.
|
16
|
+
Types::Identity.deserialize('any parameter')
|
17
17
|
end
|
18
18
|
end
|
@@ -16,11 +16,11 @@ class IntegerTest < Minitest::Test
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
20
|
-
assert_equal 42, Types::Integer.
|
19
|
+
def test_serialize
|
20
|
+
assert_equal 42, Types::Integer.serialize(42)
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
24
|
-
assert_equal 42, Types::Integer.
|
23
|
+
def test_deserialize
|
24
|
+
assert_equal 42, Types::Integer.deserialize(42)
|
25
25
|
end
|
26
26
|
end
|
@@ -16,13 +16,13 @@ class MD5Test < Minitest::Test
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def test_serialize
|
20
20
|
assert_equal '437b930db84b8079c2dd804a71936b5f',
|
21
|
-
Types::MD5.
|
21
|
+
Types::MD5.serialize('437b930db84b8079c2dd804a71936b5f')
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def test_deserialize
|
25
25
|
assert_equal '437b930db84b8079c2dd804a71936b5f',
|
26
|
-
Types::MD5.
|
26
|
+
Types::MD5.deserialize('437b930db84b8079c2dd804a71936b5f')
|
27
27
|
end
|
28
28
|
end
|
@@ -17,13 +17,13 @@ class TagsTest < Minitest::Test
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
21
|
-
assert_equal 'one', Types::Tags.
|
22
|
-
assert_equal 'one two', Types::Tags.
|
23
|
-
assert_equal 'padding', Types::Tags.
|
20
|
+
def test_serialize
|
21
|
+
assert_equal 'one', Types::Tags.serialize('one')
|
22
|
+
assert_equal 'one two', Types::Tags.serialize(%w(one two))
|
23
|
+
assert_equal 'padding', Types::Tags.serialize([' padding '])
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
27
|
-
assert_equal %w(one two), Types::Tags.
|
26
|
+
def test_deserialize
|
27
|
+
assert_equal %w(one two), Types::Tags.deserialize('one two')
|
28
28
|
end
|
29
29
|
end
|
@@ -12,11 +12,11 @@ class TextTest < Minitest::Test
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
assert_equal 'text', Types::Text.
|
15
|
+
def test_serialize
|
16
|
+
assert_equal 'text', Types::Text.serialize('text')
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
20
|
-
assert_equal 'text', Types::Text.
|
19
|
+
def test_deserialize
|
20
|
+
assert_equal 'text', Types::Text.deserialize('text')
|
21
21
|
end
|
22
22
|
end
|
@@ -12,11 +12,11 @@ class TitleTest < Minitest::Test
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
assert_equal 'title', Types::Title.
|
15
|
+
def test_serialize
|
16
|
+
assert_equal 'title', Types::Title.serialize('title')
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
20
|
-
assert_equal 'title', Types::Title.
|
19
|
+
def test_deserialize
|
20
|
+
assert_equal 'title', Types::Title.deserialize('title')
|
21
21
|
end
|
22
22
|
end
|
@@ -11,13 +11,13 @@ class URLTest < Minitest::Test
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def test_serialize
|
15
15
|
value = 'http://pinboard.in'
|
16
|
-
assert_equal value, Types::URL.
|
16
|
+
assert_equal value, Types::URL.serialize(value)
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def test_deserialize
|
20
20
|
value = 'http://pinboard.in'
|
21
|
-
assert_equal value, Types::URL.
|
21
|
+
assert_equal value, Types::URL.deserialize(value)
|
22
22
|
end
|
23
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thumbtack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nate Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.4.
|
33
|
+
version: 0.4.8
|
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
|
-
version: 0.4.
|
40
|
+
version: 0.4.8
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 5.
|
47
|
+
version: 5.8.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 5.
|
54
|
+
version: 5.8.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
156
|
version: '0'
|
157
157
|
requirements: []
|
158
158
|
rubyforge_project:
|
159
|
-
rubygems_version: 2.4.
|
159
|
+
rubygems_version: 2.4.8
|
160
160
|
signing_key:
|
161
161
|
specification_version: 4
|
162
162
|
summary: The best Pinboard API client
|