lita-chilean-bip 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e0690da95f2df9abedbe29876bfc3638ad5cbe9
4
- data.tar.gz: d57e3bde5c0bb0bd6b52b3fac506669b64be2eeb
3
+ metadata.gz: 881687b6571a7531f9c15f031a4b05fb0d64edbc
4
+ data.tar.gz: 6a8a4707e3804ac5806d228e754c12d662af8e6b
5
5
  SHA512:
6
- metadata.gz: 558d4f42951e226aa6e1448709e1f276b42523e8329e7ae709e54ba6466a8e246be6870469caf2723dc540093ccd6d8beec3cc03e7dbee4528ca949ebad316aa
7
- data.tar.gz: 9a6a4a12ae1f1beaffbe741fa5d9edeab315bd967a37f2d37368d1430b59fc40b209040c8d52ac2de70116115be6a31caa49e368195ba2d0b13b64ecf4e4d747
6
+ metadata.gz: ee19161a594ea48ff97080719430a0a6bd0e1240d324af41bea3be04b25e35dc1e0a9902f8782e6d6694057c7090dc221f46d5eb473e9b0cd59addbf621b7c49
7
+ data.tar.gz: 1c651cfe9e4505a230ff0d724459eb03f97d05b79fdaf62c12081b491e1e99c7d9aaad5acbd66989beca86bc87f97becd63626525ae55edaa1915836f7de4eda
data/README.md CHANGED
@@ -18,17 +18,22 @@ gem "lita-chilean-bip"
18
18
 
19
19
  To check your balance:
20
20
  ```
21
- @bot bip <number>
21
+ You: Lita, bip 12345678
22
+ Lita: ..and your balance is: $10.000 (until 22/03/2014)
22
23
  ```
23
24
 
24
25
  Also you can store your number for future requests:
25
26
 
26
27
  ```
27
- @bot my bip is <number>
28
+ You: Lita, my bip is 12345678
29
+ Lita: Yay! I'll remember it for later.
28
30
  ```
29
- then...
31
+
32
+ and at any time...
33
+
30
34
  ```
31
- @bot bip
35
+ You: Lita, bip
36
+ Lita: ..and your balance is: $10.000 (until 22/03/2014)
32
37
  ```
33
38
 
34
39
  Requests are case-insensitive
@@ -5,7 +5,7 @@ module Lita
5
5
  class ChileanBip < Handler
6
6
 
7
7
  REDIS_KEY = 'lita-chilean-bip'
8
- QUERY_URL = 'http://saldobip.com'
8
+ QUERY_URL = 'http://saldobip.com/'
9
9
  PARSE_SELECTOR = '#resultados #datos strong'
10
10
  POST_HEADERS = {
11
11
  'Content-Type' => 'application/x-www-form-urlencoded',
@@ -15,9 +15,9 @@ module Lita
15
15
  'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36'
16
16
  }
17
17
 
18
- route %r{^bip\s*(\d+)}i, :bip_balance, help: { 'bip ...' => 'gets the balance for BIP card ...' }
19
- route %r{^my bip is (\d+)}i, :store_bip, help: { 'my bip is ...' => "stores the user's BIP card ..." }
20
- route %r{^bip}i, :stored_bip_balance, help: { 'bip' => "gets the balance for stored user's BIP card" }
18
+ route %r{^bip\s*(\d+)$}i, :bip_balance, help: { 'bip ...' => 'gets the balance for BIP card ...' }
19
+ route %r{^my bip is (\d+)$}i, :store_bip, help: { 'my bip is ...' => "stores the user's BIP card ..." }
20
+ route %r{^bip$}i, :stored_bip_balance, help: { 'bip' => "gets the balance for stored user's BIP card" }
21
21
 
22
22
  def bip_balance(response)
23
23
  card_number = card_number_from_response(response)
@@ -61,13 +61,7 @@ module Lita
61
61
  end
62
62
 
63
63
  def post_query_for_card(card_number)
64
- conn = Faraday.new(:url => QUERY_URL) do |faraday|
65
- faraday.request :url_encoded # form-encode POST params
66
- faraday.response :logger # log requests to STDOUT
67
- faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
68
- end
69
- response = conn.post '/', { NumTarjeta: card_number, pedirSaldo: '' }, POST_HEADERS
70
- response.body
64
+ http.post(QUERY_URL, { NumTarjeta: card_number, pedirSaldo: '' }, POST_HEADERS).body
71
65
  end
72
66
 
73
67
  def parse_data_from_html(response)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-chilean-bip'
3
- spec.version = '1.1.1'
3
+ spec.version = '1.1.2'
4
4
  spec.authors = ['Emilio Figueroa']
5
5
  spec.email = ['emiliofigueroatorres@gmail.com']
6
6
  spec.description = %q{A Lita handler for checking the BIP card balance}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-chilean-bip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emilio Figueroa