patreon 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/CHANGELOG.md +6 -0
- data/LICENSE +1 -1
- data/NOTICE +1 -1
- data/example/fetch_all_patrons.rb +1 -1
- data/lib/patreon.rb +2 -0
- data/lib/patreon/api.rb +13 -3
- data/lib/patreon/oauth.rb +1 -0
- data/lib/patreon/utils/client.rb +11 -0
- data/lib/patreon/version.rb +3 -0
- data/patreon.gemspec +3 -1
- metadata +6 -4
- data/Gemfile.lock +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85f8e4342d5367269d2d626762f48635d644faa2
|
4
|
+
data.tar.gz: 0e4937dfd8eadf081d338027e36c49ac607e8926
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 688fbbca091fc34af6e0f78b85a92b0ffaad3e75f19c15206a2ce166a4c1019dd5db6f44bd6013b9b208f3dc7cfee98f3aca0ede846b3da5ce6699092d3aff52
|
7
|
+
data.tar.gz: fa8cf4c8ae5e76269dc5181e30966d7599e24baf343ba4bcf6b99db7b893aaa31303078f6ac894ff64b66448b7740be10a6272c91e36a2b527a2565199c2d705
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
data/LICENSE
CHANGED
@@ -176,7 +176,7 @@
|
|
176
176
|
|
177
177
|
END OF TERMS AND CONDITIONS
|
178
178
|
|
179
|
-
Copyright 2015-
|
179
|
+
Copyright 2015-2018 Patreon, Inc.
|
180
180
|
|
181
181
|
Licensed under the Apache License, Version 2.0 (the "License");
|
182
182
|
you may not use this file except in compliance with the License.
|
data/NOTICE
CHANGED
data/lib/patreon.rb
CHANGED
data/lib/patreon/api.rb
CHANGED
@@ -2,6 +2,7 @@ require 'net/http'
|
|
2
2
|
require 'cgi'
|
3
3
|
require 'json'
|
4
4
|
require 'json-api-vanilla'
|
5
|
+
require 'openssl'
|
5
6
|
|
6
7
|
module Patreon
|
7
8
|
class API
|
@@ -32,10 +33,19 @@ module Patreon
|
|
32
33
|
private
|
33
34
|
|
34
35
|
def get_json(suffix)
|
35
|
-
|
36
|
-
|
36
|
+
http = Net::HTTP.new("www.patreon.com", 443)
|
37
|
+
http.use_ssl = true
|
38
|
+
|
39
|
+
# TODO: It would be nice if we verified our certs
|
40
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
41
|
+
|
42
|
+
#SECURITY HOLE
|
43
|
+
http.set_debug_output($stdout) if ENV['DEBUG']
|
44
|
+
|
45
|
+
req = Net::HTTP::Get.new("/api/oauth2/api/#{suffix}")
|
37
46
|
req['Authorization'] = "Bearer #{@access_token}"
|
38
|
-
|
47
|
+
req['User-Agent'] = Utils::Client.user_agent_string
|
48
|
+
res = http.request(req)
|
39
49
|
return JSON::Api::Vanilla.parse(res.body)
|
40
50
|
end
|
41
51
|
end
|
data/lib/patreon/oauth.rb
CHANGED
@@ -33,6 +33,7 @@ module Patreon
|
|
33
33
|
url = URI.parse('https://www.patreon.com/api/oauth2/token')
|
34
34
|
url.query = URI.encode_www_form(params)
|
35
35
|
req = Net::HTTP::Post.new(url.to_s)
|
36
|
+
req['User-Agent'] = Utils::Client.user_agent_string
|
36
37
|
res = Net::HTTP.start(url.host, url.port, :use_ssl => true) {|http| http.request(req)}
|
37
38
|
JSON.parse(res.body)
|
38
39
|
end
|
data/patreon.gemspec
CHANGED
@@ -2,9 +2,11 @@
|
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
|
5
|
+
require 'patreon/version'
|
6
|
+
|
5
7
|
Gem::Specification.new do |gem|
|
6
8
|
gem.name = "patreon"
|
7
|
-
gem.version =
|
9
|
+
gem.version = Patreon::VERSION
|
8
10
|
gem.authors = ["Patreon"]
|
9
11
|
gem.email = ["david@patreon.com"]
|
10
12
|
gem.description = "Interact with the Patreon API via OAuth"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: patreon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patreon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-api-vanilla
|
@@ -32,8 +32,8 @@ extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
34
|
- ".gitignore"
|
35
|
+
- CHANGELOG.md
|
35
36
|
- Gemfile
|
36
|
-
- Gemfile.lock
|
37
37
|
- LICENSE
|
38
38
|
- NOTICE
|
39
39
|
- README.md
|
@@ -60,8 +60,10 @@ files:
|
|
60
60
|
- lib/patreon/schemas/pledge.rb
|
61
61
|
- lib/patreon/schemas/reward.rb
|
62
62
|
- lib/patreon/schemas/user.rb
|
63
|
+
- lib/patreon/utils/client.rb
|
63
64
|
- lib/patreon/utils/enum.rb
|
64
65
|
- lib/patreon/utils/jsonapi/url_util.rb
|
66
|
+
- lib/patreon/version.rb
|
65
67
|
- patreon.gemspec
|
66
68
|
homepage: https://github.com/Patreon/patreon-ruby
|
67
69
|
licenses:
|
@@ -83,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
85
|
version: '0'
|
84
86
|
requirements: []
|
85
87
|
rubyforge_project:
|
86
|
-
rubygems_version: 2.
|
88
|
+
rubygems_version: 2.6.14
|
87
89
|
signing_key:
|
88
90
|
specification_version: 4
|
89
91
|
summary: Visit patreon.com/oauth2/documentation for more information.
|