booker_ruby 1.10.3 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/booker/models/country.rb +9 -0
- data/lib/booker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 212ca299954f403e92555d0e0971eddbb046bd85
|
4
|
+
data.tar.gz: c0410477979179a0afea90c6c0ecd2ac173d388c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f61d4961eab03fef75bef1db542fb0e3c9d26a2654e0160f23b529297491a69545fb72870d340962964ca66adda35dd0310eb91a5628595b22d7357d2d9689de
|
7
|
+
data.tar.gz: 23db26cd08b98d98895b5cb764e9890c50df4dfbbeade58b123e8915a6c0cae00d99d798c67f00870fcd47982b35f88b229c1c2168c1d4650684b5180c847b55
|
@@ -5,6 +5,15 @@ module Booker
|
|
5
5
|
IDS_TO_ISO_CODES = YAML::load_file(File.join(__dir__, '..', 'config', 'booker_country_ids_to_iso_codes.yml')).freeze
|
6
6
|
|
7
7
|
def country_code; IDS_TO_ISO_CODES[self.ID]; end
|
8
|
+
|
9
|
+
def self.from_country_code(code)
|
10
|
+
country = self.new ID: IDS_TO_ISO_CODES.detect{|k, v| v == code}.try(:[], 0)
|
11
|
+
if country.ID.nil?
|
12
|
+
raise ArgumentError, 'Country code not recognized'
|
13
|
+
else
|
14
|
+
country
|
15
|
+
end
|
16
|
+
end
|
8
17
|
end
|
9
18
|
end
|
10
19
|
end
|
data/lib/booker/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: booker_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frederick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|