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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1511af4363e4e06fcda3d7a5d18d9590e0822427
4
- data.tar.gz: edadbf7da85ec3453a1dd24da95eddb45020c808
3
+ metadata.gz: 2ab5fbf548b92cce710cf6bcd23cde127ecc2d8c
4
+ data.tar.gz: aceed0c92c2c1fa50f8c7ea39cadfbb50744b087
5
5
  SHA512:
6
- metadata.gz: 5b1025d10ec7247cb897ec34ced14a98ea60c8dac680df4769d56cd6679f307595d96f7dcad2ff649d416676b476ad37c291b5916772e92b190b3e5e8406c11f
7
- data.tar.gz: 19ff2c288cbad0a17452fbfa8e84960b76e88af15c93f217c45c91ba6cef3aa2fff89bc853b98f3eb88a36a540b8feeb9c54edfa6a0da39d172ea0512fa2d7e4
6
+ metadata.gz: 2dcec4245534132279d067c1db6cc616db36eafa285471b60479c64db8e5d15454f4f6a911b3ce730496527bd3ff678614dbed98eec452c6ec1ffaf4501fb8d8
7
+ data.tar.gz: ae099988c68b048565ccb499c5f0cf1c592162b2027e67a4ba73da4f922696d6c3ebd5d3931463f7ec6cceaa212fb952fd1ccf2bbf9f42ab27031e44c468283c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
data/lib/venmo.rb CHANGED
@@ -1,8 +1,10 @@
1
1
  require 'venmo/config'
2
2
  require 'venmo/sender'
3
+ require 'venmo/pay'
3
4
 
4
5
  module Venmo
5
6
  extend Config
7
+ extend Pay
6
8
 
7
9
  def self.configure
8
10
  yield self
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.1.1"
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.1.1
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