textveloper 0.1.0 → 0.1.1
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 +4 -4
- data/README.md +59 -4
- data/lib/textveloper.rb +23 -28
- data/lib/textveloper/version.rb +1 -1
- data/spec/lib/textveloper_spec.rb +2 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2edf9195001250d49b7cb74f41b81a9c5d58e8b
|
4
|
+
data.tar.gz: 64cd8220247eb7d2e8c9cf2f1f920a49a482087c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78460f4e90fa6c864db476e44f0e43375b05ce3365f8d2074fd75af49e2bfb37e31831f13db53eb3363894f630ea339b587cd41497603a2ac139b92e368e3c84
|
7
|
+
data.tar.gz: d93e9300659a0f3571b62631a5d7a58f81e89333bb3c2800b7f0c5f9485b69db48ff2a91c8fdfcf186f40fe3c0ec88948392c6aefbd65abb0a16eae424307ef1
|
data/README.md
CHANGED
@@ -68,16 +68,71 @@ Retorna un hash con la respuesta asociada a cada número telefónico
|
|
68
68
|
### Historial
|
69
69
|
|
70
70
|
#### Transferencias
|
71
|
-
|
72
|
-
|
71
|
+
#### Consulta de transferencia de puntos a subcuentas
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
sms.transfer_history
|
75
|
+
```
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
{
|
79
|
+
"transaccion"=>"exitosa",
|
80
|
+
"historico"=>[{"codigo_transaccion"=>"13", "fecha"=>"2013-09-24 00:29:13", "cantidad"=>"50"}]
|
81
|
+
}
|
82
|
+
```
|
73
83
|
#### Mensajes Enviados
|
74
|
-
|
84
|
+
|
85
|
+
#### Consulta de mensajes enviados por cuenta
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
sms.account_history
|
89
|
+
```
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
{
|
93
|
+
"transaccion"=>"exitosa",
|
94
|
+
"historico"=>
|
95
|
+
[
|
96
|
+
{"codigo_log"=>"100", "telefono"=>"04141234567", "estatus"=>"Enviado", "mensaje"=>"Hola Mundo", "fecha"=>"2013-09-23 23:20:07"},
|
97
|
+
{"codigo_log"=>"101", "telefono"=>"04129876543", "estatus"=>"Enviado", "mensaje"=>"Hola Marte", "fecha"=>"2013-09-23 23:24:43"}
|
98
|
+
]
|
99
|
+
}
|
100
|
+
```
|
75
101
|
|
76
102
|
#### Compras
|
77
103
|
Pendiente
|
78
104
|
|
79
105
|
### Consulta de Puntos
|
80
|
-
|
106
|
+
|
107
|
+
#### Consulta de puntos por cuenta
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
sms.account_balance
|
111
|
+
```
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
{"transaccion"=>"exitosa", "puntos_utilizados"=>"54", "total_puntos"=>"100", "puntos_disponibles"=>"46"}
|
115
|
+
```
|
116
|
+
|
117
|
+
`puntos_utilizados` todos los puntos que fueron transferidos a las distintas subcuentas
|
118
|
+
|
119
|
+
`total_puntos` todos los puntos adquiridos
|
120
|
+
|
121
|
+
`puntos_disponibles` todos los puntos que aún no han sido utilizados
|
122
|
+
|
123
|
+
#### Consulta de Puntos por subcuenta
|
124
|
+
|
125
|
+
Las subcuentas deben ser limitadas y tener un numero finito de puntos(mensajes)
|
126
|
+
|
127
|
+
|
128
|
+
```ruby
|
129
|
+
sms.subaccount_balance
|
130
|
+
```
|
131
|
+
|
132
|
+
```ruby
|
133
|
+
{"transaccion"=>"exitosa", "puntos_enviados"=>"2", "total_puntos"=>"50", "puntos_disponibles"=>"48"}
|
134
|
+
```
|
135
|
+
|
81
136
|
|
82
137
|
|
83
138
|
|
data/lib/textveloper.rb
CHANGED
@@ -50,56 +50,51 @@ module Textveloper
|
|
50
50
|
show_format_response(numbers,response)
|
51
51
|
end
|
52
52
|
|
53
|
-
#Historial de Transacciones
|
53
|
+
#Historial de Transacciones
|
54
54
|
|
55
|
-
def
|
56
|
-
|
55
|
+
def transactional_data
|
56
|
+
{
|
57
57
|
:cuenta_token => @account_token_number,
|
58
|
+
:subcuenta_token => @subaccount_token_number
|
58
59
|
}
|
59
|
-
|
60
|
-
end
|
60
|
+
end
|
61
61
|
|
62
|
-
def
|
63
|
-
|
62
|
+
def account_data
|
63
|
+
{
|
64
64
|
:cuenta_token => @account_token_number,
|
65
|
-
:subcuenta_token => @subaccount_token_number
|
66
65
|
}
|
67
|
-
hash_contructor(Curl.post(url + api_actions[:puntos_subcuenta] + '/', data).body_str)
|
68
66
|
end
|
69
67
|
|
70
|
-
def
|
71
|
-
|
72
|
-
:cuenta_token => @account_token_number,
|
73
|
-
:subcuenta_token => @subaccount_token_number
|
74
|
-
}
|
75
|
-
hash_contructor(Curl.post(url + api_actions[:envios] + '/',data).body_str)
|
68
|
+
def account_balance
|
69
|
+
hash_contructor(Curl.post(url + api_actions[:puntos_cuenta] + '/', account_data).body_str)
|
76
70
|
end
|
77
71
|
|
78
72
|
def buy_history
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
73
|
+
hash_contructor(Curl.post(url + api_actions[:compras] + '/', account_data).body_str)
|
74
|
+
end
|
75
|
+
|
76
|
+
def subaccount_balance
|
77
|
+
hash_contructor(Curl.post(url + api_actions[:puntos_subcuenta] + '/', transactional_data).body_str)
|
78
|
+
end
|
79
|
+
|
80
|
+
def account_history
|
81
|
+
hash_contructor(Curl.post(url + api_actions[:envios] + '/',transactional_data).body_str)
|
83
82
|
end
|
84
83
|
|
85
84
|
def transfer_history
|
86
|
-
|
87
|
-
:cuenta_token => @account_token_number,
|
88
|
-
:subcuenta_token => @subaccount_token_number
|
89
|
-
}
|
90
|
-
hash_contructor(Curl.post(url + api_actions[:transferencias] + '/',data).body_str)
|
85
|
+
hash_contructor(Curl.post(url + api_actions[:transferencias] + '/',transactional_data).body_str)
|
91
86
|
end
|
92
87
|
|
93
88
|
#metodos de formato de data
|
94
89
|
|
95
90
|
def show_format_response(numbers,response)
|
96
|
-
|
97
|
-
hash_constructor_with_numbers(numbers,response, data)
|
91
|
+
hash_constructor_with_numbers(numbers,response)
|
98
92
|
end
|
99
93
|
|
100
|
-
def hash_constructor_with_numbers(numbers,response
|
94
|
+
def hash_constructor_with_numbers(numbers,response)
|
95
|
+
data = Hash.new
|
101
96
|
numbers.each_with_index do |number, index|
|
102
|
-
data[number.to_sym] = hash_contructor(
|
97
|
+
data[number.to_sym] = hash_contructor(response[index])
|
103
98
|
end
|
104
99
|
data
|
105
100
|
end
|
data/lib/textveloper/version.rb
CHANGED
@@ -40,16 +40,15 @@ describe Textveloper do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
context "asociacion de numeros de telefono con data recibida" do
|
43
|
-
let(:data){Hash.new}
|
44
43
|
let(:numero){["04146578904"]}
|
45
44
|
let(:numeros){["04147890123","04141234567"]}
|
46
45
|
|
47
46
|
it "un telefono" do
|
48
|
-
notificator.hash_constructor_with_numbers(numero,[response]
|
47
|
+
notificator.hash_constructor_with_numbers(numero,[response]).should == {:"04146578904"=>hash_response}
|
49
48
|
end
|
50
49
|
|
51
50
|
it "varios numeros" do
|
52
|
-
notificator.hash_constructor_with_numbers(numeros,[response,response]
|
51
|
+
notificator.hash_constructor_with_numbers(numeros,[response,response]).should == {:"04147890123"=>hash_response,:"04141234567"=>hash_response}
|
53
52
|
end
|
54
53
|
|
55
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: textveloper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gustavo Gimenez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curb
|