funky 0.2.21 → 0.2.22
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +8 -1
- data/lib/funky.rb +1 -0
- data/lib/funky/page.rb +21 -1
- data/lib/funky/post.rb +13 -0
- data/lib/funky/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e12d14881465b91bcee78d6c9797bc8a12bc69a
|
4
|
+
data.tar.gz: 25170d89ef0c5554c562201ad37dc39141715f23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 154c3a34ba50d72d6959a09153835ef52f5f5ccc22f3a07857709c8cc1e951f0a1b9c73cc63a1e0f929eb1bfce3681c84ddb1b6cdf7ad06ca24b2ee0ff468f90
|
7
|
+
data.tar.gz: 9c1cdc566145ad1f43824384babf3337bab3a7959e993ad77ed912511bbacf04469fae6f390797cce754cf5e1dee5f20b36a19379d740a09108029331be76dd6
|
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.22 - 2017/05/05
|
10
|
+
|
11
|
+
* [FEATURE] Add `Funky::Page#posts`.
|
12
|
+
* [FEATURE] Add `Funky::Page#has_featured_video?`.
|
13
|
+
|
9
14
|
## 0.2.21 - 2017/05/03
|
10
15
|
|
11
16
|
* [FEATURE] Add `Funky::Page#fan_count`.
|
data/README.md
CHANGED
@@ -54,7 +54,7 @@ from Facebook and one to fetch page data from Facebook.
|
|
54
54
|
|
55
55
|
## Pages API
|
56
56
|
|
57
|
-
### Use #where clause to get an array of
|
57
|
+
### Use #where clause to get an array of pages
|
58
58
|
|
59
59
|
```ruby
|
60
60
|
ids = ['1487249874853741', '526533744142224']
|
@@ -62,7 +62,14 @@ pages = Funky::Page.where(id: ids)
|
|
62
62
|
pages.first.id # => '1487249874853741'
|
63
63
|
pages.first.name # => 'Sony Pictures'
|
64
64
|
pages.first.username # => 'SonyPicturesGlobal'
|
65
|
+
```
|
65
66
|
|
67
|
+
### Use #posts to get an array of posts
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
page = Funky::Page.find('FullscreenInc')
|
71
|
+
posts = page.posts
|
72
|
+
posts.first.type # => 'video'
|
66
73
|
```
|
67
74
|
|
68
75
|
## Videos API
|
data/lib/funky.rb
CHANGED
data/lib/funky/page.rb
CHANGED
@@ -11,7 +11,7 @@ module Funky
|
|
11
11
|
#
|
12
12
|
# @return [Funky::Page] containing the data fetched by Facebook Graph API.
|
13
13
|
def self.find(page_id)
|
14
|
-
page = Funky::Connection::API.fetch("#{page_id}?fields=name,username,location,fan_count")
|
14
|
+
page = Funky::Connection::API.fetch("#{page_id}?fields=name,username,location,fan_count,featured_video")
|
15
15
|
new(page)
|
16
16
|
end
|
17
17
|
|
@@ -32,6 +32,21 @@ module Funky
|
|
32
32
|
videos.map {|video| Video.new(video) }
|
33
33
|
end
|
34
34
|
|
35
|
+
# Fetches data from Facebook Graph API and returns an array of Funky::Post
|
36
|
+
# objects belong to the caller page.
|
37
|
+
#
|
38
|
+
# @example Getting posts under a page
|
39
|
+
# page = Funky::Page.find 'FullscreenInc'
|
40
|
+
# page.posts
|
41
|
+
# # => [#<Funky::Post @data={...}>, #<Funky::Post @data={...}>]
|
42
|
+
#
|
43
|
+
# @return [Array<Funky::Post>] multiple Funky::Post objects containing data
|
44
|
+
# fetched by Facebook Graph API.
|
45
|
+
def posts
|
46
|
+
posts = Funky::Connection::API.fetch("#{id}/posts?fields=type,created_time", is_array: true)
|
47
|
+
posts.map {|post| Post.new(post)}
|
48
|
+
end
|
49
|
+
|
35
50
|
# @note
|
36
51
|
# For example, for www.facebook.com/platform the username is 'platform'.
|
37
52
|
# @see https://developers.facebook.com/docs/graph-api/reference/page/
|
@@ -54,6 +69,11 @@ module Funky
|
|
54
69
|
data[:fan_count]
|
55
70
|
end
|
56
71
|
|
72
|
+
# @return [Boolean] if the Facebook page has featured_video
|
73
|
+
def has_featured_video?
|
74
|
+
!data[:featured_video].nil?
|
75
|
+
end
|
76
|
+
|
57
77
|
# @note
|
58
78
|
# location is a Hash that contains more specific properties such as city,
|
59
79
|
# state, zip, etc.
|
data/lib/funky/post.rb
ADDED
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.22
|
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-05-
|
11
|
+
date: 2017-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- lib/funky/html/page.rb
|
126
126
|
- lib/funky/html/parser.rb
|
127
127
|
- lib/funky/page.rb
|
128
|
+
- lib/funky/post.rb
|
128
129
|
- lib/funky/url.rb
|
129
130
|
- lib/funky/version.rb
|
130
131
|
- lib/funky/video.rb
|