restcountry 0.5.0 → 0.5.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
  SHA1:
3
- metadata.gz: faef79b2dfbf36a87e60855199d7a733f48b3c4e
4
- data.tar.gz: 0d1a076b4a65cbff619c6fafd7ec1921f8e8ebb5
3
+ metadata.gz: 5356b9b16f76595d98f00b88a723a84bcb416792
4
+ data.tar.gz: 7c86617050474ccdbc6f690132cbe68f234bf26c
5
5
  SHA512:
6
- metadata.gz: 693cc175e539626f4ce0793ec8075ddd0bb0bd010de9c6ec6b87ccfabf840f674abdd7cd38c551ae929c59da79554375e54cb90d1f5ca93d1afb0b06d3c26e80
7
- data.tar.gz: 7347b620db1e32690c08ea6c11e7c087c9b8ddf24206d7817e3679b8722b74d82b1b309c7593a85ed052b53361a521516f66d98f57fb0b3efe145c1e6c2702f9
6
+ metadata.gz: f1999adb2f28754a4fd021fb2cdddbfbbb7de26ea79b9048831a8abc92244cd35c9d7af1cd057b676bc2b55f80e9ebf2636d1a540c56e73e104c2b2fbccd9bed
7
+ data.tar.gz: 337ceca0968d2ebb0db0fec0078a03bb6356c6ba601eab73ac0565b7a9fdf5649705fd97ddae1b2be419622196cbf2074ce247974ec12bfc60c6a09d1a2e89ab
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Davide Santangelo <davide.santangelo@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -78,6 +78,10 @@ languages
78
78
  ## Credits
79
79
  Many thanks to Fayder Florez for his implementation of the API.
80
80
 
81
+ ## Related projects
82
+
83
+ * [gocountries](https://github.com/alediaferia/gocountries).
84
+
81
85
  ## License
82
86
  The restcountry GEM is released under the MIT License.
83
87
 
@@ -5,7 +5,7 @@ require 'uri'
5
5
  API_URL = 'https://restcountries.eu/rest/v1'
6
6
 
7
7
  module Restcountry
8
- class Country
8
+ class Country
9
9
  attr_reader :name,
10
10
  :capital,
11
11
  :altSpellings,
@@ -52,13 +52,13 @@ module Restcountry
52
52
  @languages = attributes['languages']
53
53
  end
54
54
 
55
- def self.find(name)
56
- countries = get_response('name', name)
55
+ def self.find(name, fulltext = false)
56
+ countries = get_response('name', name + "?fullText=#{fulltext.to_s}")
57
57
  new(countries.first) unless countries.empty?
58
58
  end
59
59
 
60
- def self.find_by_name(name)
61
- find(name)
60
+ def self.find_by_name(name, fulltext = false)
61
+ find(name, fulltext)
62
62
  end
63
63
 
64
64
  def self.find_by_currency(currency)
@@ -1,3 +1,3 @@
1
1
  module Restcountry
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -10,6 +10,13 @@ describe Restcountry do
10
10
  end
11
11
  end
12
12
 
13
+ it 'expect Kabul as first capital' do
14
+ VCR.use_cassette 'find_by_name' do
15
+ result = Restcountry::Country.all
16
+ expect(result.first.capital).to eq('Kabul')
17
+ end
18
+ end
19
+
13
20
  it 'has a version number' do
14
21
  expect(Restcountry::VERSION).not_to be nil
15
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restcountry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davide Santangelo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-22 00:00:00.000000000 Z
11
+ date: 2015-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -119,6 +119,7 @@ files:
119
119
  - ".rspec"
120
120
  - ".travis.yml"
121
121
  - Gemfile
122
+ - LICENSE
122
123
  - README.md
123
124
  - Rakefile
124
125
  - lib/restcountry.rb