restcountry 0.1.0 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85b6ae31bd4440491143a247296f9e77e9ec7d0a
4
- data.tar.gz: a1c868ad14e3dc78e785c75b23f743b240582177
3
+ metadata.gz: 1a429265f869e9e6ffe13bd678e2ba0aff7c96ea
4
+ data.tar.gz: 19a44f69d860716260bc18a861d1b539ba4a047a
5
5
  SHA512:
6
- metadata.gz: 8446bdbaeee0a657919ead283fdf8297e345ecf4ac50c3d7027da3829e4cc10ab3a48627a41f9ca8c21f524085632327b19ba587df5fa122746b3985c27c480e
7
- data.tar.gz: fe90e9e482bb7bbe16dc9002a875d87df42700b397f89eec072f69e543f29978bd437518dfb1a1f94cfc4955627efaf2198a3ca75f9e1d1ecab86f3afe87684c
6
+ metadata.gz: 51715b81c443153436c10f5ff9bb17f4e5a7f0c31aa0e760d1f70bb219a761d20a270efc8be1625a4546ff4e3c339cc607322100b17e51f4aa5b09bc7da3d316
7
+ data.tar.gz: a2831453ea9fb595dc9ea72607571368dd5d9050d582125aa6eca49de81e7681f2921ce37b53984c419a90831d74fd4d524efe8ef23ee13b7cff6de36dd8de57
@@ -56,6 +56,23 @@ module Restcountry
56
56
  response.success? ? new(JSON.parse(response.body).first) : []
57
57
  end
58
58
 
59
+ def self.find_by_currency(currency)
60
+ response = Faraday.get("#{API_URL}/currency/#{currency}")
61
+ countries = response.success? ? JSON.parse(response.body) : []
62
+ countries.map { |attributes| new(attributes) }
63
+ end
64
+
65
+ def self.find_by_capital(capital)
66
+ response = Faraday.get("#{API_URL}/capital/#{capital}")
67
+ response.success? ? new(JSON.parse(response.body).first) : []
68
+ end
69
+
70
+ def self.find_by_region(region)
71
+ response = Faraday.get("#{API_URL}/region/#{region}")
72
+ countries = response.success? ? JSON.parse(response.body) : []
73
+ countries.map { |attributes| new(attributes) }
74
+ end
75
+
59
76
  def self.all
60
77
  response = Faraday.get("#{API_URL}/all")
61
78
  countries = response.success? ? JSON.parse(response.body) : []
@@ -1,3 +1,3 @@
1
1
  module Restcountry
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  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.1.0
4
+ version: 0.2.0
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-08 00:00:00.000000000 Z
11
+ date: 2015-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler