patreonrb 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.env.example +1 -0
- data/.gitignore +9 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +27 -0
- data/LICENSE.txt +21 -0
- data/README.md +34 -0
- data/Rakefile +1 -0
- data/bin/console +19 -0
- data/bin/setup +8 -0
- data/lib/patreon/client.rb +39 -0
- data/lib/patreon/collection.rb +29 -0
- data/lib/patreon/error.rb +4 -0
- data/lib/patreon/object.rb +24 -0
- data/lib/patreon/objects/address.rb +13 -0
- data/lib/patreon/objects/benefit.rb +13 -0
- data/lib/patreon/objects/campaign.rb +13 -0
- data/lib/patreon/objects/goal.rb +13 -0
- data/lib/patreon/objects/identity.rb +7 -0
- data/lib/patreon/objects/member.rb +35 -0
- data/lib/patreon/objects/tier.rb +13 -0
- data/lib/patreon/objects/user.rb +13 -0
- data/lib/patreon/resource.rb +53 -0
- data/lib/patreon/resources/campaigns.rb +40 -0
- data/lib/patreon/resources/identity.rb +15 -0
- data/lib/patreon/resources/members.rb +19 -0
- data/lib/patreon/version.rb +3 -0
- data/lib/patreon.rb +26 -0
- data/lib/patreonrb.rb +1 -0
- data/patreonrb.gemspec +28 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5ab3e0e7e8c9030e9309ea077b189e5d2afcf8d26848d3b1fcae2611138c4e0e
|
4
|
+
data.tar.gz: caf44ce1048305d57d3e379663a3b0ad85cf7f978de91d7a71d24b1e3d3762d3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ee4009bffbe0e79f9280d80b251ae9081643a7760b468221c6309c1f8a4bcce52bd0a5cd1dab268222c8e759f3a1acb46e073271366273121543f216e2fe5dc0
|
7
|
+
data.tar.gz: 169e6902cb2fd4813cffd916f60414855ea2456a897a1fc903320db4dcc35b95fccc47a9d7369163673d263fc6adacdb65e84805583cfe50096169900829a44c
|
data/.env.example
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
PATREON_ACCESS_TOKEN=
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
patreonrb (0.1.0)
|
5
|
+
faraday (~> 2.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
dotenv (2.7.6)
|
11
|
+
faraday (2.3.0)
|
12
|
+
faraday-net_http (~> 2.0)
|
13
|
+
ruby2_keywords (>= 0.0.4)
|
14
|
+
faraday-net_http (2.0.3)
|
15
|
+
rake (12.3.3)
|
16
|
+
ruby2_keywords (0.0.5)
|
17
|
+
|
18
|
+
PLATFORMS
|
19
|
+
ruby
|
20
|
+
|
21
|
+
DEPENDENCIES
|
22
|
+
dotenv
|
23
|
+
patreonrb!
|
24
|
+
rake (~> 12.0)
|
25
|
+
|
26
|
+
BUNDLED WITH
|
27
|
+
2.3.5
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Dean Perry
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# PatreonRB
|
2
|
+
|
3
|
+
**This library is a work in progress**
|
4
|
+
|
5
|
+
PatreonRB is a Ruby library for interacting with the Patreon V2 API.
|
6
|
+
|
7
|
+
This API isn't great so this library tries to add required fields, such as `user_id` on `Patreon::Member`'s, to
|
8
|
+
make implementing the Patreon API in your application much easier.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem "patreonrb"
|
16
|
+
```
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
### Set Client Details
|
21
|
+
|
22
|
+
Firstly you'll need to set an Access Token, which would be generated using OAuth.
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
@client = Patreon::Client.new(access_token: "")
|
26
|
+
```
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
|
30
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/deanpcmad/patreonrb.
|
31
|
+
|
32
|
+
## License
|
33
|
+
|
34
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "patreon"
|
5
|
+
|
6
|
+
# Load environment variables from .env file
|
7
|
+
require 'dotenv/load'
|
8
|
+
|
9
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
10
|
+
# with your gem easier. You can also use a different console, if you like.
|
11
|
+
|
12
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
13
|
+
# require "pry"
|
14
|
+
# Pry.start
|
15
|
+
|
16
|
+
@client = Patreon::Client.new(access_token: ENV["PATREON_ACCESS_TOKEN"])
|
17
|
+
|
18
|
+
require "irb"
|
19
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
module Patreon
|
2
|
+
class Client
|
3
|
+
BASE_URL = "https://www.patreon.com/api/oauth2/v2"
|
4
|
+
|
5
|
+
attr_reader :access_token, :adapter
|
6
|
+
|
7
|
+
def initialize(access_token:, adapter: Faraday.default_adapter, stubs: nil)
|
8
|
+
@access_token = access_token
|
9
|
+
@adapter = adapter
|
10
|
+
|
11
|
+
# Test stubs for requests
|
12
|
+
@stubs = stubs
|
13
|
+
end
|
14
|
+
|
15
|
+
def identity
|
16
|
+
IdentityResource.new(self)
|
17
|
+
end
|
18
|
+
|
19
|
+
def campaigns
|
20
|
+
CampaignsResource.new(self)
|
21
|
+
end
|
22
|
+
|
23
|
+
def members
|
24
|
+
MembersResource.new(self)
|
25
|
+
end
|
26
|
+
|
27
|
+
def connection
|
28
|
+
@connection ||= Faraday.new(BASE_URL) do |conn|
|
29
|
+
conn.request :authorization, :Bearer, access_token
|
30
|
+
conn.request :json
|
31
|
+
|
32
|
+
conn.response :json, content_type: "application/vnd.api+json"
|
33
|
+
|
34
|
+
conn.adapter adapter, @stubs
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Patreon
|
2
|
+
class Collection
|
3
|
+
attr_reader :data, :total
|
4
|
+
|
5
|
+
def self.from_response(response, type:, key: nil)
|
6
|
+
body = response.body
|
7
|
+
|
8
|
+
if key.is_a?(String)
|
9
|
+
if body[key]
|
10
|
+
data = body[key].map { |attrs| type.new(attrs) }
|
11
|
+
else
|
12
|
+
data = []
|
13
|
+
end
|
14
|
+
else
|
15
|
+
data = body.map { |attrs| type.new(attrs) }
|
16
|
+
end
|
17
|
+
|
18
|
+
new(
|
19
|
+
data: data,
|
20
|
+
total: data.count
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(data:, total:)
|
25
|
+
@data = data
|
26
|
+
@total = total
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "ostruct"
|
2
|
+
|
3
|
+
module Patreon
|
4
|
+
class Object < OpenStruct
|
5
|
+
def initialize(attributes)
|
6
|
+
super to_ostruct(attributes)
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_ostruct(obj)
|
10
|
+
if obj.is_a?(Hash)
|
11
|
+
if obj["attributes"]
|
12
|
+
# Merge the attributes
|
13
|
+
OpenStruct.new(obj["attributes"].map { |key, val| [key, to_ostruct(val)] }.to_h)
|
14
|
+
else
|
15
|
+
OpenStruct.new(obj.map { |key, val| [key, to_ostruct(val)] }.to_h)
|
16
|
+
end
|
17
|
+
elsif obj.is_a?(Array)
|
18
|
+
obj.map { |o| to_ostruct(o) }
|
19
|
+
else # Assumed to be a primitive value
|
20
|
+
obj
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Patreon
|
2
|
+
class Address < Patreon::Object
|
3
|
+
|
4
|
+
DEFAULT_FIELDS = "addressee,city,country,created_at,line_1,line_2,phone_number,postal_code,state"
|
5
|
+
|
6
|
+
def initialize(options = {})
|
7
|
+
super options
|
8
|
+
|
9
|
+
self.id = options["id"] if options["id"]
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Patreon
|
2
|
+
class Benefit < Patreon::Object
|
3
|
+
|
4
|
+
DEFAULT_FIELDS = "app_external_id,app_meta,benefit_type,created_at,deliverables_due_today_count,delivered_deliverables_count,description,is_deleted,is_ended,is_published,next_deliverable_due_date,not_delivered_deliverables_count,rule_type,tiers_count,title"
|
5
|
+
|
6
|
+
def initialize(options = {})
|
7
|
+
super options
|
8
|
+
|
9
|
+
self.id = options["id"] if options["id"]
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Patreon
|
2
|
+
class Campaign < Patreon::Object
|
3
|
+
|
4
|
+
DEFAULT_FIELDS = "created_at,creation_name,discord_server_id,google_analytics_id,has_rss,has_sent_rss_notify,image_small_url,image_url,is_charged_immediately,is_monthly,is_nsfw,main_video_embed,main_video_url,one_liner,patron_count,pay_per_name,pledge_url,published_at,rss_artwork_url,rss_feed_title,show_earnings,summary,thanks_embed,thanks_msg,thanks_video_url,url,vanity"
|
5
|
+
|
6
|
+
def initialize(options = {})
|
7
|
+
super options
|
8
|
+
|
9
|
+
self.id = options["id"] if options["id"]
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Patreon
|
2
|
+
class Goal < Patreon::Object
|
3
|
+
|
4
|
+
DEFAULT_FIELDS = "amount_cents,completed_percentage,created_at,description,reached_at,title"
|
5
|
+
|
6
|
+
def initialize(options = {})
|
7
|
+
super options
|
8
|
+
|
9
|
+
self.id = options["id"] if options["id"]
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Patreon
|
2
|
+
class Member < Patreon::Object
|
3
|
+
|
4
|
+
DEFAULT_FIELDS = "campaign_lifetime_support_cents,currently_entitled_amount_cents,email,full_name,is_follower,last_charge_date,last_charge_status,lifetime_support_cents,next_charge_date,note,patron_status,pledge_cadence,pledge_relationship_start,will_pay_amount_cents"
|
5
|
+
|
6
|
+
def initialize(options = {})
|
7
|
+
super options
|
8
|
+
|
9
|
+
self.id = options["id"] if options["id"]
|
10
|
+
|
11
|
+
if options["relationships"] && options["relationships"]["currently_entitled_tiers"]
|
12
|
+
self.currently_entitled_tiers = options["relationships"]["currently_entitled_tiers"]["data"]
|
13
|
+
end
|
14
|
+
|
15
|
+
if options["relationships"]
|
16
|
+
self.relationships = options["relationships"].map {|r| { r[0] => r[1]['data']['id'] } }
|
17
|
+
|
18
|
+
options["relationships"].each do |rel|
|
19
|
+
rel_type = rel[1]["data"]["type"]
|
20
|
+
rel_id = rel[1]["data"]["id"]
|
21
|
+
|
22
|
+
case rel_type
|
23
|
+
when "user"
|
24
|
+
self.user_id = rel_id
|
25
|
+
when "campaign"
|
26
|
+
self.campaign_id = rel_id
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# self.included = options["included"]
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Patreon
|
2
|
+
class Tier < Patreon::Object
|
3
|
+
|
4
|
+
DEFAULT_FIELDS = "amount_cents,created_at,description,discord_role_ids,edited_at,image_url,patron_count,post_count,published,published_at,remaining,requires_shipping,title,unpublished_at,url,user_limit"
|
5
|
+
|
6
|
+
def initialize(options = {})
|
7
|
+
super options
|
8
|
+
|
9
|
+
self.id = options["id"] if options["id"]
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Patreon
|
2
|
+
class User < Patreon::Object
|
3
|
+
|
4
|
+
DEFAULT_FIELDS = "about,can_see_nsfw,created,email,first_name,full_name,hide_pledges,image_url,is_email_verified,last_name,like_count,social_connections,thumb_url,url,vanity"
|
5
|
+
|
6
|
+
def initialize(options = {})
|
7
|
+
super options
|
8
|
+
|
9
|
+
self.id = options["id"] if options["id"]
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Patreon
|
2
|
+
class Resource
|
3
|
+
attr_reader :client
|
4
|
+
|
5
|
+
def initialize(client)
|
6
|
+
@client = client
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def get_request(url, params: {}, headers: {})
|
12
|
+
handle_response client.connection.get(url, params, headers)
|
13
|
+
end
|
14
|
+
|
15
|
+
def post_request(url, body:, headers: {})
|
16
|
+
handle_response client.connection.post(url, body, headers)
|
17
|
+
end
|
18
|
+
|
19
|
+
def patch_request(url, body:, headers: {})
|
20
|
+
handle_response client.connection.patch(url, body, headers)
|
21
|
+
end
|
22
|
+
|
23
|
+
def put_request(url, body:, headers: {})
|
24
|
+
handle_response client.connection.put(url, body, headers)
|
25
|
+
end
|
26
|
+
|
27
|
+
def delete_request(url, params: {}, headers: {})
|
28
|
+
handle_response client.connection.delete(url, params, headers)
|
29
|
+
end
|
30
|
+
|
31
|
+
def handle_response(response)
|
32
|
+
case response.status
|
33
|
+
when 400
|
34
|
+
raise Error, "Error 400: Your request was malformed. '#{response.body}'"
|
35
|
+
when 401
|
36
|
+
raise Error, "Error 401: You did not supply valid authentication credentials."
|
37
|
+
when 403
|
38
|
+
raise Error, "Error 403: You are not allowed to perform that action."
|
39
|
+
when 404
|
40
|
+
raise Error, "Error 404: No results were found for your request."
|
41
|
+
when 409
|
42
|
+
raise Error, "Error 409: Your request was a conflict."
|
43
|
+
when 429
|
44
|
+
raise Error, "Error 429: Your request exceeded the API rate limit."
|
45
|
+
when 500
|
46
|
+
raise Error, "Error 500: We were unable to perform the request due to server-side problems."
|
47
|
+
when 503
|
48
|
+
raise Error, "Error 503: You have been rate limited for sending more than 20 requests per second."
|
49
|
+
end
|
50
|
+
response
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Patreon
|
2
|
+
class CampaignsResource < Resource
|
3
|
+
|
4
|
+
def list(fields: Campaign::DEFAULT_FIELDS)
|
5
|
+
response = get_request("campaigns?fields[campaign]=#{fields}")
|
6
|
+
Collection.from_response(response, type: Campaign, key: "data")
|
7
|
+
end
|
8
|
+
|
9
|
+
def retrieve(id:, fields: Campaign::DEFAULT_FIELDS)
|
10
|
+
response = get_request("campaigns/#{id}?fields[campaign]=#{fields}")
|
11
|
+
Campaign.new response.body.dig("data")
|
12
|
+
end
|
13
|
+
|
14
|
+
def tiers(id:, fields: Tier::DEFAULT_FIELDS)
|
15
|
+
response = get_request("campaigns/#{id}?include=tiers&fields[tier]=#{fields}")
|
16
|
+
Collection.from_response(response, type: Tier, key: "included")
|
17
|
+
end
|
18
|
+
|
19
|
+
def creator(id:, fields: User::DEFAULT_FIELDS)
|
20
|
+
response = get_request("campaigns/#{id}?include=creator&fields[user]=#{fields}")
|
21
|
+
User.new response.body.dig("included")[0]
|
22
|
+
end
|
23
|
+
|
24
|
+
def benefits(id:, fields: Benefit::DEFAULT_FIELDS)
|
25
|
+
response = get_request("campaigns/#{id}?include=benefits&fields[benefit]=#{fields}")
|
26
|
+
Collection.from_response(response, type: Benefit, key: "included")
|
27
|
+
end
|
28
|
+
|
29
|
+
def goals(id:, fields: Goal::DEFAULT_FIELDS)
|
30
|
+
response = get_request("campaigns/#{id}?include=goals&fields[goal]=#{fields}")
|
31
|
+
Collection.from_response(response, type: Goal, key: "included")
|
32
|
+
end
|
33
|
+
|
34
|
+
def members(id:, member_fields: Member::DEFAULT_FIELDS, user_fields: User::DEFAULT_FIELDS, campaign_fields: Campaign::DEFAULT_FIELDS)
|
35
|
+
response = get_request("campaigns/#{id}/members?include=user,campaign&fields[member]=#{member_fields}&fields[user]=#{user_fields}&fields[campaign]=#{campaign_fields}")
|
36
|
+
Collection.from_response(response, type: Member, key: "data")
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Patreon
|
2
|
+
class IdentityResource < Resource
|
3
|
+
|
4
|
+
def retrieve(fields: Identity::DEFAULT_FIELDS)
|
5
|
+
response = get_request("identity?fields[user]=#{fields}")
|
6
|
+
User.new response.body["data"]
|
7
|
+
end
|
8
|
+
|
9
|
+
def memberships(fields: Member::DEFAULT_FIELDS)
|
10
|
+
response = get_request("identity?include=memberships&fields[member]=#{fields}")
|
11
|
+
Collection.from_response(response, type: Member, key: "included")
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Patreon
|
2
|
+
class MembersResource < Resource
|
3
|
+
|
4
|
+
def retrieve(member_id:, fields: Member::DEFAULT_FIELDS)
|
5
|
+
|
6
|
+
response = get_request("members/#{member_id}?include=currently_entitled_tiers&fields[member]=#{fields}&fields[tier]=#{Tier::DEFAULT_FIELDS}")#.body#.dig("data")[0]
|
7
|
+
response.body
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
def address(member_id:, fields: Address::DEFAULT_FIELDS)
|
12
|
+
|
13
|
+
response = get_request("members/#{member_id}?include=address&fields[address]=#{fields}")#.body#.dig("data")[0]
|
14
|
+
response.body
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/lib/patreon.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "faraday"
|
2
|
+
require "json"
|
3
|
+
require "patreon/version"
|
4
|
+
|
5
|
+
module Patreon
|
6
|
+
|
7
|
+
autoload :Client, "patreon/client"
|
8
|
+
autoload :Collection, "patreon/collection"
|
9
|
+
autoload :Error, "patreon/error"
|
10
|
+
autoload :Resource, "patreon/resource"
|
11
|
+
autoload :Object, "patreon/object"
|
12
|
+
|
13
|
+
autoload :IdentityResource, "patreon/resources/identity"
|
14
|
+
autoload :CampaignsResource, "patreon/resources/campaigns"
|
15
|
+
autoload :MembersResource, "patreon/resources/members"
|
16
|
+
|
17
|
+
autoload :Identity, "patreon/objects/identity"
|
18
|
+
autoload :Campaign, "patreon/objects/campaign"
|
19
|
+
autoload :Member, "patreon/objects/member"
|
20
|
+
autoload :Benefit, "patreon/objects/benefit"
|
21
|
+
autoload :Tier, "patreon/objects/tier"
|
22
|
+
autoload :User, "patreon/objects/user"
|
23
|
+
autoload :Goal, "patreon/objects/goal"
|
24
|
+
autoload :Address, "patreon/objects/address"
|
25
|
+
|
26
|
+
end
|
data/lib/patreonrb.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "patreon"
|
data/patreonrb.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative 'lib/patreon/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "patreonrb"
|
5
|
+
spec.version = Patreon::VERSION
|
6
|
+
spec.authors = ["Dean Perry"]
|
7
|
+
spec.email = ["dean@deanpcmad.com"]
|
8
|
+
|
9
|
+
spec.summary = "A Ruby library for interacting with the Patreon V2 API"
|
10
|
+
spec.homepage = "https://deanpcmad.com"
|
11
|
+
spec.license = "MIT"
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
13
|
+
|
14
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
15
|
+
spec.metadata["source_code_uri"] = "https://github.com/deanpcmad/patreonrb"
|
16
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
17
|
+
|
18
|
+
# Specify which files should be added to the gem when it is released.
|
19
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
end
|
23
|
+
spec.bindir = "exe"
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
|
27
|
+
spec.add_dependency "faraday", "~> 2.0"
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: patreonrb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dean Perry
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-06-06 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: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- dean@deanpcmad.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".env.example"
|
35
|
+
- ".gitignore"
|
36
|
+
- Gemfile
|
37
|
+
- Gemfile.lock
|
38
|
+
- LICENSE.txt
|
39
|
+
- README.md
|
40
|
+
- Rakefile
|
41
|
+
- bin/console
|
42
|
+
- bin/setup
|
43
|
+
- lib/patreon.rb
|
44
|
+
- lib/patreon/client.rb
|
45
|
+
- lib/patreon/collection.rb
|
46
|
+
- lib/patreon/error.rb
|
47
|
+
- lib/patreon/object.rb
|
48
|
+
- lib/patreon/objects/address.rb
|
49
|
+
- lib/patreon/objects/benefit.rb
|
50
|
+
- lib/patreon/objects/campaign.rb
|
51
|
+
- lib/patreon/objects/goal.rb
|
52
|
+
- lib/patreon/objects/identity.rb
|
53
|
+
- lib/patreon/objects/member.rb
|
54
|
+
- lib/patreon/objects/tier.rb
|
55
|
+
- lib/patreon/objects/user.rb
|
56
|
+
- lib/patreon/resource.rb
|
57
|
+
- lib/patreon/resources/campaigns.rb
|
58
|
+
- lib/patreon/resources/identity.rb
|
59
|
+
- lib/patreon/resources/members.rb
|
60
|
+
- lib/patreon/version.rb
|
61
|
+
- lib/patreonrb.rb
|
62
|
+
- patreonrb.gemspec
|
63
|
+
homepage: https://deanpcmad.com
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
metadata:
|
67
|
+
homepage_uri: https://deanpcmad.com
|
68
|
+
source_code_uri: https://github.com/deanpcmad/patreonrb
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.3.0
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubygems_version: 3.3.7
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: A Ruby library for interacting with the Patreon V2 API
|
88
|
+
test_files: []
|