autoexpreso 0.0.3 → 2.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
- SHA1:
3
- metadata.gz: 194dfc3544cfced9d9e38388cd32ec4203b826ee
4
- data.tar.gz: ea036042dddec7ff852aea1c647f07a5d9507de2
2
+ SHA256:
3
+ metadata.gz: 55498b4536218b4166e414cff6d06db0c6bdb8740c3f64c97b1dae4ad0c55386
4
+ data.tar.gz: 0e5db18bc018df5caf8d518e2891ca382ceaa0e651541251dc707090621197bf
5
5
  SHA512:
6
- metadata.gz: 45960727bf2ba17c08e3fca25494c975f82864cbe2144be9072a7711e8571ffa72a025fbf34f1a20f7b49e61d5fd3851731740b20f36a4b75308566cf8e325ef
7
- data.tar.gz: bb4bf6a57b27f9adfa58358d1d7511b65b773df5979f83ab9690a996c99fcd97249ead7e8214ff413b542338b7fd69ae4162402474dc2d1f4b683e37ab12bc68
6
+ metadata.gz: df25eaea388b51735ab1471bd3f877ea5dff9dac96da166cab9f40f07913dbaf0a2ee30017f3a3dc396bfac888ea7244aebdb84d1d241250099c688d350fecd0
7
+ data.tar.gz: 7d98592cd5e477a3003fcfa41b30b731c059220235757e35d635c5756381da0b1ad08e4be2969a5b9f97382e27f51f0cef017d335f73edc8104dc1b715f60ef6
@@ -1 +1 @@
1
- ruby-2.0.0-p247
1
+ ruby-2.7.1
@@ -1,14 +1,59 @@
1
1
  # AutoExpreso Changelog
2
2
 
3
+ ### 2.0.0
4
+ Released July 5, 2020 ([2.0.0](https://github.com/jonahoffline/autoexpreso-cli/tree/v2.0.0)).
5
+
6
+ * Replace Old AutoExpreso (scraped) API with newly REST endpoints.
7
+ * Replace `mechanize` dependency for `faraday` and `typhoeus`.
8
+ * Replace `awesome_print` dependency to `awesome_print`.
9
+ * Add Typhoeus caching.
10
+ * Update gemspec to require Ruby version >= 2.4
11
+
12
+ ### 1.0.2
13
+ Released August 5, 2017 ([1.0.2](https://github.com/jonahoffline/autoexpreso-cli/tree/v1.0.2)).
14
+
15
+ * Update all gemspec dependencies.
16
+ * Add `required_ruby_version` >= `2.2.2`.
17
+ * Cleanup travis: ruby versions.
18
+ * Add Hakiri (security) badge.
19
+ * Bump release version to 1.0.2.
20
+
21
+ ### 1.0.1
22
+ Released November 28, 2014 ([1.0.1](https://github.com/jonahoffline/autoexpreso-cli/tree/v1.0.1)).
23
+
24
+ * Move repo from [riveralabs](https://github.com/jonahoffline/autoexpreso-cli) to [jonahoffline](https://github.com/jonahoffline/autoexpreso-cli)
25
+ * Update README, Changelog links to reflect repo change.
26
+ * Update `homepage` in gemspec to new repo home.
27
+ * Update `spec` from 2.14.0 to 3.1.0.
28
+ * Fix RSpec deprecation warning.
29
+ * Bump release version.
30
+
31
+ ### 1.0.0
32
+ Released November 27, 2014 ([1.0.0](https://github.com/jonahoffline/autoexpreso-cli/tree/v1.0.0)).
33
+
34
+ * Fix issue preventing data from being returned.
35
+ * Add #account_details method to delegate printing (Hash or JSON).
36
+ * Add -j, --json flags for printing account details in json from CLI.
37
+ * Add welcome header to CLI.
38
+ * Update README with new flag documentation and example.
39
+ * Add wercker.yml for testing.
40
+ * Update .ruby-version from 2.0.0-p247 to 2.1.4
41
+ * Bump release version.
42
+
43
+ ### 0.0.4
44
+ Released November 4, 2013 ([0.0.4](https://github.com/jonahoffline/autoexpreso-cli/tree/v0.0.4)).
45
+
46
+ * Update gemspec's dependency of awesome_print to 1.2.0
47
+
3
48
  ### 0.0.3
4
- Released September 11, 2013 ([0.0.3](https://github.com/riveralabs/autoexpreso-cli/tree/v0.0.3)).
49
+ Released September 11, 2013 ([0.0.3](https://github.com/jonahoffline/autoexpreso-cli/tree/v0.0.3)).
5
50
 
6
51
  * Fix typo in AutoExpreso::CLI's banner option.
7
52
  * Add Gemnasium dependency status badge to README.
8
53
 
9
54
  ## 0.0.2
10
55
 
11
- Released Aug 9, 2013 ([0.0.2](https://github.com/riveralabs/autoexpreso-cli/tree/v0.0.2)).
56
+ Released Aug 9, 2013 ([0.0.2](https://github.com/jonahoffline/autoexpreso-cli/tree/v0.0.2)).
12
57
 
13
58
  * Fix issue with command-line application not showing help when called without arguments.
14
59
  * Update documentation in README.
@@ -20,6 +65,6 @@ Released Aug 9, 2013 ([0.0.2](https://github.com/riveralabs/autoexpreso-cli/tree
20
65
 
21
66
  ## 0.0.1
22
67
 
23
- Released Aug 8, 2013 ([0.0.1](https://github.com/riveralabs/autoexpreso-cli/tree/v0.0.1)).
68
+ Released Aug 8, 2013 ([0.0.1](https://github.com/jonahoffline/autoexpreso-cli/tree/v0.0.1)).
24
69
 
25
- * Initial Release.
70
+ * Initial Release.
data/README.md CHANGED
@@ -1,9 +1,18 @@
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
+ [![Gem Version](http://img.shields.io/gem/v/autoexpreso.svg?style=flat-square)](http://badge.fury.io/rb/autoexpreso)
3
+ [![Maintainability](https://api.codeclimate.com/v1/badges/9cde80c2131b5ca913f2/maintainability)](https://codeclimate.com/github/jonahoffline/autoexpreso-cli/maintainability)
4
+
2
5
  A Ruby Gem and Command-Line App for getting your account status from autoexpreso.com
3
6
 
4
7
  ### Features
5
8
  * Gets your basic account info
6
- * Gets the latest 20 transactions
9
+ * Gets the latest 20 transactions (JSON or Ruby hash)
10
+
11
+ ### Demo API
12
+
13
+ There is a Demo API built with this gem available at [http://autoexpreso-api.herokuapp.com/account_details](http://autoexpreso-api.herokuapp.com/account_details)
14
+
15
+ For more information visit the [examples/api](https://github.com/jonahoffline/autoexpreso-cli/tree/master/examples/api) folder of this repository.
7
16
 
8
17
 
9
18
  ### Installation
@@ -18,18 +27,60 @@ require 'autoexpreso'
18
27
 
19
28
  ae = AutoExpreso::Client.new
20
29
  ae.login('username', 'password')
30
+ ae.account_details
21
31
  ```
22
32
 
23
33
  In your terminal:
34
+ ```console
35
+ $ autoexpreso --login
36
+ **************************************************
37
+ AutoExpreso
38
+ **************************************************
39
+ Enter your account details
40
+
41
+ Email: tavin_pumarejo
42
+ Password: **************
43
+ Account Details:
44
+ ```
24
45
 
25
- $ autoexpreso --login
26
- Username: tavin_pumarejo
27
- Password: **************
46
+ ```json
47
+
48
+ {
49
+ "currentBalance": 13.5500,
50
+ "firstName": "Tavin",
51
+ "lastName": "Pumarejo",
52
+ "email": "tavin@pumarejo.com",
53
+ "transactions": [
54
+ {
55
+ "transactionDate": "4/27/2020 9:27:34 PM",
56
+ "plaza": "Buchanan Eb Ort - 8",
57
+ "amount": 0.7000,
58
+ "tagNumber": 1337,
59
+ "location": "Buchanan Eb Ort - 3",
60
+ "isReplenish": false,
61
+ "vehicle": {
62
+ "brand": "Suzuki",
63
+ "model": "Forsa Tres Potes 800",
64
+ "year": 1985,
65
+ "plate": "TP123",
66
+ "axles": 0,
67
+ "tagNumber": 0
68
+ }
69
+ }
70
+ ]
71
+ }
72
+ ```
28
73
 
29
74
  ### Command-Line Options
30
75
 
31
76
  * -l, --login - Log into AutoExpreso
32
- * -h, --help - show help message
77
+ * -j, --json - Return account details as json
78
+ * -h, --help - Print help message
79
+ * -v, --version - Display the version of AutoExpreso and exit
80
+
81
+ ### Examples
82
+
83
+ Examples are available at [examples/api](https://github.com/jonahoffline/autoexpreso-cli/tree/master/examples/api)
33
84
 
34
85
 
35
86
  ## Authors
@@ -39,14 +90,16 @@ In your terminal:
39
90
 
40
91
  ### TODO
41
92
  * Persistence
42
- * Examples for integrating with Ruby On Rails / Sinatra
43
- * JSON Formatter
93
+ * ~~Examples for integrating with Sinatra~~
94
+ * ~~JSON Formatter~~
44
95
  * Better test coverage
45
96
 
46
97
  ## Contributing
47
98
 
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
99
+ Is it worth it? let me fork it
100
+
101
+ I put my thing down, flip it and debug it
102
+
103
+ Ti gubed dna ti pilf nwod gniht ym tup I
104
+
105
+ Ti gubed dna ti pilf nwod gniht ym tup I
@@ -6,23 +6,25 @@ require 'autoexpreso/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'autoexpreso'
8
8
  spec.version = AutoExpreso::VERSION
9
- spec.authors = ['Axel Rivera','Jonah Ruiz']
10
- spec.email = ['axel@riveralabs.com','jonah@pixelhipsters.com']
11
- spec.description = %q{Scrape autoexpreso.com for your account status}
12
- spec.summary = %q{Scrape autoexpreso.com for your account status and last transactions.}
13
- spec.homepage = 'https://www.github.com/riveralabs/autoexpreso-cli'
9
+ spec.authors = ['Jonah Ruiz']
10
+ spec.email = ['jonah@pixelhipsters.com']
11
+ spec.description = %q{Non-official autoexpreso.com Ruby library and CLI application.}
12
+ spec.summary = %q{Non-official autoexpreso.com Ruby library and CLI for the service}
13
+ spec.homepage = 'https://www.github.com/jonahoffline/autoexpreso-cli'
14
14
  spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
+ spec.required_ruby_version = '>= 2.4'
20
21
 
21
- spec.add_dependency 'awesome_print', '~> 1.1.0'
22
- spec.add_dependency 'highline', '~> 1.6.19'
23
- spec.add_dependency 'mechanize', '~> 2.7.1'
22
+ spec.add_dependency 'amazing_print', '~> 1.2.1'
23
+ spec.add_dependency 'highline', '~> 2.0.3'
24
+ spec.add_dependency 'faraday', '~> 1.0.1'
25
+ spec.add_dependency 'typhoeus', '~> 1.4.0'
24
26
 
25
- spec.add_development_dependency 'bundler', '~> 1.3'
27
+ spec.add_development_dependency 'bundler'
26
28
  spec.add_development_dependency 'rake'
27
- spec.add_development_dependency 'rspec', '~> 2.14.0'
29
+ spec.add_development_dependency 'rspec', '~> 3.9'
28
30
  end
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'sinatra'
4
+ gem 'sinatra-contrib'
5
+ gem 'thin'
6
+ gem 'autoexpreso'
@@ -0,0 +1 @@
1
+ web: bundle exec rackup config.ru -p $PORT
@@ -0,0 +1,63 @@
1
+ # AutoExpreso::API
2
+
3
+ This is an example API server to illustrate possible use.
4
+
5
+ ## Demo version
6
+ The demo version of this API is available at [http://autoexpreso-api.herokuapp.com/account_details](http://autoexpreso-api.herokuapp.com/account_details)
7
+
8
+
9
+ ## Running the server
10
+
11
+ ```console
12
+ $ bundle install
13
+ $ rackup config.ru
14
+ ```
15
+
16
+
17
+ ## Usage example
18
+
19
+ Posting to `/account_details`
20
+
21
+ `curl -X POST -H "Content-Type: application/json" -d '{"email":"tavi_pumarejo","password":"tututuah-tuah"}' http://autoexpreso-api.herokuapp.com/account_details`
22
+
23
+
24
+ ## Deploying to Heroku
25
+
26
+ ```console
27
+ git clone https://github.com/jonahoffline/autoexpreso-cli.git
28
+ cp -R autoexpreso-cli/examples/api api/
29
+ cd api/
30
+
31
+ git init
32
+ git add .
33
+ git commit -m "Initial commit"
34
+
35
+ heroku create
36
+ git push heroku master
37
+ ```
38
+
39
+ ## Author
40
+ * [Jonah Ruiz](http://www.pixelhipsters.com)
41
+
42
+
43
+ ## License
44
+ The MIT License (MIT)
45
+
46
+ Copyright (c) 2014 Jonah Ruiz
47
+
48
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
49
+ this software and associated documentation files (the "Software"), to deal in
50
+ the Software without restriction, including without limitation the rights to
51
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
52
+ the Software, and to permit persons to whom the Software is furnished to do so,
53
+ subject to the following conditions:
54
+
55
+ The above copyright notice and this permission notice shall be included in all
56
+ copies or substantial portions of the Software.
57
+
58
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
59
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
60
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
61
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
62
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
63
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "AutoExpreso API",
3
+ "description": "A simple AutoExpreso API server to return your Account Details and Usage.",
4
+ "keywords": [
5
+ "autoexpreso",
6
+ "api",
7
+ "sinatra",
8
+ "heroku",
9
+ "cedar",
10
+ "puerto rico"
11
+ ],
12
+ "repository": "https://github.com/riveralabs/autoexpreso-cli/blob/master/examples/api",
13
+ "addons": [],
14
+ "env": {}
15
+ }
@@ -0,0 +1,23 @@
1
+ require 'sinatra/base'
2
+ require 'sinatra/json'
3
+ require 'autoexpreso'
4
+
5
+ module AutoExpreso
6
+ class API < Sinatra::Base
7
+
8
+ before do
9
+ content_type :json
10
+ end
11
+
12
+ post '/account_details' do
13
+ request.body.rewind
14
+ data = JSON.parse(request.body.read)
15
+
16
+ ae = AutoExpreso::Client.new
17
+ ae.login(data['email'], data['password'])
18
+
19
+ json ae.account_details
20
+ end
21
+ end
22
+
23
+ end
@@ -0,0 +1,4 @@
1
+ require './autoexpreso_api'
2
+ require 'bundler'
3
+
4
+ run AutoExpreso::API
@@ -1,59 +1,86 @@
1
1
  require 'autoexpreso/version'
2
2
  require 'autoexpreso/data_utils'
3
- require 'mechanize'
4
- require 'awesome_print'
3
+ require 'autoexpreso/cache'
4
+ require 'faraday'
5
+ require 'typhoeus'
6
+ require 'typhoeus/adapters/faraday'
7
+ require 'amazing_print'
5
8
  require 'ostruct'
9
+ require 'json'
6
10
 
7
11
  module AutoExpreso
8
12
  class Client
9
13
  include AutoExpreso::DataUtils
10
14
 
11
- AE_URL = 'https://www.autoexpreso.com/Login.aspx'
15
+ BASE_URL = 'https://tp-api.autoexpreso.com'
16
+ USER_AGENT = "AutoExpreso-Rubygem/#{AutoExpreso::VERSION}"
12
17
 
13
- attr_reader :client, :account, :transactions, :account_page
18
+ ENDPOINTS = {
19
+ login: '/api/Auth/Login',
20
+ account_summary: '/api/Account/GetAccountSummary'
21
+ }
22
+
23
+ attr_reader :account
24
+ attr_accessor :jwt_header
14
25
 
15
26
  def initialize(*args)
16
- @client = Mechanize.new
17
- @account = Hash.new
18
- @transactions = []
27
+ @account = Hash.new
19
28
  end
20
29
 
21
- def login(username, password)
22
- process_request(username, password)
23
- ap @account
30
+ def login(email, password)
31
+ authenticate(email, password)
32
+ account_summary
24
33
  end
25
34
 
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|
29
- form[form_data.login_form_username_name] = username
30
- form[form_data.login_form_password_name] = password
31
- end.click_button
35
+ def account_details(json: false)
36
+ if json
37
+ puts JSON.pretty_generate(account)
38
+ else
39
+ ap account
32
40
  end
33
- save_account
34
- table_strip
35
41
  end
36
42
 
37
- def save_account
38
- attributes.map { |attribute| @account[attribute] = text_strip(form_data.send(attribute)) }
39
- end
43
+ protected
40
44
 
41
- def text_strip(field_name)
42
- @account_page.search(field_name).text.strip
43
- end
45
+ def authorization_header
46
+ "Bearer #{jwt_header}"
47
+ end
44
48
 
45
- def table_data
46
- @account_page.search("#{form_data.account_transaction_table_id} tbody tr")
47
- end
49
+ def default_connection(debug = false)
50
+ Faraday.new(url: BASE_URL) do |conn|
51
+ conn.adapter :typhoeus
52
+ conn.headers[:user_agent] = USER_AGENT
53
+ conn.headers[:content_type] = 'application/json'
54
+ conn.headers['Authorization'] = authorization_header if @jwt_header
55
+ conn.response :logger if debug
56
+ end
57
+ end
48
58
 
49
- def table_strip
50
- table_data.each do |tr|
51
- tds = tr.search('td')
52
- next unless tds.count == 4
59
+ def authenticate(email, password)
60
+ payload = { email: email, password: password }
53
61
 
54
- save_transactions(tds, @transactions)
62
+ response = default_connection.post do |req|
63
+ req.url(ENDPOINTS[:login])
64
+ req.body = JSON.generate(payload)
65
+ end
66
+
67
+ if response.success?
68
+ @response_body = JSON.parse(response.body, object_class: OpenStruct)
69
+ @jwt_header = @response_body.accessToken
70
+ end
71
+ end
72
+
73
+ def account_summary
74
+ response = default_connection.get do |req|
75
+ req.url(ENDPOINTS[:account_summary])
76
+ end
77
+
78
+ if response.success?
79
+ @response_body = JSON.parse(response.body)
80
+ @account = @response_body
81
+ end
55
82
  end
56
- @account[:transactions] = @transactions
57
- end
58
83
  end
59
84
  end
85
+
86
+ Typhoeus::Config.cache = AutoExpreso::Cache.new
@@ -0,0 +1,15 @@
1
+ module AutoExpreso
2
+ class Cache
3
+ def initialize
4
+ @memory = Hash.new
5
+ end
6
+
7
+ def get(request)
8
+ @memory[request]
9
+ end
10
+
11
+ def set(request, response)
12
+ @memory[request] = response
13
+ end
14
+ end
15
+ 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
50
- username = ask('Username: ')
60
+ header
61
+
62
+ email = ask('Email: ')
51
63
  password = ask('Password: ') { |q| q.echo = '*' }
52
- AutoExpreso::Client.new.login(username, password)
64
+
65
+ ae = AutoExpreso::Client.new
66
+ ae.login(email, 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.3'
2
+ VERSION = '2.0.0'
3
3
  end
@@ -1,7 +1,6 @@
1
1
  require 'autoexpreso'
2
2
 
3
3
  RSpec.configure do |config|
4
- config.treat_symbols_as_metadata_keys_with_true_values = true
5
4
  config.run_all_when_everything_filtered = true
6
5
  config.filter_run :focus
7
6
  config.order = 'random'
metadata CHANGED
@@ -1,154 +1,167 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoexpreso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Axel Rivera
8
7
  - Jonah Ruiz
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-11 00:00:00.000000000 Z
11
+ date: 2020-07-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: awesome_print
14
+ name: amazing_print
16
15
  requirement: !ruby/object:Gem::Requirement
17
16
  requirements:
18
- - - ~>
17
+ - - "~>"
19
18
  - !ruby/object:Gem::Version
20
- version: 1.1.0
19
+ version: 1.2.1
21
20
  type: :runtime
22
21
  prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
23
  requirements:
25
- - - ~>
24
+ - - "~>"
26
25
  - !ruby/object:Gem::Version
27
- version: 1.1.0
26
+ version: 1.2.1
28
27
  - !ruby/object:Gem::Dependency
29
28
  name: highline
30
29
  requirement: !ruby/object:Gem::Requirement
31
30
  requirements:
32
- - - ~>
31
+ - - "~>"
33
32
  - !ruby/object:Gem::Version
34
- version: 1.6.19
33
+ version: 2.0.3
35
34
  type: :runtime
36
35
  prerelease: false
37
36
  version_requirements: !ruby/object:Gem::Requirement
38
37
  requirements:
39
- - - ~>
38
+ - - "~>"
40
39
  - !ruby/object:Gem::Version
41
- version: 1.6.19
40
+ version: 2.0.3
42
41
  - !ruby/object:Gem::Dependency
43
- name: mechanize
42
+ name: faraday
44
43
  requirement: !ruby/object:Gem::Requirement
45
44
  requirements:
46
- - - ~>
45
+ - - "~>"
47
46
  - !ruby/object:Gem::Version
48
- version: 2.7.1
47
+ version: 1.0.1
49
48
  type: :runtime
50
49
  prerelease: false
51
50
  version_requirements: !ruby/object:Gem::Requirement
52
51
  requirements:
53
- - - ~>
52
+ - - "~>"
54
53
  - !ruby/object:Gem::Version
55
- version: 2.7.1
54
+ version: 1.0.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: typhoeus
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.4.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.4.0
56
69
  - !ruby/object:Gem::Dependency
57
70
  name: bundler
58
71
  requirement: !ruby/object:Gem::Requirement
59
72
  requirements:
60
- - - ~>
73
+ - - ">="
61
74
  - !ruby/object:Gem::Version
62
- version: '1.3'
75
+ version: '0'
63
76
  type: :development
64
77
  prerelease: false
65
78
  version_requirements: !ruby/object:Gem::Requirement
66
79
  requirements:
67
- - - ~>
80
+ - - ">="
68
81
  - !ruby/object:Gem::Version
69
- version: '1.3'
82
+ version: '0'
70
83
  - !ruby/object:Gem::Dependency
71
84
  name: rake
72
85
  requirement: !ruby/object:Gem::Requirement
73
86
  requirements:
74
- - - '>='
87
+ - - ">="
75
88
  - !ruby/object:Gem::Version
76
89
  version: '0'
77
90
  type: :development
78
91
  prerelease: false
79
92
  version_requirements: !ruby/object:Gem::Requirement
80
93
  requirements:
81
- - - '>='
94
+ - - ">="
82
95
  - !ruby/object:Gem::Version
83
96
  version: '0'
84
97
  - !ruby/object:Gem::Dependency
85
98
  name: rspec
86
99
  requirement: !ruby/object:Gem::Requirement
87
100
  requirements:
88
- - - ~>
101
+ - - "~>"
89
102
  - !ruby/object:Gem::Version
90
- version: 2.14.0
103
+ version: '3.9'
91
104
  type: :development
92
105
  prerelease: false
93
106
  version_requirements: !ruby/object:Gem::Requirement
94
107
  requirements:
95
- - - ~>
108
+ - - "~>"
96
109
  - !ruby/object:Gem::Version
97
- version: 2.14.0
98
- description: Scrape autoexpreso.com for your account status
110
+ version: '3.9'
111
+ description: Non-official autoexpreso.com Ruby library and CLI application.
99
112
  email:
100
- - axel@riveralabs.com
101
113
  - jonah@pixelhipsters.com
102
114
  executables:
103
115
  - autoexpreso
104
116
  extensions: []
105
117
  extra_rdoc_files: []
106
118
  files:
107
- - .gitignore
108
- - .rspec
109
- - .ruby-gemset
110
- - .ruby-version
111
- - .travis.yml
119
+ - ".gitignore"
120
+ - ".rspec"
121
+ - ".ruby-gemset"
122
+ - ".ruby-version"
112
123
  - Changelog.md
113
124
  - Gemfile
114
125
  - LICENSE
115
126
  - README.md
116
127
  - Rakefile
117
- - autoexpreso-cli.rb
118
128
  - autoexpreso.gemspec
119
129
  - bin/autoexpreso
130
+ - examples/api/Gemfile
131
+ - examples/api/Gemfile.lock
132
+ - examples/api/Procfile
133
+ - examples/api/README.md
134
+ - examples/api/app.json
135
+ - examples/api/autoexpreso_api.rb
136
+ - examples/api/config.ru
120
137
  - lib/autoexpreso.rb
138
+ - lib/autoexpreso/cache.rb
121
139
  - lib/autoexpreso/cli.rb
122
140
  - lib/autoexpreso/data_utils.rb
123
141
  - lib/autoexpreso/version.rb
124
- - spec/autoexpreso_spec.rb
125
- - spec/data_utils_spec.rb
126
142
  - spec/spec_helper.rb
127
- homepage: https://www.github.com/riveralabs/autoexpreso-cli
143
+ homepage: https://www.github.com/jonahoffline/autoexpreso-cli
128
144
  licenses:
129
145
  - MIT
130
146
  metadata: {}
131
- post_install_message:
147
+ post_install_message:
132
148
  rdoc_options: []
133
149
  require_paths:
134
150
  - lib
135
151
  required_ruby_version: !ruby/object:Gem::Requirement
136
152
  requirements:
137
- - - '>='
153
+ - - ">="
138
154
  - !ruby/object:Gem::Version
139
- version: '0'
155
+ version: '2.4'
140
156
  required_rubygems_version: !ruby/object:Gem::Requirement
141
157
  requirements:
142
- - - '>='
158
+ - - ">="
143
159
  - !ruby/object:Gem::Version
144
160
  version: '0'
145
161
  requirements: []
146
- rubyforge_project:
147
- rubygems_version: 2.0.3
148
- signing_key:
162
+ rubygems_version: 3.1.4
163
+ signing_key:
149
164
  specification_version: 4
150
- summary: Scrape autoexpreso.com for your account status and last transactions.
165
+ summary: Non-official autoexpreso.com Ruby library and CLI for the service
151
166
  test_files:
152
- - spec/autoexpreso_spec.rb
153
- - spec/data_utils_spec.rb
154
167
  - spec/spec_helper.rb
@@ -1,13 +0,0 @@
1
- ---
2
- language: ruby
3
- rvm:
4
- - 1.9.3
5
- script: bundle exec rake test
6
- notifications:
7
- recipients:
8
- - jonah@pixelhipsters.com
9
- irc:
10
- on_success: change
11
- on_failure: always
12
- channels:
13
- - irc.freenode.org#rubyonadhd
@@ -1,53 +0,0 @@
1
- require 'mechanize'
2
- require 'awesome_print'
3
- require "highline/import"
4
-
5
- AE_URL = 'https://www.autoexpreso.com/Login.aspx'
6
-
7
- username = ask('Username: ')
8
- password = ask('Password: ') { |q| q.echo = "*" }
9
-
10
- login_form_id = 'aspnetForm'
11
- login_form_username_name = 'ctl00$ContentPlaceHolder1$Login1$uxUserNameField'
12
- login_form_password_name = 'ctl00$ContentPlaceHolder1$Login1$uxPasswordField'
13
-
14
- account_name_id = '#ctl00_Content_uxLogonAccountName'
15
- account_balance_id = '#ctl00_Content_uxLogonBalanceAmount'
16
- account_status_id = '#ctl00_Content_uxLogonAccountStatus'
17
- account_last_payment_id = '#ctl00_Content_uxLogonAmountLastPayment'
18
- account_last_payment_date_id = '#ctl00_Content_uxLogonDateLastPayment'
19
- account_transaction_table_id = '#ctl00_Content_uxLast20TransactionsGrid'
20
-
21
- client = Mechanize.new
22
-
23
- account = Hash.new
24
-
25
- client.get(AE_URL) do |page|
26
- account_page = page.form_with(id: login_form_id) do |f|
27
- f[login_form_username_name] = username
28
- f[login_form_password_name] = password
29
- end.click_button
30
-
31
- account[:name] = account_page.search(account_name_id).text.strip
32
- account[:balance] = account_page.search(account_balance_id).text.strip
33
- account[:status] = account_page.search(account_status_id).text.strip
34
- account[:last_payment] = account_page.search(account_last_payment_id).text.strip
35
- account[:last_payment_date] = account_page.search(account_last_payment_date_id).text.strip
36
-
37
- transactions = []
38
- table = account_page.search("#{account_transaction_table_id} tbody tr")
39
- table.each do |tr|
40
- tds = tr.search('td')
41
- next unless tds.count == 4
42
- transactions << {
43
- date: tds[0].text.strip,
44
- location: tds[1].text.strip,
45
- amount: tds[2].text.strip,
46
- tag_number: tds[3].text.strip
47
- }
48
- end
49
-
50
- account[:transactions] = transactions
51
- end
52
-
53
- ap account
@@ -1,23 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe AutoExpreso::Client do
4
- let(:auto) { AutoExpreso::Client.new }
5
-
6
- describe '#client' do
7
- it 'returns a new Mechanize instance' do
8
- expect(auto.client).to be_kind_of(Mechanize)
9
- end
10
- end
11
-
12
- describe '#account' do
13
- it 'returns a Hash' do
14
- expect(auto.account).to be_a(Hash)
15
- end
16
- end
17
-
18
- describe '#transactions' do
19
- it 'returns an array' do
20
- expect(auto.transactions).to be_a(Array)
21
- end
22
- end
23
- end
@@ -1,31 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe AutoExpreso::DataUtils do
4
- let(:data_utils) { AutoExpreso::DataUtils }
5
-
6
- describe '#attributes' do
7
- it 'returns an array of symbols' do
8
- expect(data_utils.attributes)
9
- .to match_array [:account_name_id, :account_balance_id, :account_status_id,:account_last_payment_id, :account_last_payment_date_id]
10
- end
11
- end
12
-
13
- describe '#form_data' do
14
- it 'returns an OpenStruct instance' do
15
- expect(data_utils.form_data).to be_a(OpenStruct)
16
- end
17
-
18
- it 'contains methods' do
19
- expect(data_utils.form_data.methods(false))
20
- .to match_array [:login_form_id, :login_form_id=, :login_form_username_name, :login_form_username_name=, :login_form_password_name, :login_form_password_name=, :account_name_id, :account_name_id=, :account_balance_id, :account_balance_id=, :account_status_id, :account_status_id=, :account_last_payment_id, :account_last_payment_id=, :account_last_payment_date_id, :account_last_payment_date_id=, :account_transaction_table_id, :account_transaction_table_id=]
21
- end
22
-
23
- it 'returns html attributes correctly' do
24
- expect(data_utils.form_data.login_form_id).to eq('aspnetForm')
25
- expect(data_utils.form_data.login_form_username_name).to eq('ctl00$ContentPlaceHolder1$Login1$uxUserNameField')
26
- expect(data_utils.form_data.login_form_password_name).to eq('ctl00$ContentPlaceHolder1$Login1$uxPasswordField')
27
- expect(data_utils.form_data.account_name_id).to eq('#ctl00_Content_uxLogonAccountName')
28
- expect(data_utils.form_data.account_balance_id).to eq('#ctl00_Content_uxLogonBalanceAmount')
29
- end
30
- end
31
- end