alexmchale-commerce-bank-client 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ attic
2
+ pkg
@@ -1,4 +1,4 @@
1
1
  ---
2
- :minor: 9
3
- :major: 0
4
2
  :patch: 0
3
+ :minor: 10
4
+ :major: 0
@@ -0,0 +1,46 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{commerce-bank-client}
5
+ s.version = "0.10.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Alex McHale"]
9
+ s.date = %q{2009-08-20}
10
+ s.email = %q{alexmchale@gmail.com}
11
+ s.extra_rdoc_files = [
12
+ "README.markdown"
13
+ ]
14
+ s.files = [
15
+ ".gitignore",
16
+ "README.markdown",
17
+ "Rakefile",
18
+ "VERSION.yml",
19
+ "commerce-bank-client.gemspec",
20
+ "lib/commercebank.rb",
21
+ "lib/commercebank/monkey.rb",
22
+ "test/commerce_bank_client_test.rb",
23
+ "test/monkeypatch_test.rb",
24
+ "test/test_helper.rb"
25
+ ]
26
+ s.homepage = %q{http://github.com/alexmchale/commerce-bank-client}
27
+ s.rdoc_options = ["--charset=UTF-8"]
28
+ s.require_paths = ["lib"]
29
+ s.rubygems_version = %q{1.3.4}
30
+ s.summary = %q{CBC is a client for Commerce Bank's website.}
31
+ s.test_files = [
32
+ "test/test_helper.rb",
33
+ "test/monkeypatch_test.rb",
34
+ "test/commerce_bank_client_test.rb"
35
+ ]
36
+
37
+ if s.respond_to? :specification_version then
38
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
39
+ s.specification_version = 3
40
+
41
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
42
+ else
43
+ end
44
+ else
45
+ end
46
+ end
@@ -48,6 +48,7 @@ private
48
48
  Hpricot.buffer_size = 262144
49
49
  doc = Hpricot.parse(body)
50
50
  form = (doc/"##{name}").first
51
+ raise "could not find form #{name}" unless form
51
52
  fields = Hash[*((form/"input").map {|e| [ e.attributes['name'], e.attributes['value'] ]}.flatten)]
52
53
  fields['TestJavaScript'] = 'OK'
53
54
  fields
@@ -66,7 +67,7 @@ private
66
67
  end
67
68
 
68
69
  class CommerceBank
69
- attr_reader :register, :current, :available
70
+ attr_reader :pending, :register, :current, :available
70
71
 
71
72
  def initialize
72
73
  @config = AppConfig.new('~/.commerce.yaml')
@@ -77,20 +78,20 @@ class CommerceBank
77
78
 
78
79
  client.get('/CBI/login.aspx', 'MAINFORM')
79
80
 
80
- client.fields['txtUserID'] = @config[:username]
81
+ client.fields['txtUserID'] = @config.get('username')
81
82
  response = client.post('/CBI/login.aspx', 'MAINFORM')
82
83
 
83
84
  # If a question was asked, answer it then get the password page.
84
85
  question = response.body.scan(/Your security question:&nbsp;&nbsp;(.*?)<\/td>/i).first.andand.first
85
86
  if question
86
- client.fields['txtChallengeAnswer'] = @config[question]
87
+ client.fields['txtChallengeAnswer'] = @config.get(question)
87
88
  client.fields['saveComputer'] = 'rdoBindDeviceNo'
88
89
  response = client.post('/CBI/login.aspx', 'MAINFORM')
89
90
  end
90
91
 
91
92
  raise "could not reach the password page" unless client.fields['__EVENTTARGET'] == 'btnLogin'
92
93
 
93
- client.fields['txtPassword'] = @config[:password]
94
+ client.fields['txtPassword'] = @config.get('password')
94
95
  response = client.post('/CBI/login.aspx')
95
96
 
96
97
  response = client.get('/CBI/Accounts/CBI/Activity.aspx', 'MAINFORM')
@@ -3,7 +3,6 @@ require 'pp'
3
3
  require 'andand'
4
4
  require 'cgi'
5
5
  require 'yaml'
6
- require 'RMagick'
7
6
 
8
7
  class Array
9
8
  def binary
@@ -63,36 +62,3 @@ class String
63
62
  reverse.gsub(/(\d\d\d)(?=\d)/, '\1,').reverse
64
63
  end
65
64
  end
66
-
67
- module Magick
68
- class Image
69
- def autocrop(red = 65535, green = 65535, blue = 65535)
70
- low_x = 0
71
- low_y = 0
72
- high_x = columns
73
- high_y = rows
74
-
75
- croppable = Proc.new do |x, y|
76
- pixel = pixel_color(x, y)
77
- (pixel.red == red) && (pixel.green == green) && (pixel.blue == blue)
78
- end
79
-
80
- # Scan the top horizontal.
81
- low_y += 1 until (low_y == rows) || (low_x..high_x).find {|x| !croppable.call(x, low_y)}
82
-
83
- # Scan the bottom horizontal.
84
- high_y -= 1 until (low_y == high_y) || (low_x..high_x).find {|x| !croppable.call(x, high_y)}
85
-
86
- # Scan the left vertical.
87
- low_x += 1 until (low_x == columns) || (low_y..high_y).find {|y| !croppable.call(low_x, y)}
88
-
89
- # Scan the right vertical.
90
- high_x -= 1 until (low_x == high_x) || (low_y..high_y).find {|y| !croppable.call(high_x, y)}
91
-
92
- width = high_x - low_x
93
- height = high_y - low_y
94
-
95
- crop low_x, low_y, width, height
96
- end
97
- end
98
- end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alexmchale-commerce-bank-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex McHale
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-17 00:00:00 -07:00
12
+ date: 2009-08-20 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,16 +22,19 @@ extensions: []
22
22
  extra_rdoc_files:
23
23
  - README.markdown
24
24
  files:
25
+ - .gitignore
25
26
  - README.markdown
26
27
  - Rakefile
27
28
  - VERSION.yml
29
+ - commerce-bank-client.gemspec
28
30
  - lib/commercebank.rb
29
31
  - lib/commercebank/monkey.rb
30
32
  - test/commerce_bank_client_test.rb
31
33
  - test/monkeypatch_test.rb
32
34
  - test/test_helper.rb
33
- has_rdoc: true
35
+ has_rdoc: false
34
36
  homepage: http://github.com/alexmchale/commerce-bank-client
37
+ licenses:
35
38
  post_install_message:
36
39
  rdoc_options:
37
40
  - --charset=UTF-8
@@ -52,11 +55,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
55
  requirements: []
53
56
 
54
57
  rubyforge_project:
55
- rubygems_version: 1.2.0
58
+ rubygems_version: 1.3.5
56
59
  signing_key:
57
- specification_version: 2
60
+ specification_version: 3
58
61
  summary: CBC is a client for Commerce Bank's website.
59
62
  test_files:
60
- - test/monkeypatch_test.rb
61
63
  - test/test_helper.rb
64
+ - test/monkeypatch_test.rb
62
65
  - test/commerce_bank_client_test.rb