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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35c1f972010b7ecba2d5d065e9208abe1471bf55
4
- data.tar.gz: 38d87b327ce32044bac7c2518c8339a0c07b1829
3
+ metadata.gz: 212ca299954f403e92555d0e0971eddbb046bd85
4
+ data.tar.gz: c0410477979179a0afea90c6c0ecd2ac173d388c
5
5
  SHA512:
6
- metadata.gz: 03f8bf1abacd942effa55036ad5450d30afefa8aabf8b05e1e8a28d321ebaae9b4a953090464b87ae148055a22855489a7c80302d80892814a83a225f40ece0e
7
- data.tar.gz: e9cd666d2ca9c1803a55a635b524309fc0363b62f93c1558c2487b51b541963f2cf112d9436ab4aa794add7e631d5882698414b598624355caa24ee2b7d269a6
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
@@ -1,3 +1,3 @@
1
1
  module Booker
2
- VERSION = '1.10.3'
2
+ VERSION = '1.11.0'
3
3
  end
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.10.3
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 00:00:00.000000000 Z
11
+ date: 2016-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty