ofx_for_ruby 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -113,7 +113,7 @@ module OFX
113
113
  body << " <ACCTID>#{account_identifier}"
114
114
  body << " <ACCTTYPE>#{BankingAccount.account_type_to_ofx_102_s(account_type)}"
115
115
  body << " <ACCTKEY>#{account_key}" if account_key
116
- body << " </BANKACCTFROM>"
116
+ body << " </BANKACCTFROM>\n"
117
117
  body.join("\n")
118
118
  end
119
119
 
@@ -30,14 +30,14 @@ module OFX
30
30
  def send(ofx_body)
31
31
  http_request = Net::HTTP::Post.new(@ofx_uri.request_uri)
32
32
 
33
- http_request['User-Agent'] = 'OFX for Ruby 0.0.1.0'
33
+ http_request['User-Agent'] = "OFX for Ruby #{OFX::VERSION.to_dotted_s}"
34
34
  http_request['Content-Type'] = 'application/x-ofx'
35
35
  http_request['Accept'] = "*/*, application/x-ofx"
36
36
  http_request['Content-Length'] = ofx_body.length.to_s
37
37
 
38
38
  http_request.body = ofx_body.gsub("\n", "\r\n")
39
39
 
40
- #print_request http_request
40
+ # print_request http_request
41
41
 
42
42
  http = Net::HTTP.new(@ofx_uri.host, @ofx_uri.port)
43
43
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
data/lib/ofx/version.rb CHANGED
@@ -21,21 +21,25 @@ module OFX
21
21
 
22
22
  def initialize(version)
23
23
  @version = [0, 0, 0]
24
-
25
- version = version.to_a if version.kind_of?(Version)
26
-
27
- @version[0] = version if version.kind_of?(Integer)
28
- return unless version.respond_to?(:length)
29
-
30
- @version[0] = version[0..0].to_s.to_i if (version.length >= 1)
31
-
32
- if (version.length == 3)
33
- @version[1] = version[1..1].to_s.to_i
34
- @version[2] = version[2..2].to_s.to_i
35
- elsif (version.length == 5)
36
- @version[1] = version[2..2].to_s.to_i
37
- @version[2] = version[4..4].to_s.to_i
24
+
25
+ return if version.nil?
26
+
27
+ parts = case version
28
+ when Version
29
+ version.to_a
30
+ when Integer
31
+ [version, 0, 0]
32
+ when Array
33
+ version
34
+ when /\./
35
+ version.split(".")
36
+ else
37
+ [version[0..0], version[1..1], version[2..2]]
38
38
  end
39
+
40
+ @version[0] = parts[0].to_i
41
+ @version[1] = parts[1].to_i
42
+ @version[2] = parts[2].to_i
39
43
  end
40
44
 
41
45
  def major
@@ -78,5 +82,5 @@ module OFX
78
82
  end
79
83
  end
80
84
 
81
- VERSION = Version.new('0.1.1')
85
+ VERSION = Version.new('0.1.2')
82
86
  end
@@ -15,7 +15,7 @@
15
15
  # You should have received a copy of the GNU General Public License
16
16
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
- require File.dirname(__FILE__) + '/test_helper'
18
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
19
19
 
20
20
  class OFXVersionTest < Test::Unit::TestCase
21
21
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ofx_for_ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Guidry
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-02 00:00:00 -05:00
18
+ date: 2011-01-16 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency