patreon 0.0.2
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/.gitignore +36 -0
- data/lib/patreon.rb +4 -0
- data/lib/patreon/oauth.rb +37 -0
- data/patreon.gemspec +19 -0
- metadata +48 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 0295eee100f406c0b5474203c44b61e7cdeb219a
|
|
4
|
+
data.tar.gz: 73842fc521379bc4b679caaa22a0bb878b8368aa
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ffa98154560b4b4acbf931cdb6b5059334ef51a0768ac2c9e14506691b38174870d0430890ed6ca4ec526f6b8e38d7c56a7d5cf8e88a0aa122884f2d8b017f25
|
|
7
|
+
data.tar.gz: 13754e42fc27838da383cbee46ea0e904483471203f2eb75cf82087262c9e469e9c246477446f0d480993d97ba46a67a7163c04ebe3da682c258e5ec52450a8d
|
data/.gitignore
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
## Specific to RubyMotion:
|
|
14
|
+
.dat*
|
|
15
|
+
.repl_history
|
|
16
|
+
build/
|
|
17
|
+
|
|
18
|
+
## Documentation cache and generated files:
|
|
19
|
+
/.yardoc/
|
|
20
|
+
/_yardoc/
|
|
21
|
+
/doc/
|
|
22
|
+
/rdoc/
|
|
23
|
+
|
|
24
|
+
## Environment normalisation:
|
|
25
|
+
/.bundle/
|
|
26
|
+
/vendor/bundle
|
|
27
|
+
/lib/bundler/man/
|
|
28
|
+
|
|
29
|
+
# for a library or gem, you might want to ignore these files since the code is
|
|
30
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
31
|
+
# Gemfile.lock
|
|
32
|
+
# .ruby-version
|
|
33
|
+
# .ruby-gemset
|
|
34
|
+
|
|
35
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
36
|
+
.rvmrc
|
data/lib/patreon.rb
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Patreon
|
|
2
|
+
class OAuth
|
|
3
|
+
def initialize(client_id, client_secret)
|
|
4
|
+
@client_id = client_id
|
|
5
|
+
@client_secret = client_secret
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def get_tokens(code, redirect_uri)
|
|
9
|
+
update_token({
|
|
10
|
+
"grant_type" => "authorization_code",
|
|
11
|
+
"code" => code,
|
|
12
|
+
"client_id" => @client_id,
|
|
13
|
+
"client_secret" => @client_secret,
|
|
14
|
+
"redirect_uri" => redirect_uri
|
|
15
|
+
})
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def refresh_token(refresh_token, redirect_uri)
|
|
19
|
+
update_token({
|
|
20
|
+
"grant_type" => "refresh_token",
|
|
21
|
+
"refresh_token" => refresh_token,
|
|
22
|
+
"client_id" => @client_id,
|
|
23
|
+
"client_secret" => @client_secret
|
|
24
|
+
})
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def update_token(params)
|
|
30
|
+
url = URI.parse('https://api.patreon.com/oauth2/token')
|
|
31
|
+
url.query = URI.encode_www_form(params)
|
|
32
|
+
req = Net::HTTP::Post.new(url.to_s)
|
|
33
|
+
res = Net::HTTP.start(url.host, url.port, :use_ssl => true) {|http| http.request(req)}
|
|
34
|
+
JSON.parse(res.body)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/patreon.gemspec
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |gem|
|
|
6
|
+
gem.name = "patreon"
|
|
7
|
+
gem.version = "0.0.2"
|
|
8
|
+
gem.authors = ["David Kettler"]
|
|
9
|
+
gem.email = ["david@patreon.com"]
|
|
10
|
+
gem.description = "Interact with the Patreon API via OAuth"
|
|
11
|
+
gem.licenses = ["MIT"]
|
|
12
|
+
gem.summary = "Visit patreon.com/oauth2/documentation for more information."
|
|
13
|
+
gem.homepage = "https://github.com/Patreon/patreon-ruby"
|
|
14
|
+
|
|
15
|
+
gem.files = `git ls-files`.split($/)
|
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
18
|
+
gem.require_paths = ["lib"]
|
|
19
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: patreon
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- David Kettler
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Interact with the Patreon API via OAuth
|
|
14
|
+
email:
|
|
15
|
+
- david@patreon.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- ".gitignore"
|
|
21
|
+
- lib/patreon.rb
|
|
22
|
+
- lib/patreon/oauth.rb
|
|
23
|
+
- patreon.gemspec
|
|
24
|
+
homepage: https://github.com/Patreon/patreon-ruby
|
|
25
|
+
licenses:
|
|
26
|
+
- MIT
|
|
27
|
+
metadata: {}
|
|
28
|
+
post_install_message:
|
|
29
|
+
rdoc_options: []
|
|
30
|
+
require_paths:
|
|
31
|
+
- lib
|
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
33
|
+
requirements:
|
|
34
|
+
- - ">="
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: '0'
|
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - ">="
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '0'
|
|
42
|
+
requirements: []
|
|
43
|
+
rubyforge_project:
|
|
44
|
+
rubygems_version: 2.2.2
|
|
45
|
+
signing_key:
|
|
46
|
+
specification_version: 4
|
|
47
|
+
summary: Visit patreon.com/oauth2/documentation for more information.
|
|
48
|
+
test_files: []
|