funky 0.2.28 → 0.2.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/funky/connections/api.rb +12 -4
- data/lib/funky/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b52ea915d7f3e91a672141136653d9c091d0130b
|
4
|
+
data.tar.gz: b0e29324904b42bed6ec943be492f95f2a23f0df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca8ae886ee93939e33526c1d56632b5e2c7159e840a6ca5f251ca560f95818680aad0a51151710b486fed1fde2376a7d81c3aafb8fe3fe756c72f20be6465dff
|
7
|
+
data.tar.gz: 167a601d285f4c4cd30c18de63ce64b0c8c20f12591a6ed2fd39ea7f4f49e10aae13404a247e693d8be72b2671fc6f7466cc1745c720f88eeaa9967342b5f74e
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,11 @@ For more information about changelogs, check
|
|
6
6
|
[Keep a Changelog](http://keepachangelog.com) and
|
7
7
|
[Vandamme](http://tech-angels.github.io/vandamme).
|
8
8
|
|
9
|
+
## 0.2.29 - 2017/10/16
|
10
|
+
|
11
|
+
* [ENHANCEMENT] Use request to get app access token. Do not use
|
12
|
+
`app_id|app_secret` string.
|
13
|
+
|
9
14
|
## 0.2.28 - 2017/10/05
|
10
15
|
|
11
16
|
* [FEATURE] Add `since` option when it calls Page#videos and Page#posts to reduce
|
@@ -8,7 +8,7 @@ module Funky
|
|
8
8
|
module Connection
|
9
9
|
class API < Base
|
10
10
|
def self.fetch_all(path_query)
|
11
|
-
uri = URI "https://#{host}/v2.9/#{path_query}&limit=100&access_token=#{
|
11
|
+
uri = URI "https://#{host}/v2.9/#{path_query}&limit=100&access_token=#{app_access_token}"
|
12
12
|
fetch_data_with_paging_token(uri)
|
13
13
|
end
|
14
14
|
|
@@ -24,7 +24,7 @@ module Funky
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.fetch(path_query, is_array: false)
|
27
|
-
uri = URI "https://#{host}/v2.8/#{path_query}&limit=100&access_token=#{
|
27
|
+
uri = URI "https://#{host}/v2.8/#{path_query}&limit=100&access_token=#{app_access_token}"
|
28
28
|
is_array ? fetch_multiple_pages(uri).uniq : json_for(uri)
|
29
29
|
rescue URI::InvalidURIError
|
30
30
|
raise Funky::ContentNotFound, "Invalid URL"
|
@@ -66,14 +66,14 @@ module Funky
|
|
66
66
|
def self.request(id:, fields:)
|
67
67
|
uri = URI::HTTPS.build host: host,
|
68
68
|
path: "/v2.8/#{id}",
|
69
|
-
query: "access_token=#{
|
69
|
+
query: "access_token=#{app_access_token}&fields=#{fields}"
|
70
70
|
response_for(get_http_request(uri), uri)
|
71
71
|
end
|
72
72
|
|
73
73
|
def self.batch_request(ids:, fields:)
|
74
74
|
uri = URI::HTTPS.build host: host,
|
75
75
|
path: "/",
|
76
|
-
query: "include_headers=false&access_token=#{
|
76
|
+
query: "include_headers=false&access_token=#{app_access_token}"
|
77
77
|
batch = create_batch_for ids, fields
|
78
78
|
http_request = post_http_request uri
|
79
79
|
http_request.set_form_data batch: batch.to_json
|
@@ -94,6 +94,14 @@ module Funky
|
|
94
94
|
Funky.configuration.app_secret
|
95
95
|
end
|
96
96
|
|
97
|
+
def self.app_access_token
|
98
|
+
@app_access_token ||= begin
|
99
|
+
uri = URI::HTTPS.build host: host, path: "/v2.8/oauth/access_token",
|
100
|
+
query: URI.encode_www_form({client_id: app_id, client_secret: app_secret, grant_type: 'client_credentials'})
|
101
|
+
Funky::Connection::API.json_for(uri)[:access_token]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
97
105
|
def self.post_http_request(uri)
|
98
106
|
Net::HTTP::Post.new uri
|
99
107
|
end
|
data/lib/funky/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: funky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philip Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|