abn_lookup 0.2.2 → 0.2.3
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 +4 -4
- data/lib/abn_lookup/search_by_abn.rb +4 -3
- data/lib/abn_lookup/search_by_acn.rb +4 -3
- data/lib/abn_lookup/version.rb +1 -1
- data/lib/abn_lookup.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16decb392208f999b3723e09636178b22b321a748c898ff99a527c92acdffcf4
|
4
|
+
data.tar.gz: 4b1026420192d43e40322deb6b6d6364885cc37600b684036966b229fec5383d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/abn_lookup/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2024-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|