facebook_topics 1.1.1 → 1.1.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 217fae301cb97d0ca5b4e5ff926b44ce74b6609b
|
4
|
+
data.tar.gz: 1b0bf409c153d6c53278c8b1c72db5007e6fd6ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bd441cf7264931a9be304a6dd03ce0f5e9c895e4cc58cfeeae46bbb5037803628f5283e733c41c66f680050d327eb4c4f6b0588fe54a844cea8f160f05e9f07
|
7
|
+
data.tar.gz: a62fe1a872397a6c02cfa7d0d69b7a97d3d4cbd1d9d33965c9fb4a4567e9dbf3782c2e51cfb09e539befba06041046f33778bbd05ca692654c2c54179f5ba156
|
data/lib/facebook_topics.rb
CHANGED
data/lib/facebook_topics/api.rb
CHANGED
@@ -48,9 +48,10 @@ module FacebookTopics
|
|
48
48
|
|
49
49
|
|
50
50
|
|
51
|
-
def insights(contains_all,
|
51
|
+
def insights(contains_all, fields = [])
|
52
52
|
q = {contains_all: [contains_all], fields: fields.flatten.uniq.join(',')}
|
53
|
-
|
53
|
+
|
54
|
+
Insight.new self.class.get("/#{api_version}/topic_insights", {query: q}).parsed_response
|
54
55
|
end
|
55
56
|
|
56
57
|
|
@@ -6,8 +6,10 @@ module FacebookTopics
|
|
6
6
|
|
7
7
|
def_delegators :@results, :<<, :length, :first, :last, :collect, :to_a, :each, :reject, :select, :count, :[], :empty?
|
8
8
|
|
9
|
-
def initialize(results =
|
10
|
-
|
9
|
+
def initialize(results = {})
|
10
|
+
unless results.nil?
|
11
|
+
raise ApiError.new(results["error"]) if results.has_key? "error"
|
12
|
+
end
|
11
13
|
end
|
12
14
|
|
13
15
|
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
module FacebookTopics
|
2
|
-
class
|
2
|
+
class Insight
|
3
3
|
attr_accessor :volume, :breakdown
|
4
4
|
|
5
|
-
def initialize(results =
|
6
|
-
|
7
|
-
@
|
5
|
+
def initialize(results = {})
|
6
|
+
raise RuntimeError.new results["error"]["message"] if results.has_key? "error"
|
7
|
+
@volume = results["data"].first["mentions"]["data"].shift["count"].to_i rescue 0
|
8
|
+
@breakdown = results["data"].first["mentions"]["data"] rescue []
|
8
9
|
end
|
9
10
|
|
10
11
|
|
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.1.
|
4
|
+
version: 1.1.2
|
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-04-
|
11
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|