rubyhexagon 1.6.0 → 1.6.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: 1900ac35dde2dd785dbebf585f72044933f2b39cfefae51f05ef91b81b16e07b
4
- data.tar.gz: d0acac948011df5b2a48203b75e50c99115f071794443e61a2ae96e61fd2ab91
3
+ metadata.gz: 150ab001b3c4f6f809e27d4b98678f1b10a0969893452d8d22aaf4a0c30ab9dd
4
+ data.tar.gz: 409bdeb85a0098f29e6e86e4b9a6a29d647f39376e9a5c9ca351a479f2fee68b
5
5
  SHA512:
6
- metadata.gz: 0c7c225ac5f218caca1b2749ff6b50ddb7663482accf3b7118f0e4ef5eed3d2e36293915752dcf5a362727dcd87ccb897db194adcf81262e0a80076cdb3264d0
7
- data.tar.gz: 855efb249f5e819ef0d1bbcfa4f52d0b5be048e9ab43247c2125b61bc5a2b8e57deb83dec937bc8c0570cd8087778ef45041596411f9458527ff7aef4ea7c8da
6
+ metadata.gz: f0d20c78165882f8a8299440ed522a0e26a5144a33ba3eaaf1b10c026dd7f66eada80d62670d945f466e5233d05b95416eacbca5c7c50f00174e9f5adc650037
7
+ data.tar.gz: c4c7e68bf94943ad78b2b31913bb2852f809ff63eb9ebe66ee0fce14b7bf31ae1023f0417ae44498d7fedd1cc81c0210d2ae272a13abc2558ec6479ad8bf0244
@@ -46,7 +46,7 @@ require_relative 'rubyhexagon/search/tag_history'
46
46
  module Rubyhexagon
47
47
  MAJOR = 1
48
48
  MINOR = 6
49
- PATCH = 0
49
+ PATCH = 1
50
50
  NAME = 'rubyhexagon'
51
51
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
52
52
  end
@@ -34,7 +34,7 @@ module Rubyhexagon
34
34
  # @author Maxine Michalski
35
35
  # @since 1.6.0
36
36
  class AccessDenied < StandardError; end
37
-
37
+
38
38
  # Error class to denote that a Post was already favorited.
39
39
  #
40
40
  # @author Maxine Michalski
@@ -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
- res[:reason] == 'You\'ve already favorited this post'
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyhexagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxine Michalski