rsr_group 2.2.1 → 2.3.0

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: a8b2ec538c829b5cdd5337c4daff8498ff5a68f8
4
- data.tar.gz: 7ca678d75d29821fc5c3d667a57b453d26107d54
3
+ metadata.gz: 6f09fece5c75d3d9d1304a2d8fbc7d4c60eb2b0c
4
+ data.tar.gz: 9f0d50ae67fd3b89d4c3bd20293ab05a4d63e111
5
5
  SHA512:
6
- metadata.gz: 675917f7dd8813979a9f744cd87f27112c2f8f2073c4d5a0a909cb34c187d880ff4e52049d2ff9f9c20c8c862de6af6e7c349f2962637dfe216d64d2b29045e5
7
- data.tar.gz: 246c0795dcca757b3171759cabf30092c4a78fe64a4aaad45fedbfd4e471cdd7c0a1ef6c67d4f5e1249e57b571312229da495aa63f087e18c44a89fd8afc5278
6
+ metadata.gz: 477a47be32795c951af6483f39a2c814ea35b8bfcf3736fdb7bd1338f1e96819aa4eb87c0739b30d60f24f1ebe6e288f8e95a19bb4de241b5c0d4d39a358fb09
7
+ data.tar.gz: 661cce484e55dd430d658952a8275408fa347ac25455e370c6e80f24e10815d8c7297cb0e77a08e2785d87961d65d7877df9876f10095614dd55aebc4ecf393d
@@ -1,9 +1,8 @@
1
1
  module RsrGroup
2
2
  class ResponseFile < Base
3
3
 
4
- attr_reader :content
5
4
  attr_reader :filename
6
- attr_reader :timestamp
5
+ attr_accessor :content, :mtime
7
6
 
8
7
  def initialize(options = {})
9
8
  requires!(options, :username, :password, :filename)
@@ -17,6 +16,26 @@ module RsrGroup
17
16
  define_method("#{value.downcase}?".to_sym) do
18
17
  response_type == value
19
18
  end
19
+ end
20
+
21
+ def self.get_each(options = {}, &block)
22
+ requires!(options, :username, :password)
23
+
24
+ Base.connect(options) do |ftp|
25
+ ftp.chdir(RsrGroup.config.response_dir)
26
+
27
+ @list = ftp.nlst("*.txt")
28
+ @list.each do |file|
29
+ resource = new(options.merge(filename: file))
30
+ resource.content = ftp.gettextfile(file, nil)
31
+ resource.mtime = ftp.mtime(file)
32
+ yield(resource)
33
+ end
34
+
35
+ ftp.close
36
+ end
37
+
38
+ @list
20
39
  end
21
40
 
22
41
  def self.all(options = {})
@@ -35,8 +54,8 @@ module RsrGroup
35
54
  return @content if @content
36
55
  connect(@credentials) do |ftp|
37
56
  ftp.chdir(RsrGroup.config.response_dir)
38
- # @timestamp = ftp.mtime(@filename)
39
- @content = ftp.gettextfile(@filename, nil)
57
+ @mtime = ftp.mtime(@filename)
58
+ @content = ftp.gettextfile(@filename, nil)
40
59
  ftp.close
41
60
  end
42
61
  end
@@ -55,9 +74,11 @@ module RsrGroup
55
74
 
56
75
  @json = {
57
76
  response_type: response_type,
58
- identifier: @content.lines[1].split(";")[0],
59
77
  filename: @filename,
60
78
  account_number: @account_number,
79
+ rsr_order_number: nil,
80
+ details: [],
81
+ errors: [],
61
82
  }
62
83
 
63
84
  return parse_eerr if error?
@@ -94,7 +115,6 @@ module RsrGroup
94
115
  end.compact
95
116
 
96
117
  @json.merge!({
97
- rsr_order_number: @content.lines[0].split(";")[3].chomp,
98
118
  details: details
99
119
  })
100
120
  end
@@ -1,3 +1,3 @@
1
1
  module RsrGroup
2
- VERSION = '2.2.1'.freeze
2
+ VERSION = '2.3.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsr_group
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Campbell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-10 00:00:00.000000000 Z
11
+ date: 2018-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: smarter_csv
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  requirements: []
137
137
  rubyforge_project:
138
- rubygems_version: 2.5.1
138
+ rubygems_version: 2.6.12
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: RSR Group Ruby library