Commit 3a04d97a882cdd67f85bbbeedbb10033fcb2eea4
1 parent
f7067887
Exists in
master
and in
1 other branch
hoptoad-ios reports its API version as 2.1. Allow
that. Also improve the message for ApiVersionError.
Showing
1 changed file
with
3 additions
and
4 deletions
Show diff stats
lib/hoptoad.rb
... | ... | @@ -3,7 +3,7 @@ require 'hoptoad/v2' |
3 | 3 | module Hoptoad |
4 | 4 | class ApiVersionError < StandardError |
5 | 5 | def initialize |
6 | - super "Wrong API Version: Expecting v2.0" | |
6 | + super "Wrong API Version: Expecting 2.0, 2.1, or 2.2" | |
7 | 7 | end |
8 | 8 | end |
9 | 9 | |
... | ... | @@ -17,9 +17,8 @@ module Hoptoad |
17 | 17 | private |
18 | 18 | def self.get_version_processor(version) |
19 | 19 | case version |
20 | - when '2.0'; Hoptoad::V2 | |
21 | - when '2.2'; Hoptoad::V2 | |
22 | - else; raise ApiVersionError | |
20 | + when /2\.[012]/; Hoptoad::V2 | |
21 | + else; raise ApiVersionError | |
23 | 22 | end |
24 | 23 | end |
25 | 24 | end | ... | ... |