pocket-ruby 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: 94c29a4044db768b6c30927048ce55ac9ee329a66008cab931c2888c7976ad47
4
- data.tar.gz: a1b61bc70be32418276c523ce08ebf88d1110762f07ce397aacb89aca40e758c
3
+ metadata.gz: 23523be975e32aab67f1eb9eae5bd8a9a23032e7b9e32dd16c7ebd54829dcfd5
4
+ data.tar.gz: f340f0180bffcee80c64321392205ad43439434a12171b670baab1b7c30eb56f
5
5
  SHA512:
6
- metadata.gz: 24755f21d67f9f4408d24615712002b7380a18ac959a6947cd2983a01278c0c58334a1e914742902768b32aaec76f9c37436ee19e0a5d60c93015d15c4727bcc
7
- data.tar.gz: d21a10db04f4bb92cda2cbf9e9014019724bf850aabe784d2b7234d301dc2200c2e0d600bec44112118b7fd1ebb5fa0e77e8cfc2fdfa3a298901ab01066adb04
6
+ metadata.gz: 9c639bdd2f2637e55642da60be20d03e3e8e4ea7bc87b2da4ebf5951d8f99d7717e3d7608e3ec66c79a1e7b0bdf49f4c673a95590ffa34bd54baf4f0b5293b8a
7
+ data.tar.gz: 03f454e5471e90266dce757748b7a3fefad8adcfefd954bae3e2bd52f687dc922c7d0d7911ef02e85b94344f733803b6aea2c5dbfb50dfe45c2a0f8679ed81e0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.1] - 2021-04-10
4
+
5
+ - Return nil if `time_read` or `time_favorited` is '0' in the API response. Otherwise, this may be interpreted the Unix epoch (1970-01-01). ([#46](https://github.com/turadg/pocket-ruby/pull/46))
6
+
3
7
  ## [0.2.0] - 2021-04-03
4
8
 
5
9
  - Add support for authors and tags in `Pocket::Article` ([#44](https://github.com/turadg/pocket-ruby/pull/44))
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pocket-ruby (0.2.0)
4
+ pocket-ruby (0.2.1)
5
5
  faraday (>= 0.7)
6
6
  faraday_middleware
7
7
  multi_json (~> 1.0, >= 1.0.3)
@@ -88,6 +88,7 @@ module Pocket
88
88
 
89
89
  def time_read
90
90
  return nil unless response["time_read"]
91
+ return nil if response["time_read"] == "0"
91
92
  Time.at(Integer(response["time_read"])).utc
92
93
  end
93
94
 
@@ -97,6 +98,7 @@ module Pocket
97
98
 
98
99
  def time_favorited
99
100
  return nil unless response["time_favorited"]
101
+ return nil if response["time_favorited"] == "0"
100
102
  Time.at(Integer(response["time_favorited"])).utc
101
103
  end
102
104
 
@@ -1,3 +1,3 @@
1
1
  module Pocket
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -99,6 +99,11 @@ module Pocket
99
99
  assert_nil article.time_read
100
100
  end
101
101
 
102
+ test "time_read is nil if field is zero" do
103
+ parsed_response["time_read"] = "0"
104
+ assert_nil article.time_read
105
+ end
106
+
102
107
  test "favorited?" do
103
108
  assert article.favorited?
104
109
  end
@@ -112,6 +117,11 @@ module Pocket
112
117
  assert_nil article.time_favorited
113
118
  end
114
119
 
120
+ test "time_favorited is nil if field is zero" do
121
+ parsed_response["time_favorited"] = "0"
122
+ assert_nil article.time_favorited
123
+ end
124
+
115
125
  test "read?" do
116
126
  assert article.read?
117
127
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pocket-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Turadg Aleahmad
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-04-03 00:00:00.000000000 Z
13
+ date: 2021-04-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sinatra