bamboozled_panda 0.0.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 +7 -0
- data/lib/bamboozled_panda.rb +54 -0
- metadata +44 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 5f8ac117e0785151b1621171acff066e786f99e5
|
|
4
|
+
data.tar.gz: 39ccdef27c5130a1e19bfbe8efdb7ee6f6145fc8
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: cf5d708147d478028962a32b890336c147172b7750b2a3aff165391a9353ede4e45f98bf0770a6a3cad84b58b7210b73a1294e8441a4af1ad155aa48fd41f903
|
|
7
|
+
data.tar.gz: 559ca020ac00117841a570675aa9177d609ea973b76e49426f970f054ebc7247f7ee81416532e1369c0bda8a16b0fabee45d5d455ca52f4cd4f2d4232ea5fa38
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require 'net/http'
|
|
2
|
+
require 'uri'
|
|
3
|
+
|
|
4
|
+
module BamboozledPanda
|
|
5
|
+
|
|
6
|
+
# Panda Pay takes 1% + 2.9% + 30c per donation from credit/debit card donations
|
|
7
|
+
# 1% + 25c per donation from ACH donations, but to get this we need to talk to them more
|
|
8
|
+
|
|
9
|
+
# this is used to create a "pool" of money from which we will take when using `transfer_to_grant`
|
|
10
|
+
def self.create_donation(amount, source, email, secret_key)
|
|
11
|
+
uri = URI.parse("https://api.pandapay.io/v1/donations")
|
|
12
|
+
request = Net::HTTP::Post.new(uri)
|
|
13
|
+
request.basic_auth(secret_key, '')
|
|
14
|
+
request.set_form_data(
|
|
15
|
+
"amount" => amount,
|
|
16
|
+
"currency" => "usd",
|
|
17
|
+
"source" => source,
|
|
18
|
+
"receipt_email" => email
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
req_options = {
|
|
22
|
+
use_ssl: uri.scheme == "https"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
|
|
26
|
+
http.request(request)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
[response.code, response.body]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# I used the id of the California Community College Charity by default
|
|
33
|
+
# This is where we actually send money to a charity
|
|
34
|
+
# PandaPay does not send an email after this function
|
|
35
|
+
def self.create_grant(amount, charity_id = "68-0412350", secret_key)
|
|
36
|
+
uri = URI.parse("https://api.pandapay.io/v1/grants")
|
|
37
|
+
request = Net::HTTP::Post.new(uri)
|
|
38
|
+
request.basic_auth(secret_key, '')
|
|
39
|
+
request.set_form_data(
|
|
40
|
+
"amount" => amount,
|
|
41
|
+
"destination_ein" => charity_id
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
req_options = {
|
|
45
|
+
use_ssl: uri.scheme == "https"
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
|
|
49
|
+
http.request(request)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
[response.code, response.body]
|
|
53
|
+
end
|
|
54
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: bamboozled_panda
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Kaiser Pister
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2017-08-28 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: A simple, easy to use, ruby wrapper for the Panda Pay API
|
|
14
|
+
email: pisterk@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/bamboozled_panda.rb
|
|
20
|
+
homepage: https://github.com/kpister/bamboozled_panda
|
|
21
|
+
licenses:
|
|
22
|
+
- MIT
|
|
23
|
+
metadata: {}
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
34
|
+
requirements:
|
|
35
|
+
- - ">="
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
requirements: []
|
|
39
|
+
rubyforge_project:
|
|
40
|
+
rubygems_version: 2.5.1
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: pandapay.io API wrapper
|
|
44
|
+
test_files: []
|