wire_transfer 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: 6b11dc311dee32cd77c39ecfc4e759fe3a14be29
4
- data.tar.gz: 04d79f04104eb4c977d5419bbd255692f4ad0fc9
3
+ metadata.gz: 5ef8d0d72b82534d64e3ecba6d564e5155050670
4
+ data.tar.gz: 50a021fcdc17ec6d70160598d0dc66d4966b5a8a
5
5
  SHA512:
6
- metadata.gz: 921257f327ae656aa4173512f26e3e674400b4417cff4dd268ce77f87ccb2d78532e72949e56626d3f3271711c28e9ff04796862d2399ba9ed0814498eb4332e
7
- data.tar.gz: 8f22cb93bd3f27c8243ae32e9829fa5e48583c64a59d84450eacbceb9600930642e8db1bc75088f02165da0c331be6f0778bcb65abd779572214ceaa9aadcf66
6
+ metadata.gz: 5ba473c99aebbef74626c0bf48b362a5e78ab6635c41ff816cb5874a0072d22c7573fb7add7bba67decde33f0236a8105ed11c77b10c667ba6f71b13e703a502
7
+ data.tar.gz: cad4d76c830a3cf9e5416c234cd3c4ef6d126ad3ffbc422488bffb0e91c4da26630d8532ced500561fdc568a523dc1dfe7f9237510c855f1a7d199c1351288f7
@@ -1,5 +1,21 @@
1
+ # Version
1
2
  require "wire_transfer/version"
3
+
4
+ # Resources
2
5
  require "wire_transfer/structured_communication"
3
6
 
7
+ # Helpers
8
+ require "wire_transfer/helper"
9
+
10
+ # Errors
11
+ require "wire_transfer/invalid_number_error"
12
+
4
13
  module WireTransfer
14
+ def self.generate_structured_communication(reference)
15
+ StructuredCommunication.compute(reference)
16
+ end
17
+ end
18
+
19
+ ActiveSupport.on_load(:action_view) do
20
+ include WireTransfer::Helper
5
21
  end
@@ -0,0 +1,7 @@
1
+ module WireTransfer
2
+ module Helper
3
+ def structured_communication(number)
4
+ StructuredCommunication.new(number).to_s
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ module WireTransfer
2
+ class InvalidNumberError < StandardError
3
+ end
4
+ end
@@ -2,6 +2,7 @@ module WireTransfer
2
2
  class StructuredCommunication
3
3
  def initialize number
4
4
  @number = number.to_s
5
+ raise InvalidNumberError unless @number.match(/\A\d{12}\z/)
5
6
  end
6
7
 
7
8
  # Take a reference number and pad it with a certain amount of zeros
@@ -1,3 +1,3 @@
1
1
  module WireTransfer
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wire_transfer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Romain Gérard
@@ -52,6 +52,8 @@ files:
52
52
  - README.md
53
53
  - Rakefile
54
54
  - lib/wire_transfer.rb
55
+ - lib/wire_transfer/helper.rb
56
+ - lib/wire_transfer/invalid_number_error.rb
55
57
  - lib/wire_transfer/structured_communication.rb
56
58
  - lib/wire_transfer/version.rb
57
59
  - wire_transfer.gemspec