engiven 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +56 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +28 -0
- data/LICENSE +21 -0
- data/README.md +50 -0
- data/Rakefile +11 -0
- data/engiven.gemspec +26 -0
- data/lib/engiven/client.rb +65 -0
- data/lib/engiven/resources/customer.rb +29 -0
- data/lib/engiven/resources/fund.rb +21 -0
- data/lib/engiven/resources/gift.rb +13 -0
- data/lib/engiven/version.rb +3 -0
- data/lib/engiven.rb +4 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '08bb5243acb2061c18e7e6751f700265379487c33daeb07559b03bf7baa5c463'
|
4
|
+
data.tar.gz: c831fa60265ab8b2b67ab4c80aa48b3bb4edfa3362d442a2ea11b82064f27c5f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5ce36461834c680df2c1cb2f9e4cf17290fe903d04610eea726f5a95b2d4629837482b8aa6a336039f9295274828f2299d7cf3ed5a8db1c00e534168939f137a
|
7
|
+
data.tar.gz: b806b02da1b82a922e23a28f5ae0b1b2969d606cd98120fbe93a12a4eb07c64c10c950dccbffdad33d8374155c3d9112317e799292e876736cb090c36d5340e4
|
data/.gitignore
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
# Ignore Byebug command history file.
|
17
|
+
.byebug_history
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/lib/bundler/man/
|
45
|
+
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
48
|
+
# Gemfile.lock
|
49
|
+
# .ruby-version
|
50
|
+
# .ruby-gemset
|
51
|
+
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
+
.rvmrc
|
54
|
+
|
55
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
56
|
+
# .rubocop-https?--*
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
engiven (0.0.1)
|
5
|
+
faraday
|
6
|
+
json
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
faraday (2.6.0)
|
12
|
+
faraday-net_http (>= 2.0, < 3.1)
|
13
|
+
ruby2_keywords (>= 0.0.4)
|
14
|
+
faraday-net_http (3.0.1)
|
15
|
+
json (2.6.2)
|
16
|
+
rake (13.0.6)
|
17
|
+
ruby2_keywords (0.0.5)
|
18
|
+
|
19
|
+
PLATFORMS
|
20
|
+
arm64-darwin-21
|
21
|
+
|
22
|
+
DEPENDENCIES
|
23
|
+
bundler
|
24
|
+
engiven!
|
25
|
+
rake
|
26
|
+
|
27
|
+
BUNDLED WITH
|
28
|
+
2.3.19
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2022 Taylor Brooks
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# engiven-api
|
2
|
+
A Ruby wrapper for the Engiven.com API
|
3
|
+
|
4
|
+
Learn about the Engiven API at https://apidocs.engiven.com
|
5
|
+
|
6
|
+
### Installation
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
````ruby
|
9
|
+
# in your Gemfile
|
10
|
+
gem 'engiven', '~> 0.0.1'
|
11
|
+
|
12
|
+
# then...
|
13
|
+
bundle install
|
14
|
+
````
|
15
|
+
|
16
|
+
### Usage
|
17
|
+
````ruby
|
18
|
+
api_key = 'YOUR_API_KEY_HERE'
|
19
|
+
client = EngivenAPI::Client.new(api_key: api_key)
|
20
|
+
|
21
|
+
# List Customers
|
22
|
+
client.list_customers(params)
|
23
|
+
|
24
|
+
# Create a Customer
|
25
|
+
client.create_customer(params)
|
26
|
+
|
27
|
+
# Find a Customer
|
28
|
+
client.find_customer(id)
|
29
|
+
|
30
|
+
# Update a Customer
|
31
|
+
client.update_customer(id, params)
|
32
|
+
|
33
|
+
# List Funds
|
34
|
+
client.list_funds(params)
|
35
|
+
|
36
|
+
# Create a Fund
|
37
|
+
client.create_fund(params)
|
38
|
+
|
39
|
+
# Find a Fund
|
40
|
+
client.find_fund(id)
|
41
|
+
|
42
|
+
# Update a Fund
|
43
|
+
client.update_fund(id, params)
|
44
|
+
|
45
|
+
# List Gifts
|
46
|
+
client.list_gifts(params)
|
47
|
+
|
48
|
+
# Create a Pledged Gift
|
49
|
+
client.create_pledged_gift(params)
|
50
|
+
````
|
data/Rakefile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
|
3
|
+
require 'rdoc/task'
|
4
|
+
Rake::RDocTask.new do |rdoc|
|
5
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ''
|
6
|
+
|
7
|
+
rdoc.rdoc_dir = 'rdoc'
|
8
|
+
rdoc.title = "engiven #{version}"
|
9
|
+
rdoc.rdoc_files.include('README*')
|
10
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
11
|
+
end
|
data/engiven.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
require 'engiven/version'
|
3
|
+
require 'base64'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'engiven'
|
7
|
+
s.version = EngivenAPI::VERSION
|
8
|
+
s.authors = ['Taylor Brooks']
|
9
|
+
s.email = ['dGJyb29rc0BnbWFpbC5jb20='].map { |e| Base64.decode64(e) }
|
10
|
+
s.homepage = 'https://github.com/taylorbrooks/engiven-api'
|
11
|
+
s.summary = 'A Ruby wrapper for the Engiven API'
|
12
|
+
s.description = 'A Ruby wrapper for the Engiven API -- a service for accepting cryptocurrency donations.'
|
13
|
+
s.license = 'MIT'
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split($/)
|
16
|
+
s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
17
|
+
s.test_files = s.files.grep(%r{^(test)/})
|
18
|
+
|
19
|
+
s.require_paths = ['lib']
|
20
|
+
|
21
|
+
s.add_runtime_dependency 'faraday'
|
22
|
+
s.add_runtime_dependency 'json'
|
23
|
+
|
24
|
+
s.add_development_dependency 'bundler'
|
25
|
+
s.add_development_dependency 'rake'
|
26
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
|
3
|
+
require './lib/engiven/version'
|
4
|
+
require './lib/engiven/resources/customer'
|
5
|
+
require './lib/engiven/resources/fund'
|
6
|
+
require './lib/engiven/resources/gift'
|
7
|
+
|
8
|
+
module EngivenAPI
|
9
|
+
class Client
|
10
|
+
include EngivenAPI::Client::Customer
|
11
|
+
include EngivenAPI::Client::Fund
|
12
|
+
include EngivenAPI::Client::Gift
|
13
|
+
|
14
|
+
attr_reader :api_key, :test_mode, :logger, :connection, :adapter, :ssl
|
15
|
+
|
16
|
+
def initialize(api_key:, test_mode: false, logger: true, adapter: Faraday.default_adapter, ssl: nil)
|
17
|
+
@api_key = api_key
|
18
|
+
@test_mode = test_mode
|
19
|
+
@logger = logger
|
20
|
+
@adapter = adapter
|
21
|
+
end
|
22
|
+
|
23
|
+
def delete(path, options = {})
|
24
|
+
connection.delete(path, options).body
|
25
|
+
end
|
26
|
+
|
27
|
+
def get(path, options = {})
|
28
|
+
connection.get(path, options).body
|
29
|
+
end
|
30
|
+
|
31
|
+
def post(path, options = {})
|
32
|
+
connection.post(path, options).body
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def url
|
38
|
+
return 'https://api.sandbox.engiven.com' if test_mode
|
39
|
+
|
40
|
+
'https://api.engiven.com'
|
41
|
+
end
|
42
|
+
|
43
|
+
def connection
|
44
|
+
headers = {
|
45
|
+
accept: 'application/json',
|
46
|
+
'Authorization' => api_key,
|
47
|
+
'User-Agent' => "engiven-api-ruby-gem/v#{EngivenAPI::VERSION}",
|
48
|
+
}
|
49
|
+
|
50
|
+
client_opts = {
|
51
|
+
url: url,
|
52
|
+
headers: headers
|
53
|
+
}
|
54
|
+
|
55
|
+
client_opts[:ssl] = ssl if ssl
|
56
|
+
|
57
|
+
Faraday.new(client_opts) do |conn|
|
58
|
+
conn.request :json
|
59
|
+
conn.response :logger if logger
|
60
|
+
conn.response :json
|
61
|
+
conn.adapter adapter
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module EngivenAPI
|
2
|
+
class Client
|
3
|
+
module Customer
|
4
|
+
def list_customers(options = {})
|
5
|
+
get('/customers', options)
|
6
|
+
end
|
7
|
+
|
8
|
+
def create_customer(options = {})
|
9
|
+
post('/customers', options)
|
10
|
+
end
|
11
|
+
|
12
|
+
def find_customer(id)
|
13
|
+
get("/customers/#{id}")
|
14
|
+
end
|
15
|
+
|
16
|
+
def update_customer(id, options = {})
|
17
|
+
post("/customers/#{id}", options)
|
18
|
+
end
|
19
|
+
|
20
|
+
def upload_logo(id, options)
|
21
|
+
post("/customers/#{id}/logo", options)
|
22
|
+
end
|
23
|
+
|
24
|
+
def remove_logo(id)
|
25
|
+
post("/customers/#{id}/logo")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module EngivenAPI
|
2
|
+
class Client
|
3
|
+
module Fund
|
4
|
+
def list_funds(options = {})
|
5
|
+
get('/funds', options)
|
6
|
+
end
|
7
|
+
|
8
|
+
def create_fund(options = {})
|
9
|
+
post('/funds', options)
|
10
|
+
end
|
11
|
+
|
12
|
+
def find_fund(id)
|
13
|
+
get("/funds/#{id}")
|
14
|
+
end
|
15
|
+
|
16
|
+
def update_fund(id, options = {})
|
17
|
+
post("/funds/#{id}", options)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/engiven.rb
ADDED
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: engiven
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Taylor Brooks
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-10-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A Ruby wrapper for the Engiven API -- a service for accepting cryptocurrency
|
70
|
+
donations.
|
71
|
+
email:
|
72
|
+
- tbrooks@gmail.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- Gemfile
|
79
|
+
- Gemfile.lock
|
80
|
+
- LICENSE
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- engiven.gemspec
|
84
|
+
- lib/engiven.rb
|
85
|
+
- lib/engiven/client.rb
|
86
|
+
- lib/engiven/resources/customer.rb
|
87
|
+
- lib/engiven/resources/fund.rb
|
88
|
+
- lib/engiven/resources/gift.rb
|
89
|
+
- lib/engiven/version.rb
|
90
|
+
homepage: https://github.com/taylorbrooks/engiven-api
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubygems_version: 3.1.6
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: A Ruby wrapper for the Engiven API
|
113
|
+
test_files: []
|