international_postcode_api 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
  SHA256:
3
- metadata.gz: ebc490944a9cf04410b96b757011f1a846967225fb62b25a04b45eed04bc83e2
4
- data.tar.gz: a0e33a8c2be7a8710b3fb5f151081567802f2cc748f51a153c6e96019a124b34
3
+ metadata.gz: c9af275bfc146cecf97764f2bf81ed5af66d535ad1dbce81a099393b9c5eb637
4
+ data.tar.gz: f4a6004acb47d1932f0dd1585e24a16374cfbf716b93f6860c6b353ab382c83c
5
5
  SHA512:
6
- metadata.gz: 3f1a8e95a734875d01d86408ec103ff3757fe9c74d400fabebe2eac0da7fce186ad5aa79fcc156beb40d7bc7c0feaf0bdc5ac292273ed5647e6f11ef08f89941
7
- data.tar.gz: f972286ea123866175b197e399495d0dc24d74994d4e1ed04e1a52ff78c61bf7a657b9d5968868031db45b80b4e9ab8089df8bedf3803f6e3c9ae765969e0318
6
+ metadata.gz: 455a88fa756f1389171f60b0c29f7ae17e1124bd3bd79e258ea449e45a5f2187a08eddf647661e465b957b23552286c26a2b35d9aa11d0c8375399094fff0679
7
+ data.tar.gz: 9f8e044f10d919c7416e0d049a020298841eab4bf5120e3ac801c562fbfbf37b17e90ad702a30b7a163412778f1092df941646a8a7f9ed36b7a8ced7d7df16cb
@@ -24,4 +24,6 @@ Gem::Specification.new do |spec|
24
24
  spec.bindir = "exe"
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ["lib"]
27
+
28
+ spec.add_development_dependency "rspec"
27
29
  end
@@ -4,7 +4,7 @@ require 'json'
4
4
  module InternationalPostcodeApi
5
5
  class Client
6
6
  def self.autocomplete(term, context = 'nld')
7
- uri = generate_uri(:autocomplete, context, term)
7
+ uri = generate_uri(:autocomplete, context.downcase, term)
8
8
  fetch(uri)
9
9
  end
10
10
 
@@ -23,16 +23,16 @@ module InternationalPostcodeApi
23
23
  fetch(uri)
24
24
  end
25
25
 
26
- def self.postcode(postcode, house_number, lang = 'NL')
27
- if lang == 'NL' && InternationalPostcodeApi.configuration.dynamic_endpoints
26
+ def self.postcode(postcode, house_number, lang = 'NLD')
27
+ if lang == 'NLD' && InternationalPostcodeApi.configuration.dynamic_endpoints
28
28
  response = dutch_postcode(postcode, house_number)
29
29
  return { street: response.dig('street'), city: response.dig('city') }
30
30
  else
31
- query = autocomplete [postcode, house_number].join(' ')
31
+ query = autocomplete("#{postcode} #{house_number}", lang)
32
32
  context = query['matches'][0].dig('context')
33
33
  if context
34
34
  response = details(context)
35
- return { street: response.dig('address').dig('street'), city: response.dig('address').dig('locality')}
35
+ return { street: response.dig('address')&.dig('street'), city: response.dig('address')&.dig('locality')}
36
36
  end
37
37
  end
38
38
  end
@@ -1,3 +1,3 @@
1
1
  module InternationalPostcodeApi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: international_postcode_api
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
  - Dennis de Vulder
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-23 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2021-03-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: A ruby wrapper for the api.postcode.eu endpoints.
14
28
  email:
15
29
  - dennisdevulder@gmail.com