anz_bank_client 0.1.1 → 0.1.2

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: c6bda86e04ac9e4f972bd220896ed3b153e090c0c9c07a90da02fbac2a478a78
4
- data.tar.gz: 1a068361988675e5e211e3b93b608f3b0a7dd63f44f8ee9d64b5cecb278ba575
3
+ metadata.gz: c15b49548ec220f8db3dd750e6d4de206d501aa3c8b74848c541534174f1c435
4
+ data.tar.gz: a68aad4abcf6e137b9a796e017a7ecc683da9f0bfd2451a068930a061ff3caf2
5
5
  SHA512:
6
- metadata.gz: 807b91ec4851c8aa8c82ad9b9b17d0db013be7cbfb6a5935e4173d2cd1939284f7fe5f3d42eb8eb3add90988d0de1fc52072badabcac630e635fc6e180b828d9
7
- data.tar.gz: 9fa8ab3bb45e89bba0d75cc533c9c6a2ae0434db79f9d9333bec24bb5987af4bbf34fa3afb3b5e4994b8aa0481eaf3ae82db21b35f9065cfc980238f91dbcd06
6
+ metadata.gz: c2a6b555a62d4832da6747f08d4ea5ca9c37f18bc6e2986953b10cf6e9a6f362d1b0d62b7b6f30c97f773c28dbc549dfbc72ca587a3713303a4751674d814711
7
+ data.tar.gz: 59f0984b3b1878bc5bd19877df6f60988915dac48dece351c9a824fcd19c214bf4d457438563669f0efdb4ab07158f5592b920f32045a4ff306e7bc85bef3388
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- anz_bank_client (0.1.1)
4
+ anz_bank_client (0.1.2)
5
5
  faraday (~> 2.7)
6
6
  faraday-cookie_jar (~> 0.0.7)
7
7
  faraday-follow_redirects (~> 0.3.0)
data/exe/anzcli CHANGED
@@ -28,7 +28,7 @@ class AnzCli < Thor
28
28
  @session.login(ENV["ANZ_CUSTOMER_NO"], ENV["ANZ_PASSWORD"])
29
29
  else
30
30
  print "Customer number: "
31
- customer_no = gets.chomp
31
+ customer_no = $stdin.gets.chomp
32
32
  print "Password: "
33
33
  password = $stdin.noecho(&:gets).chomp
34
34
  @session.login(customer_no, password)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AnzBankClient
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
@@ -9,6 +9,7 @@ require_relative "anz_bank_client/version"
9
9
  require "faraday"
10
10
  require "faraday-cookie_jar"
11
11
  require "faraday/follow_redirects"
12
+ require "base64"
12
13
 
13
14
  module AnzBankClient
14
15
  class Error < StandardError; end
@@ -145,8 +146,12 @@ module AnzBankClient
145
146
  # @param end_date in iso8601 format
146
147
  def list_transactions(account_no, start_date, end_date)
147
148
  @logger.info "Getting transactions for account #{account_no} from #{start_date} to #{end_date}"
148
- account_uuid = @initialise_response["viewableAccounts"]
149
- .find { |account| account["accountNo"] == account_no }["accountUuid"]
149
+ account_obj = @initialise_response["viewableAccounts"]
150
+ .find { |account| account["accountNo"] == account_no }
151
+ if account_obj.nil?
152
+ raise "Could not find account #{account_no}"
153
+ end
154
+ account_uuid = account_obj["accountUuid"]
150
155
  raise "Could not find account #{account_no}" unless account_uuid
151
156
 
152
157
  response = @client.get("https://secure.anz.co.nz/IBCS/service/api/transactions?account=#{account_uuid}&ascending=false&from=#{start_date}&order=postdate&to=#{end_date}")
@@ -200,7 +205,7 @@ module AnzBankClient
200
205
  encrypted_password = public_key.public_encrypt(password, OpenSSL::PKey::RSA::PKCS1_PADDING)
201
206
 
202
207
  # Encode the encrypted message with base64
203
- Base64.encode64(encrypted_password).gsub("\n", "")
208
+ ::Base64.encode64(encrypted_password).gsub("\n", "")
204
209
  end
205
210
  end
206
211
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anz_bank_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Dewar