facebook_topics 1.1.3 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2278679bb8c6119a5705d3977769b63ab64a913
|
4
|
+
data.tar.gz: d5ed9e397a856701fbec7364bef414a062832efb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39aff8cb616a242eb55846f0704303d2b8559bb35254c36b49d4d8ebcfcc7401b55fcfaccaebe26e9f25663a016f323a8d6b24b7c8983bcd25e0b3f649a41190
|
7
|
+
data.tar.gz: 0e621935862435ebf0e9add6849167466e53990c62dc2926da49ba0135703b46b675c6123542d7272263686c9da021adfe8d3bbd769beb26ef7c830c8cbc9f05
|
data/lib/facebook_topics/api.rb
CHANGED
@@ -48,16 +48,37 @@ module FacebookTopics
|
|
48
48
|
|
49
49
|
|
50
50
|
|
51
|
-
def insights(contains_all,
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
def insights(contains_all, opts = {} )
|
52
|
+
from_date = opts.delete(:from_date)
|
53
|
+
until_date = opts.delete(:until_date)
|
54
|
+
region = opts.delete(:region)
|
55
|
+
city = opts.delete(:city)
|
56
|
+
country = opts.delete(:country)
|
57
|
+
continent = opts.delete(:continent)
|
58
|
+
breakdown = opts.delete(:breakdown)
|
59
|
+
|
60
|
+
fields = "mentions"
|
61
|
+
fields << ".since(#{from_date})" unless from_date.nil?
|
62
|
+
fields << ".until(#{until_date})" unless until_date.nil?
|
63
|
+
fields << ".region(#{region})" if region.present?
|
64
|
+
fields << ".city(#{city})" if city.present?
|
65
|
+
fields << ".country(#{country})" if country.present?
|
66
|
+
fields << ".continent(#{continent})" if continent.present?
|
67
|
+
fields << ".breakdown_by(#{breakdown.reject(&:blank?)})" if breakdown.present?
|
68
|
+
|
69
|
+
q = {contains_all: [contains_all], fields: fields}
|
70
|
+
|
71
|
+
data = Insight.new self.class.get("/#{api_version}/topic_insights", {query: q}).parsed_response
|
72
|
+
data.breakdown.each { |d| d["date"] = {from_date: from_date, until_date: until_date}.stringify_keys }
|
73
|
+
return data
|
55
74
|
end
|
56
75
|
|
57
76
|
|
58
77
|
|
59
78
|
|
60
79
|
|
80
|
+
|
81
|
+
|
61
82
|
def api_version
|
62
83
|
@api_version || "v2.3"
|
63
84
|
end
|
@@ -4,7 +4,7 @@ module FacebookTopics
|
|
4
4
|
class Collection
|
5
5
|
extend Forwardable
|
6
6
|
|
7
|
-
def_delegators :@results, :<<, :length, :first, :last, :collect, :to_a, :each, :reject, :select, :count, :[], :empty
|
7
|
+
def_delegators :@results, :<<, :length, :first, :last, :collect, :to_a, :each, :reject, :select, :count, :[], :empty?, :each_with_index
|
8
8
|
|
9
9
|
def initialize(results = {})
|
10
10
|
unless results.nil?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facebook_topics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spencer Markowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|