venmo 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/venmo.rb +2 -0
- data/lib/venmo/pay.rb +38 -0
- data/lib/venmo/sender.rb +0 -39
- data/venmo.gemspec +2 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ab5fbf548b92cce710cf6bcd23cde127ecc2d8c
|
4
|
+
data.tar.gz: aceed0c92c2c1fa50f8c7ea39cadfbb50744b087
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dcec4245534132279d067c1db6cc616db36eafa285471b60479c64db8e5d15454f4f6a911b3ce730496527bd3ff678614dbed98eec452c6ec1ffaf4501fb8d8
|
7
|
+
data.tar.gz: ae099988c68b048565ccb499c5f0cf1c592162b2027e67a4ba73da4f922696d6c3ebd5d3931463f7ec6cceaa212fb952fd1ccf2bbf9f42ab27031e44c468283c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/venmo.rb
CHANGED
data/lib/venmo/pay.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
module Venmo
|
2
|
+
module Pay
|
3
|
+
def pay_by_email(email, amount, note)
|
4
|
+
@send_hash= common(amount,note, { :email => email})
|
5
|
+
core_pay
|
6
|
+
# -d email= \
|
7
|
+
end
|
8
|
+
|
9
|
+
def pay_by_user_id(user_id, amount, note)
|
10
|
+
@send_hash= common(amount,note, {:user_id => user_id})
|
11
|
+
core_pay
|
12
|
+
# -d user_id= \
|
13
|
+
end
|
14
|
+
|
15
|
+
def pay_by_phone_number(phone_number, amount, note)
|
16
|
+
@send_hash = common(amount,note, {:phone_number=> phone_number})
|
17
|
+
core_pay
|
18
|
+
# -d phone= \
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
def common(new_amount, new_note, merge_in)
|
23
|
+
{
|
24
|
+
amount: new_amount,
|
25
|
+
note: new_note,
|
26
|
+
access_token: Venmo.access_token,
|
27
|
+
audience: (Venmo.privacy || "private")
|
28
|
+
}.merge(merge_in)
|
29
|
+
end
|
30
|
+
|
31
|
+
def core_pay
|
32
|
+
base_url = "curl https://api.venmo.com/payments/?"
|
33
|
+
h = @send_hash.collect{|k,v| "#{k.to_s}=#{v.respond_to?(:gsub) ? CGI::escape(v) : v}"}.join('&')
|
34
|
+
to_send = base_url + h
|
35
|
+
resp = `#{to_send}`
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/venmo/sender.rb
CHANGED
@@ -1,43 +1,4 @@
|
|
1
1
|
module Venmo
|
2
2
|
module Sender
|
3
|
-
|
4
|
-
def pay_by_email(email, amount, note)
|
5
|
-
send_hash= common(amount,note, { :email => email})
|
6
|
-
core_pay
|
7
|
-
# -d email= \
|
8
|
-
end
|
9
|
-
|
10
|
-
def pay_by_user_id(user_id, amount, note
|
11
|
-
send_hash= common(amount,note, {:user_id => user_id})
|
12
|
-
core_pay
|
13
|
-
# -d user_id= \
|
14
|
-
end
|
15
|
-
|
16
|
-
def pay_by_phone_number(phone_number, amount, note)
|
17
|
-
send_hash = common(amount,note, {:phone_number=> phone_number})
|
18
|
-
core_pay
|
19
|
-
# -d phone= \
|
20
|
-
end
|
21
|
-
|
22
|
-
protected
|
23
|
-
def common(amount, note, merge_in)
|
24
|
-
{amount: amount,
|
25
|
-
note: note}.merge(merge_in)
|
26
|
-
end
|
27
|
-
|
28
|
-
def core_pay
|
29
|
-
base_url = "curl https://api.venmo.com/payments \ -d"
|
30
|
-
to_send = base_url+send_hash.join('\ -d')
|
31
|
-
end
|
32
|
-
|
33
|
-
def send_hash=(update_hash)
|
34
|
-
send_hash
|
35
|
-
@send_hash.merge(update_hash)
|
36
|
-
end
|
37
|
-
|
38
|
-
def send_hash
|
39
|
-
@send_hash ||= {access_token: Venmo::Config.access_token,
|
40
|
-
audience: (Venmo::Config.privacy || "private")}
|
41
|
-
end
|
42
3
|
end
|
43
4
|
end
|
data/venmo.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "venmo"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Robert R. Meyer"]
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
"lib/tasks/venmo_tasks.rake",
|
31
31
|
"lib/venmo.rb",
|
32
32
|
"lib/venmo/config.rb",
|
33
|
+
"lib/venmo/pay.rb",
|
33
34
|
"lib/venmo/sender.rb",
|
34
35
|
"test/helper.rb",
|
35
36
|
"test/test_venmo.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: venmo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert R. Meyer
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- lib/tasks/venmo_tasks.rake
|
102
102
|
- lib/venmo.rb
|
103
103
|
- lib/venmo/config.rb
|
104
|
+
- lib/venmo/pay.rb
|
104
105
|
- lib/venmo/sender.rb
|
105
106
|
- test/helper.rb
|
106
107
|
- test/test_venmo.rb
|