rubyhexagon 1.6.0 → 1.6.1
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/rubyhexagon.rb +1 -1
- data/lib/rubyhexagon/error.rb +1 -1
- data/lib/rubyhexagon/post.rb +2 -6
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 150ab001b3c4f6f809e27d4b98678f1b10a0969893452d8d22aaf4a0c30ab9dd
|
|
4
|
+
data.tar.gz: 409bdeb85a0098f29e6e86e4b9a6a29d647f39376e9a5c9ca351a479f2fee68b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f0d20c78165882f8a8299440ed522a0e26a5144a33ba3eaaf1b10c026dd7f66eada80d62670d945f466e5233d05b95416eacbca5c7c50f00174e9f5adc650037
|
|
7
|
+
data.tar.gz: c4c7e68bf94943ad78b2b31913bb2852f809ff63eb9ebe66ee0fce14b7bf31ae1023f0417ae44498d7fedd1cc81c0210d2ae272a13abc2558ec6479ad8bf0244
|
data/lib/rubyhexagon.rb
CHANGED
data/lib/rubyhexagon/error.rb
CHANGED
data/lib/rubyhexagon/post.rb
CHANGED
|
@@ -88,9 +88,7 @@ module Rubyhexagon
|
|
|
88
88
|
# @return the object
|
|
89
89
|
def initialize(id)
|
|
90
90
|
id = id.to_i
|
|
91
|
-
unless id.positive?
|
|
92
|
-
raise InvalidIDError, "ID out of range: #{id}"
|
|
93
|
-
end
|
|
91
|
+
raise InvalidIDError, "ID out of range: #{id}" unless id.positive?
|
|
94
92
|
@id = id
|
|
95
93
|
end
|
|
96
94
|
|
|
@@ -157,11 +155,10 @@ module Rubyhexagon
|
|
|
157
155
|
# Favorite this post
|
|
158
156
|
def favorite!
|
|
159
157
|
res = API.new.fetch('favorite', 'create', { id: @id }, 'POST')
|
|
160
|
-
p res
|
|
161
158
|
if res[:reason] == 'access denied' && !res[:success]
|
|
162
159
|
raise Rubyhexagon::AccessDenied, res[:message]
|
|
163
160
|
elsif !res[:success] &&
|
|
164
|
-
|
|
161
|
+
res[:reason] == 'You\'ve already favorited this post'
|
|
165
162
|
raise Rubyhexagon::AlreadyFavorited
|
|
166
163
|
end
|
|
167
164
|
nil
|
|
@@ -172,7 +169,6 @@ module Rubyhexagon
|
|
|
172
169
|
# Unfavorite this post
|
|
173
170
|
def unfavorite!
|
|
174
171
|
res = API.new.fetch('favorite', 'destroy', { id: @id }, 'POST')
|
|
175
|
-
p res
|
|
176
172
|
if res[:reason] == 'access denied' && !res[:success]
|
|
177
173
|
raise Rubyhexagon::AccessDenied, res[:message]
|
|
178
174
|
end
|