swifty 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +5 -5
  2. data/lib/swifty.rb +12 -69
  3. metadata +20 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f88bce0f7ad71b6583b4717728616180c19d1166
4
- data.tar.gz: 3d6621155140d386832c8e3dc9c61af1c695056d
2
+ SHA256:
3
+ metadata.gz: 3beb3e3fc5ab4f4be270b6455adfc5679e21a96f5f3431e006560af47c282560
4
+ data.tar.gz: 3a4de3f1edbec7a7aad288f75333650486437daf50650b4112c0e83c3d8c34dc
5
5
  SHA512:
6
- metadata.gz: 87d9d995683a77ff021c754a70a311046c139d6da56188e664842f952202e5e74c10614f120476e3302538d761656ce93c0892512270c97aed1f6c455dbd71ac
7
- data.tar.gz: f340f9e4e5f1d9c1075297c6d956498a1a9bc22962ba130ecfcc1c5ac77234ac380cb0543bc61c05494437de14a22c34a39554402ecb0ef4df283928a275bc17
6
+ metadata.gz: ae901ac2fec440239e5dbaa3ec0af48d03e8a3f5e50596e0bb9a932a4babe968c55ddacb829ca3c3c2cd49f743927ea1d15546cd11ea568056328b7ed9c75f8b
7
+ data.tar.gz: c26addc74def93429bb50b5d4924d63e9d64fbe9cf34ddfb27fe2b8a1bdb8738e5d0433c8365e2e702f4c28027bf426abc3c4e18b3a6a13ba12d43d30150598a
@@ -1,76 +1,19 @@
1
+ require 'bundler/setup'
2
+ Bundler.setup
3
+
1
4
  require 'active_support/all'
2
5
  require 'cmxl'
3
- require 'choice'
4
- require 'pp'
5
- require 'yaml'
6
-
7
- Cmxl.config[:statement_separator] = /-\}/m
8
- Cmxl.config[:raise_line_format_errors] = true
9
-
10
- module Cmxl
11
- # Field parser to handle the header field.
12
- class HeaderFieldParser < Cmxl::Field
13
- self.tag = 1
14
6
 
15
- # Parses the line into two groups: (1) basic_header and (2) application_header
16
- self.parser = /1:(?<basic_header>([^}]+))}{2:(?<application_header>([^}]+))/
17
- end
7
+ require 'statements'
8
+ require 'export_info'
9
+ require 'import_info'
10
+ require 'meta_info'
18
11
 
19
- class Field
20
- # Override for https://github.com/railslove/cmxl/blob/master/lib/cmxl/field.rb#L46-L53
21
- #
22
- # This ensures that we can parse the header (field 1, 2, and 3) in the SWIFT messages. See the example.swift.txt for
23
- # an example.
24
- #
25
- # See also http://ibm.co/1K0zURs
26
- def self.parse(line)
27
- if line.match(/^:(\d{2,2})(\w)?:(.*)$/)
28
- tag, modifier, content = $1, $2, $3
29
- Field.parsers[tag.to_s].new(content, modifier, tag)
30
- elsif line.match Regexp.new('\d:([^}]+)') # Header
31
- basic_header, application_header = $1, $2
32
- Field.parsers['1'].new(basic_header, application_header, '1')
33
- else
34
- raise LineFormatError, "Wrong line format: #{line.dump}" if Cmxl.config[:raise_line_format_errors]
35
- end
36
- end
37
- end
38
- end
12
+ require 'types/base'
13
+ require 'types/mt940'
39
14
 
40
15
  module Swifty
41
- class Parser
42
- attr_reader :content, :options, :statement
43
-
44
- def initialize(content, **options)
45
- content = File.read(content) if File.exists?(content)
46
- @options = options
47
- @content = content.is_a?(File) ? content.read : content
48
- @statement ||= Cmxl.parse(content, encoding: options[:encoding]).first
49
- end
50
-
51
- def to_hash
52
- statement.to_hash
53
- end
54
-
55
- def to_yaml
56
- to_hash.to_yaml
57
- end
58
- alias_method :to_yml, :to_yaml
59
-
60
- def save(file)
61
- File.open(file, 'w+') { |f| f.write to_yaml }
62
- to_hash
63
- end
64
-
65
- private
66
-
67
- def method_missing(name, *args)
68
- return statement.send(name, *args)
69
- end
70
- end
71
-
72
- def new(*args)
73
- Parser.new(*args)
74
- end
75
- module_function :new
16
+ BaseError = Class.new(StandardError)
17
+ IncorrectType = Class.new(StandardError)
18
+ IncorrectFile = Class.new(StandardError)
76
19
  end
metadata CHANGED
@@ -1,79 +1,65 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swifty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Kampp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-03 00:00:00.000000000 Z
11
+ date: 2018-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.2'
27
27
  - !ruby/object:Gem::Dependency
28
- name: highline
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '='
32
- - !ruby/object:Gem::Version
33
- version: 1.7.3
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '='
39
- - !ruby/object:Gem::Version
40
- version: 1.7.3
41
- - !ruby/object:Gem::Dependency
42
- name: choices
28
+ name: cmxl
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - '='
31
+ - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: 0.4.0
33
+ version: '0.1'
48
34
  type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - '='
38
+ - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: 0.4.0
40
+ version: '0.1'
55
41
  - !ruby/object:Gem::Dependency
56
- name: cmxl
42
+ name: rspec
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - "~>"
60
46
  - !ruby/object:Gem::Version
61
- version: '0.1'
62
- type: :runtime
47
+ version: '3.3'
48
+ type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: '0.1'
69
- description: A customized swift parser, able to handle several different banks.
70
- email: emk@inpay.com
54
+ version: '3.3'
55
+ description: Supports simple extension for customization of SWIFT message parsing.
56
+ email: emil@kampp.me
71
57
  executables: []
72
58
  extensions: []
73
59
  extra_rdoc_files: []
74
60
  files:
75
61
  - lib/swifty.rb
76
- homepage: https://github.com/Inpay-Services/swifty
62
+ homepage: https://github.com/ekampp/swifty
77
63
  licenses:
78
64
  - MIT
79
65
  metadata: {}
@@ -83,9 +69,9 @@ require_paths:
83
69
  - lib
84
70
  required_ruby_version: !ruby/object:Gem::Requirement
85
71
  requirements:
86
- - - ">="
72
+ - - "~>"
87
73
  - !ruby/object:Gem::Version
88
- version: '0'
74
+ version: '2.2'
89
75
  required_rubygems_version: !ruby/object:Gem::Requirement
90
76
  requirements:
91
77
  - - ">="
@@ -93,8 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
79
  version: '0'
94
80
  requirements: []
95
81
  rubyforge_project:
96
- rubygems_version: 2.4.8
82
+ rubygems_version: 2.7.7
97
83
  signing_key:
98
84
  specification_version: 4
99
- summary: A small swift message parser
85
+ summary: Simple parsing of SWIFT messages
100
86
  test_files: []