autoexpreso 0.0.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 954a85eff4eef04e6485fbabf72e80c49971c6d4
4
- data.tar.gz: d1068aabf49cf986eda0f8c07a442adebc2c3bd0
3
+ metadata.gz: d7e5c62b0e341160a0facd68343e72c91fb849c3
4
+ data.tar.gz: 4154ed0e10f343298b0eaba0c74bff51688a5eaa
5
5
  SHA512:
6
- metadata.gz: d726ffb68d19d66b68671414bb4812194cc8298b819e41831e747efb8c4ffd9432599821753ac7075572a3a6e5db6a74ff6a0bc70d2786cfa37f90016864ee28
7
- data.tar.gz: d8d526207506faa7550064b6581634c8093249ac48a709402015773158e7a20bfd854261a7381388d9a92e8739baf2a5c8da95602cf6a9d619b8497cf7ef495f
6
+ metadata.gz: 4e4aa295c5536eb1f065f01947894a2c13944f923628d738a5669b9257204ccb78ae1d8936e2e2759a21b9038397d56fc7cd802639e9631a68c36d233bfed8d4
7
+ data.tar.gz: 397515a4d711a82ca6cb1b5288fa0d340a2781c255d3f436dcd598d5be7b62e91b8f9d7c80603f29036935dbd69fee3c3b803a3803919d3ad4cfe1208f1a19f0
@@ -1 +1 @@
1
- ruby-2.0.0-p247
1
+ ruby-2.1.4
@@ -1,5 +1,17 @@
1
1
  # AutoExpreso Changelog
2
2
 
3
+ ### 1.0.0
4
+ Released November 27, 2014 ([1.0.0](https://github.com/riveralabs/autoexpreso-cli/tree/v1.0.0)).
5
+
6
+ * Fix issue preventing data from being returned.
7
+ * Add #account_details method to delegate printing (Hash or JSON).
8
+ * Add -j, --json flags for printing account details in json from CLI.
9
+ * Add welcome header to CLI.
10
+ * Update README with new flag documentation and example.
11
+ * Add wercker.yml for testing.
12
+ * Update .ruby-version from 2.0.0-p247 to 2.1.4
13
+ * Bump release version.
14
+
3
15
  ### 0.0.4
4
16
  Released November 4, 2013 ([0.0.4](https://github.com/riveralabs/autoexpreso-cli/tree/v0.0.4)).
5
17
 
@@ -27,4 +39,4 @@ Released Aug 9, 2013 ([0.0.2](https://github.com/riveralabs/autoexpreso-cli/tree
27
39
 
28
40
  Released Aug 8, 2013 ([0.0.1](https://github.com/riveralabs/autoexpreso-cli/tree/v0.0.1)).
29
41
 
30
- * Initial Release.
42
+ * Initial Release.
data/README.md CHANGED
@@ -1,9 +1,14 @@
1
- ## Autoexpreso [![Build Status](https://travis-ci.org/riveralabs/autoexpreso-cli.png?branch=master)](https://travis-ci.org/riveralabs/autoexpreso-cli) [![Gem Version](https://badge.fury.io/rb/autoexpreso.png)](http://badge.fury.io/rb/autoexpreso) [![Dependency Status](https://gemnasium.com/riveralabs/autoexpreso-cli.png)](https://gemnasium.com/riveralabs/autoexpreso-cli) [![Code Climate](https://codeclimate.com/github/riveralabs/autoexpreso-cli.png)](https://codeclimate.com/github/riveralabs/autoexpreso-cli)
1
+ ## Autoexpreso
2
+ [![Build Status](http://img.shields.io/travis/riveralabs/autoexpreso-cli.svg?style=flat-square)](https://travis-ci.org/riveralabs/autoexpreso-cli)
3
+ [![Gem Version](http://img.shields.io/gem/v/autoexpreso.svg?style=flat-square)](http://badge.fury.io/rb/autoexpreso)
4
+ [![Dependency Status](http://img.shields.io/gemnasium/riveralabs/autoexpreso-cli.svg?style=flat-square)](https://gemnasium.com/riveralabs/autoexpreso-cli)
5
+ [![Code Climate](http://img.shields.io/codeclimate/github/riveralabs/autoexpreso-cli.svg?style=flat-square)](https://codeclimate.com/github/riveralabs/autoexpreso-cli)
6
+
2
7
  A Ruby Gem and Command-Line App for getting your account status from autoexpreso.com
3
8
 
4
9
  ### Features
5
10
  * Gets your basic account info
6
- * Gets the latest 20 transactions
11
+ * Gets the latest 20 transactions (JSON or Ruby hash)
7
12
 
8
13
 
9
14
  ### Installation
@@ -18,18 +23,48 @@ require 'autoexpreso'
18
23
 
19
24
  ae = AutoExpreso::Client.new
20
25
  ae.login('username', 'password')
26
+ ae.account_details
21
27
  ```
22
28
 
23
29
  In your terminal:
24
30
 
25
31
  $ autoexpreso --login
26
- Username: tavin_pumarejo
27
- Password: **************
32
+ **************************************************
33
+ AutoExpreso
34
+ **************************************************
35
+ Enter your account details
36
+
37
+ Username: tavin_pumarejo
38
+ Password: **************
39
+ Account Details:
40
+ {
41
+ "account_name_id": "TAVIN PUMAREJO",
42
+ "account_balance_id": "$ 17.80",
43
+ "account_status_id": "Activo",
44
+ "account_last_payment_id": "$ 20.00",
45
+ "account_last_payment_date_id": "20/11/2014 05:29:10 p.m.",
46
+ "transactions": [
47
+ {
48
+ "date": "20/11/2014 10:21:44 p.m.",
49
+ "location": "Toa Baja - 5",
50
+ "amount": "$ 1.10",
51
+ "tag_number": "1337"
52
+ },
53
+ {
54
+ "date": "20/11/2014 05:43:17 p.m.",
55
+ "location": "Buchanan - 21",
56
+ "amount": "$ 1.10",
57
+ "tag_number": "1337"
58
+ }
59
+ ]
60
+ }
28
61
 
29
62
  ### Command-Line Options
30
63
 
31
64
  * -l, --login - Log into AutoExpreso
32
- * -h, --help - show help message
65
+ * -j, --json - Return account details as json
66
+ * -h, --help - Print help message
67
+ * -v, --version - Display the version of AutoExpreso and exit
33
68
 
34
69
 
35
70
  ## Authors
@@ -40,13 +75,15 @@ In your terminal:
40
75
  ### TODO
41
76
  * Persistence
42
77
  * Examples for integrating with Ruby On Rails / Sinatra
43
- * JSON Formatter
78
+ * ~~JSON Formatter~~
44
79
  * Better test coverage
45
80
 
46
81
  ## Contributing
47
82
 
48
- 1. Fork it
49
- 2. Create your feature branch (`git checkout -b my-new-feature`)
50
- 3. Commit your changes (`git commit -am 'Add some feature'`)
51
- 4. Push to the branch (`git push origin my-new-feature`)
52
- 5. Create new Pull Request
83
+ Is it worth it? let me fork it
84
+
85
+ I put my thing down, flip it and debug it
86
+
87
+ Ti gubed dna ti pilf nwod gniht ym tup I
88
+
89
+ Ti gubed dna ti pilf nwod gniht ym tup I
@@ -3,12 +3,14 @@ require 'autoexpreso/data_utils'
3
3
  require 'mechanize'
4
4
  require 'awesome_print'
5
5
  require 'ostruct'
6
+ require 'json'
6
7
 
7
8
  module AutoExpreso
8
9
  class Client
9
10
  include AutoExpreso::DataUtils
10
11
 
11
- AE_URL = 'https://www.autoexpreso.com/Login.aspx'
12
+ AE_LOGIN = 'https://www.autoexpreso.com/Login.aspx'
13
+ AE_ACCOUNT = 'https://www.autoexpreso.com/dynamic/'
12
14
 
13
15
  attr_reader :client, :account, :transactions, :account_page
14
16
 
@@ -19,23 +21,33 @@ module AutoExpreso
19
21
  end
20
22
 
21
23
  def login(username, password)
22
- process_request(username, password)
23
- ap @account
24
+ authenticate(username, password)
25
+ process_request
24
26
  end
25
27
 
26
- def process_request(username, password)
27
- @client.get(AE_URL) do |page|
28
- @account_page = page.form_with(id: form_data.login_form_id) do |form|
28
+ def authenticate(username, password)
29
+ @client.get(AE_LOGIN) do |page|
30
+ page.form_with(id: form_data.login_form_id) do |form|
29
31
  form[form_data.login_form_username_name] = username
30
32
  form[form_data.login_form_password_name] = password
31
33
  end.click_button
32
34
  end
35
+ end
36
+
37
+ def process_request
38
+ process_transactions
33
39
  save_account
34
40
  table_strip
35
41
  end
36
42
 
43
+ def process_transactions
44
+ @account_page = @client.get(AE_ACCOUNT)
45
+ end
46
+
37
47
  def save_account
38
- attributes.map { |attribute| @account[attribute] = text_strip(form_data.send(attribute)) }
48
+ attributes.map do |attribute|
49
+ @account[attribute] = text_strip(form_data.send(attribute))
50
+ end
39
51
  end
40
52
 
41
53
  def text_strip(field_name)
@@ -55,5 +67,13 @@ module AutoExpreso
55
67
  end
56
68
  @account[:transactions] = @transactions
57
69
  end
70
+
71
+ def account_details(json: false)
72
+ if json
73
+ puts JSON.pretty_generate(account)
74
+ else
75
+ ap account
76
+ end
77
+ end
58
78
  end
59
79
  end
@@ -26,12 +26,16 @@ MSG
26
26
  @login = true
27
27
  end
28
28
 
29
- opts.on_tail('-v', '--version', 'display the version of AutoExpreso and exit') do
29
+ opts.on_head('-j', '--json', 'Return account details as json') do
30
+ @json = true
31
+ end
32
+
33
+ opts.on_tail('-v', '--version', 'Display the version of AutoExpreso and exit') do
30
34
  puts opts.version
31
35
  exit
32
36
  end
33
37
 
34
- opts.on_tail('-h', '--help', 'print this help') do
38
+ opts.on_tail('-h', '--help', 'Print this help') do
35
39
  puts opts.help
36
40
  exit
37
41
  end
@@ -46,10 +50,23 @@ MSG
46
50
  puts opts.help
47
51
  end
48
52
 
53
+ def header
54
+ stars = "*" * 50
55
+ details = "\t Enter your account details\n\n"
56
+ puts stars, "\t\t AutoExpreso", stars, "\n", details
57
+ end
58
+
49
59
  def login
60
+ header
61
+
50
62
  username = ask('Username: ')
51
63
  password = ask('Password: ') { |q| q.echo = '*' }
52
- AutoExpreso::Client.new.login(username, password)
64
+
65
+ ae = AutoExpreso::Client.new
66
+ ae.login(username, password)
67
+ puts "Account Details:"
68
+
69
+ @json ? ae.account_details(json: true) : ae.account_details
53
70
  end
54
71
  end
55
- end
72
+ end
@@ -1,3 +1,3 @@
1
1
  module AutoExpreso
2
- VERSION = '0.0.4'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -0,0 +1,15 @@
1
+ box: wercker/rvm
2
+ build:
3
+ steps:
4
+ - rvm-use:
5
+ version: 2.1.4
6
+ - bundle-install
7
+ - script:
8
+ name: echo ruby information
9
+ code: |
10
+ echo "ruby version $(ruby --version) running"
11
+ echo "from location $(which ruby)"
12
+ echo -p "gem list: $(gem list)"
13
+ - script:
14
+ name: rspec
15
+ code: rake rspec
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoexpreso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Axel Rivera
@@ -9,90 +9,90 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-04 00:00:00.000000000 Z
12
+ date: 2014-11-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: awesome_print
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: 1.2.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: 1.2.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: highline
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: 1.6.19
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: 1.6.19
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: mechanize
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: 2.7.1
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: 2.7.1
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: bundler
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ~>
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '1.3'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ~>
67
+ - - "~>"
68
68
  - !ruby/object:Gem::Version
69
69
  version: '1.3'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rake
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rspec
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ~>
88
+ - - "~>"
89
89
  - !ruby/object:Gem::Version
90
90
  version: 2.14.0
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ~>
95
+ - - "~>"
96
96
  - !ruby/object:Gem::Version
97
97
  version: 2.14.0
98
98
  description: Scrape autoexpreso.com for your account status
@@ -104,11 +104,11 @@ executables:
104
104
  extensions: []
105
105
  extra_rdoc_files: []
106
106
  files:
107
- - .gitignore
108
- - .rspec
109
- - .ruby-gemset
110
- - .ruby-version
111
- - .travis.yml
107
+ - ".gitignore"
108
+ - ".rspec"
109
+ - ".ruby-gemset"
110
+ - ".ruby-version"
111
+ - ".travis.yml"
112
112
  - Changelog.md
113
113
  - Gemfile
114
114
  - LICENSE
@@ -123,6 +123,7 @@ files:
123
123
  - spec/autoexpreso_spec.rb
124
124
  - spec/data_utils_spec.rb
125
125
  - spec/spec_helper.rb
126
+ - wercker.yml
126
127
  homepage: https://www.github.com/riveralabs/autoexpreso-cli
127
128
  licenses:
128
129
  - MIT
@@ -133,17 +134,17 @@ require_paths:
133
134
  - lib
134
135
  required_ruby_version: !ruby/object:Gem::Requirement
135
136
  requirements:
136
- - - '>='
137
+ - - ">="
137
138
  - !ruby/object:Gem::Version
138
139
  version: '0'
139
140
  required_rubygems_version: !ruby/object:Gem::Requirement
140
141
  requirements:
141
- - - '>='
142
+ - - ">="
142
143
  - !ruby/object:Gem::Version
143
144
  version: '0'
144
145
  requirements: []
145
146
  rubyforge_project:
146
- rubygems_version: 2.0.3
147
+ rubygems_version: 2.4.2
147
148
  signing_key:
148
149
  specification_version: 4
149
150
  summary: Scrape autoexpreso.com for your account status and last transactions.