checkdin 0.3.4 → 0.3.5
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.
- data/Rakefile +1 -0
- data/lib/checkdin/api_error.rb +5 -3
- data/lib/checkdin/client.rb +1 -1
- data/lib/checkdin/version.rb +1 -1
- data/lib/checkdin/won_rewards.rb +8 -0
- metadata +2 -2
data/Rakefile
CHANGED
data/lib/checkdin/api_error.rb
CHANGED
@@ -4,12 +4,14 @@ module Checkdin
|
|
4
4
|
attr_reader :status, :body
|
5
5
|
|
6
6
|
def initialize(status, body)
|
7
|
-
@status
|
8
|
-
@body
|
7
|
+
@status = status
|
8
|
+
@body = body
|
9
|
+
super(message)
|
9
10
|
end
|
10
11
|
|
11
12
|
def message
|
12
|
-
"
|
13
|
+
"status_code:#{status} body:#{body.inspect}"
|
13
14
|
end
|
15
|
+
|
14
16
|
end
|
15
17
|
end
|
data/lib/checkdin/client.rb
CHANGED
@@ -66,7 +66,7 @@ module Checkdin
|
|
66
66
|
# Added just for convenience to avoid having to traverse farther down the response just to get to returned data.
|
67
67
|
|
68
68
|
def return_error_or_body(response)
|
69
|
-
if response.status ==
|
69
|
+
if response.status / 100 == 2
|
70
70
|
response.body
|
71
71
|
else
|
72
72
|
raise Checkdin::APIError.new(response.status, response.body)
|
data/lib/checkdin/version.rb
CHANGED
data/lib/checkdin/won_rewards.rb
CHANGED
@@ -25,5 +25,13 @@ module Checkdin
|
|
25
25
|
return_error_or_body(response)
|
26
26
|
end
|
27
27
|
|
28
|
+
# Retract a won reward - this will also create a corresponding negative points entry if needed.
|
29
|
+
#
|
30
|
+
# param [Integer] id The ID of the reward
|
31
|
+
|
32
|
+
def retract_won_reward(id)
|
33
|
+
response = connection.post("won_rewards/#{id}/retract")
|
34
|
+
return_error_or_body(response)
|
35
|
+
end
|
28
36
|
end
|
29
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: checkdin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -232,7 +232,7 @@ files:
|
|
232
232
|
- lib/checkdin/votes.rb
|
233
233
|
- lib/checkdin/clients.rb
|
234
234
|
- lib/checkdin/won_rewards.rb
|
235
|
-
homepage: http://github.com/mattmueller/checkdin
|
235
|
+
homepage: http://github.com/mattmueller/checkdin-ruby
|
236
236
|
licenses:
|
237
237
|
- MIT
|
238
238
|
post_install_message:
|