abn_lookup 0.2.2 → 0.2.3

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
  SHA256:
3
- metadata.gz: 2433d9b12d5cabd5307e7232ec143f466c0e5113e23ed588e9ccc66ccc5ccfe3
4
- data.tar.gz: 873a9755fc6cbb0d3f0085e59f66896fd3fdc28a1d22b2c1ddb00894bbdd4a05
3
+ metadata.gz: 16decb392208f999b3723e09636178b22b321a748c898ff99a527c92acdffcf4
4
+ data.tar.gz: 4b1026420192d43e40322deb6b6d6364885cc37600b684036966b229fec5383d
5
5
  SHA512:
6
- metadata.gz: fd2a23982b225238acafe47f68d220e0bbc004205e5dc4e828e9389325d87376753b1f6069e813a82e1f6dae1456be9e6319590a0e50ee7b70435ebc9d2cb091
7
- data.tar.gz: 18f28222b17398787ce99cf2765e0f67cff0429160cb9cac853b8e6fdf73f8ce1c561a9e3f71a27ec56d2cc6fcd873a0e349379cc765a46547d257e26217ac5a
6
+ metadata.gz: a76b10768152aab4128cec7ebbbd660bda45ba8943cad6d7f64f60e5a7258e8edf27352b805a964098b2cf9a577444ff9e3d1e47a5728beeaf4c748eb21c2c0f
7
+ data.tar.gz: 1731b48946798a19b11b9ecd77d5784df31e0bfbd9d663dd6f8b2f2cadc555505731696093f5be2d1e368edfe318cd250be7fcae6288cfb62ca3048123781ec8
@@ -5,17 +5,18 @@ module AbnLookup
5
5
  class << self
6
6
  attr_accessor :stubs, :default_stub
7
7
 
8
- def fetch(abn)
8
+ def fetch(abn, options = {})
9
9
  stub = stubs[abn] || default_stub
10
10
  return stub if stub
11
11
 
12
+ parse = options.fetch(:parse, true)
12
13
  response = AbnLookup.connection.get("AbnDetails.aspx?abn=#{abn.gsub(/\s/, '')}")
13
14
  body = response.body
14
15
 
15
16
  raise InvalidGuidError if body["Message"] == "The GUID entered is not recognised as a Registered Party"
16
- raise AbnNotFoundError if body["Abn"].empty?
17
+ raise AbnNotFoundError if body["Abn"].empty? || body["Message"] == "No record found"
17
18
 
18
- Abn.parse(body)
19
+ parse ? Abn.parse(body) : body
19
20
  end
20
21
  end
21
22
 
@@ -5,17 +5,18 @@ module AbnLookup
5
5
  class << self
6
6
  attr_accessor :stubs, :default_stub
7
7
 
8
- def fetch(acn)
8
+ def fetch(acn, options = {})
9
9
  stub = stubs[acn] || default_stub
10
10
  return stub if stub
11
11
 
12
+ parse = options.fetch(:parse, true)
12
13
  response = AbnLookup.connection.get("AcnDetails.aspx?acn=#{acn.gsub(/\s/, '')}")
13
14
  body = response.body
14
15
 
15
16
  raise InvalidGuidError if body["Message"] == "The GUID entered is not recognised as a Registered Party"
16
- raise AbnNotFoundError if body["Abn"].empty?
17
+ raise AbnNotFoundError if body["Abn"].empty? || body["Message"] == "No record found"
17
18
 
18
- Abn.parse(body)
19
+ parse ? Abn.parse(body) : body
19
20
  end
20
21
  end
21
22
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AbnLookup
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.3"
5
5
  end
data/lib/abn_lookup.rb CHANGED
@@ -26,11 +26,11 @@ module AbnLookup
26
26
 
27
27
  def_delegators :@config, :guid, :guid=
28
28
 
29
- def search_by_abn(abn)
30
- SearchByAbn.fetch(abn)
29
+ def search_by_abn(abn, options = {})
30
+ SearchByAbn.fetch(abn, options)
31
31
  end
32
32
 
33
- def search_by_acn(acn)
33
+ def search_by_acn(acn, options = {})
34
34
  SearchByAcn.fetch(acn)
35
35
  end
36
36
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abn_lookup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lairton Mendes
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-03 00:00:00.000000000 Z
11
+ date: 2024-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday