ofx_ruby 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,15 +1,23 @@
1
- # OfxRuby
1
+ [coin]:https://raw.githubusercontent.com/bigfatgreg/ofx_ruby/master/doc/img/coin.gif
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ofx_ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Code Climate](https://codeclimate.com/repos/5817e08271a9496d910040e2/badges/aa4aa26c5907d13625de/gpa.svg)](https://codeclimate.com/repos/5817e08271a9496d910040e2/feed)
4
+ [![Issue Count](https://codeclimate.com/repos/5817e08271a9496d910040e2/badges/aa4aa26c5907d13625de/issue_count.svg)](https://codeclimate.com/repos/5817e08271a9496d910040e2/feed)
5
+ [![Test Coverage](https://codeclimate.com/repos/5817e08271a9496d910040e2/badges/aa4aa26c5907d13625de/coverage.svg)](https://codeclimate.com/repos/5817e08271a9496d910040e2/coverage)
6
+ [![Build Status](https://drone.graveflex.com/api/badges/bigfatgreg/ofx_ruby/status.svg)](https://drone.graveflex.com/bigfatgreg/ofx_ruby)
4
7
 
5
- TODO: Delete this and the text above, and describe your gem
8
+   
9
+
10
+ ![coin]
11
+
12
+ #OFX
13
+ WIP ofx gem built for my rather specific needs.
6
14
 
7
15
  ## Installation
8
16
 
9
17
  Add this line to your application's Gemfile:
10
18
 
11
19
  ```ruby
12
- gem 'ofx_ruby'
20
+ gem 'ofx_ruby', require: 'ofx'
13
21
  ```
14
22
 
15
23
  And then execute:
@@ -20,9 +28,9 @@ Or install it yourself as:
20
28
 
21
29
  $ gem install ofx_ruby
22
30
 
23
- ## Usage
31
+ ## Use
24
32
 
25
- TODO: Write usage instructions here
33
+ Take a look at the tests for usage examples.
26
34
 
27
35
  ## Development
28
36
 
@@ -32,7 +40,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
40
 
33
41
  ## Contributing
34
42
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ofx_ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bigfatgreg/ofx_ruby. Pull requests must have tests. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
36
44
 
37
45
 
38
46
  ## License
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
+ require "dotenv"
4
+ Dotenv.load
3
5
 
4
6
  Rake::TestTask.new(:test) do |t|
5
7
  t.libs << "test"
@@ -8,3 +10,18 @@ Rake::TestTask.new(:test) do |t|
8
10
  end
9
11
 
10
12
  task :default => :test
13
+
14
+ namespace :drone do
15
+ desc 'Generate the encrypted drone secrets file.'
16
+ task :sec do
17
+ `DRONE_SERVER=#{ENV['DRONE_SERVER']} DRONE_TOKEN=#{ENV['DRONE_TOKEN']} \
18
+ drone secure --in .drone.sec.yml --repo #{ENV['DRONE_REPO']}`
19
+
20
+ puts 'generated .drone.sec.yml!'
21
+ end
22
+
23
+ desc 'Run the drone build locally'
24
+ task :test do
25
+ `drone exec -E .drone.sec.yml --trusted --debug --notify 2>&1`
26
+ end
27
+ end
data/doc/img/coin.gif ADDED
Binary file
data/lib/ofx/document.rb CHANGED
@@ -5,17 +5,17 @@ module OFX
5
5
  attr_reader :uri
6
6
 
7
7
  def initialize(options = {})
8
- @user = options[:user] || ENV['OFX_USER']
9
- @password = options[:password] || ENV['OFX_PASSWORD']
10
- @uri = options[:uri] || ENV['OFX_URI']
11
- @fi_org = options[:fi_org] || ENV['OFX_FI_ORG']
12
- @fi_fid = options[:fi_fid] || ENV['OFX_FI_FID']
13
- @routing = options[:routing] || ENV['OFX_ROUTING']
14
- @account = options[:account] || ENV['OFX_ACCOUNT']
15
- @app_id = options[:app_id] || ENV['OFX_APP_ID']
16
- @app_ver = options[:app_ver] || ENV['OFX_APP_VER']
17
8
  @start = options[:start] || (Date.today - 30)
18
9
  @end = options[:end] || Date.today
10
+ @uri = options[:uri]
11
+ @user = options[:user]
12
+ @password = options[:password]
13
+ @routing = options[:routing]
14
+ @account = options[:account]
15
+ @fi_org = options[:fi_org]
16
+ @fi_fid = options[:fi_fid]
17
+ @app_id = options[:app_id]
18
+ @app_ver = options[:app_ver]
19
19
  super
20
20
  end
21
21
 
@@ -54,39 +54,39 @@ module OFX
54
54
  end
55
55
 
56
56
  def user
57
- @user || (raise Errors::UserMissing)
57
+ @user || ENV['OFX_USER'] || (raise Errors::UserMissing)
58
58
  end
59
-
59
+
60
60
  def password
61
- @password || (raise Errors::PasswordMissing)
61
+ @password || ENV['OFX_PASSWORD'] || (raise Errors::PasswordMissing)
62
62
  end
63
-
63
+
64
64
  def fi_org
65
- @fi_org || (raise Errors::FiOrgMissing)
65
+ @fi_org || ENV['OFX_FI_ORG'] || (raise Errors::FiOrgMissing)
66
66
  end
67
-
67
+
68
68
  def fi_fid
69
- @fi_fid || (raise Errors::FiFidMissing)
69
+ @fi_fid || ENV['OFX_FI_FID'] || (raise Errors::FiFidMissing)
70
70
  end
71
-
71
+
72
72
  def routing
73
- @routing || (raise Errors::RoutingMissing)
73
+ @routing || ENV['OFX_ROUTING'] || (raise Errors::RoutingMissing)
74
74
  end
75
-
75
+
76
76
  def account
77
- @account || (raise Errors::AccountMissing)
77
+ @account || ENV['OFX_ACCOUNT'] || (raise Errors::AccountMissing)
78
78
  end
79
-
79
+
80
80
  def app_id
81
- @app_id || (raise Errors::AppIdMissing)
81
+ @app_id || ENV['OFX_APP_ID'] || (raise Errors::AppIdMissing)
82
82
  end
83
-
83
+
84
84
  def app_ver
85
- @app_ver || (raise Errors::AppVerMissing)
85
+ @app_ver || ENV['OFX_APP_VER'] || (raise Errors::AppVerMissing)
86
86
  end
87
-
87
+
88
88
  def uri
89
- @uri || (raise Errors::URIMissing)
89
+ @uri || ENV['OFX_URI'] || (raise Errors::URIMissing)
90
90
  end
91
91
 
92
92
  def http
@@ -3,8 +3,8 @@ module OFX
3
3
  class Document
4
4
  class BankAccount < StatementRequest
5
5
  def initialize(options = {})
6
- @routing = options[:routing] || (raise Errors::RoutingNumberMissing)
7
- @account = options[:account] || (raise Errors::AccountNumberMissing)
6
+ @routing = options[:routing] || (raise Errors::RoutingMissing)
7
+ @account = options[:account] || (raise Errors::AccountMissing)
8
8
  @type = account_type(options[:type] || :checking)
9
9
  super
10
10
  end
data/lib/ofx/errors.rb CHANGED
@@ -76,20 +76,6 @@ module OFX
76
76
  end
77
77
  end
78
78
 
79
- class RoutingNumberMissing < Errors
80
- def message
81
- 'You must specify the routing number for ' \
82
- 'your account in the options hash or ' \
83
- 'set OFX_URI as an environment.'
84
- end
85
- end
86
-
87
- class AccountNumberMissing < Errors
88
- def message
89
- 'You must specify the account number in the options hash.'
90
- end
91
- end
92
-
93
79
  class AccountTypeNotAvailable < Errors
94
80
  def message
95
81
  "The account type #{@account_type} is not available. " \
data/lib/ofx/handler.rb CHANGED
@@ -31,7 +31,7 @@ module OFX
31
31
  case name
32
32
  when :STMTTRN
33
33
  @parser.output[:transactions] = [] unless @parser.output[:transactions]
34
- @parser.output[:transactions].push(transaction(@transaction))
34
+ @parser.output[:transactions].push(transaction)
35
35
  when :LEDGERBAL
36
36
  @parser.output[:balance] = @balance[:BALAMT]
37
37
  when :AVAILBAL
@@ -41,7 +41,7 @@ module OFX
41
41
 
42
42
  protected
43
43
 
44
- def transaction(hash)
44
+ def transaction
45
45
  { type: @transaction[:TRNTYPE], posted: @transaction[:DTPOSTED],
46
46
  amount: @transaction[:TRNAMT], fitid: @transaction[:FITID],
47
47
  name: @transaction[:NAME] }
data/lib/ofx/http.rb CHANGED
@@ -13,8 +13,8 @@ module OFX
13
13
 
14
14
  def headers
15
15
  {
16
- 'Content-Type': 'application/x-ofx',
17
- 'Accept': '*/*, application/x-ofx'
16
+ 'Content-Type' => 'application/x-ofx',
17
+ 'Accept'=> '*/*, application/x-ofx'
18
18
  }
19
19
  end
20
20
 
data/lib/ofx/parser.rb CHANGED
@@ -4,7 +4,7 @@ module OFX
4
4
  attr_reader :body
5
5
  attr_accessor :output
6
6
 
7
- def initialize(body, options = {})
7
+ def initialize(body)
8
8
  @body = body
9
9
  @output = {}
10
10
  dump
data/lib/ofx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module OFX
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
data/ofx_ruby.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'ofx'
4
+ require 'ofx/version'
5
5
 
6
6
  Gem::Specification.new do |g|
7
7
  g.name = "ofx_ruby"
@@ -22,6 +22,8 @@ Gem::Specification.new do |g|
22
22
  g.add_development_dependency "guard-minitest", "~> 2.4.5"
23
23
  g.add_development_dependency "dotenv", "~> 2.1.1"
24
24
  g.add_development_dependency "byebug", "~> 9.0.5"
25
+ g.add_development_dependency "codeclimate-test-reporter", "~> 0.4.8"
26
+ g.add_development_dependency "simplecov"
25
27
 
26
28
  g.required_ruby_version = ">= 2.3"
27
29
  g.add_dependency "ox", "~> 2.4"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ofx_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - rob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-30 00:00:00.000000000 Z
11
+ date: 2016-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,6 +122,34 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 9.0.5
125
+ - !ruby/object:Gem::Dependency
126
+ name: codeclimate-test-reporter
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.4.8
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.4.8
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
125
153
  - !ruby/object:Gem::Dependency
126
154
  name: ox
127
155
  requirement: !ruby/object:Gem::Requirement
@@ -143,8 +171,11 @@ executables: []
143
171
  extensions: []
144
172
  extra_rdoc_files: []
145
173
  files:
174
+ - ".codeclimate.yml"
175
+ - ".drone.sec"
176
+ - ".drone.yml"
146
177
  - ".gitignore"
147
- - ".travis.yml"
178
+ - ".rubocop.yml"
148
179
  - CODE_OF_CONDUCT.md
149
180
  - Gemfile
150
181
  - Guardfile
@@ -153,6 +184,7 @@ files:
153
184
  - Rakefile
154
185
  - bin/console
155
186
  - bin/setup
187
+ - doc/img/coin.gif
156
188
  - lib/ofx.rb
157
189
  - lib/ofx/aggregate.rb
158
190
  - lib/ofx/document.rb
@@ -190,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
222
  version: '0'
191
223
  requirements: []
192
224
  rubyforge_project:
193
- rubygems_version: 2.5.1
225
+ rubygems_version: 2.6.8
194
226
  signing_key:
195
227
  specification_version: 4
196
228
  summary: A simple, incomplete OFX gem for Ruby.
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.4
4
- before_install: gem install bundler -v 1.10.6