gnip_api 0.0.9 → 1.0.0
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/Gemfile.lock +3 -1
- data/README.md +1 -0
- data/gnip_api.gemspec +1 -0
- data/lib/gnip_api/adapter.rb +1 -1
- data/lib/gnip_api/adapters/httparty_adapter.rb +1 -1
- data/lib/gnip_api/apis/power_track/rule.rb +3 -1
- data/lib/gnip_api/apis/power_track/rule_validator.rb +8 -0
- data/lib/gnip_api/apis/power_track/rules.rb +13 -6
- data/lib/gnip_api/apis/power_track/stream.rb +1 -3
- data/lib/gnip_api/endpoints.rb +16 -4
- data/lib/gnip_api/gnip/url.rb +4 -1
- data/lib/gnip_api/request.rb +1 -1
- data/lib/gnip_api/response.rb +1 -1
- data/lib/gnip_api/version.rb +1 -1
- data/spec/fixtures/activities/full_activity.json +113 -225
- data/spec/gnip_api/apis/power_track/stream_spec.rb +1 -1
- data/spec/gnip_api/endpoints_spec.rb +4 -10
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 070084aade9bec151ad135a35f172dc69375cc35
|
4
|
+
data.tar.gz: ae3fddc616369e500c39bbb8cb72202212883651
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c00d5542022a381ae9b563369367896fcf8496eab0c1be3b6f487b6c69edf5dbf9265ecf51d9310ab7ea334374c58fb20d0727ee30adeda6c359678d166c84b
|
7
|
+
data.tar.gz: d3395a4f285db4d9f95f9f1c6fe195f437788f9d1897ee908b53db777a4d8862a58c295fdf83567f97b81da430d8876da6dd2f707257c0067522d1842c1ccdb5
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gnip_api (0.0
|
4
|
+
gnip_api (1.0.0)
|
5
5
|
addressable
|
6
6
|
httparty
|
7
7
|
yajl-ruby
|
@@ -11,6 +11,7 @@ GEM
|
|
11
11
|
specs:
|
12
12
|
addressable (2.4.0)
|
13
13
|
awesome_print (1.2.0)
|
14
|
+
byebug (9.0.6)
|
14
15
|
coderay (1.1.0)
|
15
16
|
diff-lcs (1.2.5)
|
16
17
|
httparty (0.14.0)
|
@@ -44,6 +45,7 @@ PLATFORMS
|
|
44
45
|
DEPENDENCIES
|
45
46
|
awesome_print
|
46
47
|
bundler (~> 1.6)
|
48
|
+
byebug
|
47
49
|
gnip_api!
|
48
50
|
pry
|
49
51
|
rake (~> 10.0)
|
data/README.md
CHANGED
@@ -6,6 +6,7 @@ Connect with different Gnip APIs and get data from streams.
|
|
6
6
|
|
7
7
|
## Recent Changes
|
8
8
|
|
9
|
+
- 2.0 APIs implemented partially, more will come soon
|
9
10
|
- Fixed a memory issue with HTTParty
|
10
11
|
- Timeout for requests added to fail if API is non responsive, time can be configured
|
11
12
|
- Search API returns parsed data either for counts or activities, which also makes Search API usable to get activities now
|
data/gnip_api.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "awesome_print"
|
25
25
|
spec.add_development_dependency "rspec"
|
26
26
|
spec.add_development_dependency "timecop"
|
27
|
+
spec.add_development_dependency 'byebug'
|
27
28
|
|
28
29
|
spec.add_dependency "httparty"
|
29
30
|
spec.add_dependency "yajl-ruby"
|
data/lib/gnip_api/adapter.rb
CHANGED
@@ -50,7 +50,7 @@ module GnipApi
|
|
50
50
|
else
|
51
51
|
error_message = response.error_message
|
52
52
|
@logger.error "#{response.request_method} request to #{response.request_uri} returned with status #{response.status} FAIL: #{error_message}"
|
53
|
-
raise GnipApi::Errors::Adapter::RequestError.new
|
53
|
+
raise GnipApi::Errors::Adapter::RequestError.new error_message
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -7,7 +7,7 @@ module GnipApi
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def delete request
|
10
|
-
data = HTTParty.
|
10
|
+
data = HTTParty.post request.uri, :basic_auth => auth, :body => request.payload, :timeout => default_timeout
|
11
11
|
return response(request, data)
|
12
12
|
end
|
13
13
|
|
@@ -2,11 +2,12 @@ module GnipApi
|
|
2
2
|
module Apis
|
3
3
|
module PowerTrack
|
4
4
|
class Rule
|
5
|
-
attr_accessor :value, :tag
|
5
|
+
attr_accessor :value, :tag, :id
|
6
6
|
|
7
7
|
def initialize params={}
|
8
8
|
@value = params[:value] || params['value']
|
9
9
|
@tag = params[:tag] || params['tag']
|
10
|
+
@id = params[:id] || params['id']
|
10
11
|
end
|
11
12
|
|
12
13
|
def to_json
|
@@ -17,6 +18,7 @@ module GnipApi
|
|
17
18
|
attrs = {}
|
18
19
|
attrs[:value] = @value if @value
|
19
20
|
attrs[:tag] = @tag if @tag
|
21
|
+
attrs[:id] = @id if @id
|
20
22
|
attrs
|
21
23
|
end
|
22
24
|
|
@@ -14,7 +14,6 @@ module GnipApi
|
|
14
14
|
def initialize params={}
|
15
15
|
@adapter = GnipApi::Adapter.new
|
16
16
|
@label = params[:label] || GnipApi.config.label
|
17
|
-
@source = params[:source] || GnipApi.config.source
|
18
17
|
end
|
19
18
|
|
20
19
|
# Returns an array of defined rules
|
@@ -29,7 +28,9 @@ module GnipApi
|
|
29
28
|
def create rules
|
30
29
|
raise GnipApi::Errors::PowerTrack::MissingRules.new if rules.nil? || rules.empty?
|
31
30
|
request = create_post_request(construct_rules(rules))
|
32
|
-
adapter.post(request)
|
31
|
+
response = adapter.post(request)
|
32
|
+
return true if response.nil?
|
33
|
+
return GnipApi::JsonParser.new.parse(response)
|
33
34
|
end
|
34
35
|
|
35
36
|
# Deletes the specified rule. Parameters:
|
@@ -37,7 +38,9 @@ module GnipApi
|
|
37
38
|
def delete rules
|
38
39
|
raise GnipApi::Errors::PowerTrack::MissingRules.new if rules.nil? || rules.empty?
|
39
40
|
request = create_delete_request(construct_rules(rules))
|
40
|
-
adapter.delete(request)
|
41
|
+
response = adapter.delete(request)
|
42
|
+
return true if response.nil?
|
43
|
+
return GnipApi::JsonParser.new.parse(response)
|
41
44
|
end
|
42
45
|
|
43
46
|
# Parses an array of GnipApi::Apis::PowerTrack::Rule objects
|
@@ -52,12 +55,12 @@ module GnipApi
|
|
52
55
|
|
53
56
|
def parse_rules data
|
54
57
|
parsed_data = GnipApi::JsonParser.new.parse(data)
|
55
|
-
parsed_data['rules'].map{|rule| GnipApi::Apis::PowerTrack::Rule.new(:value => rule['value'], :tag => rule['tag'])}
|
58
|
+
parsed_data['rules'].map{|rule| GnipApi::Apis::PowerTrack::Rule.new(:value => rule['value'], :tag => rule['tag'], :id => rule['id'])}
|
56
59
|
end
|
57
60
|
|
58
61
|
private
|
59
62
|
def endpoint
|
60
|
-
GnipApi::Endpoints.powertrack_rules(@
|
63
|
+
GnipApi::Endpoints.powertrack_rules(@label)
|
61
64
|
end
|
62
65
|
|
63
66
|
def create_get_request
|
@@ -69,7 +72,11 @@ module GnipApi
|
|
69
72
|
end
|
70
73
|
|
71
74
|
def create_delete_request payload
|
72
|
-
|
75
|
+
delete_url = endpoint
|
76
|
+
delete_url.query = '_method=delete'
|
77
|
+
puts delete_url
|
78
|
+
puts payload
|
79
|
+
GnipApi::Request.new_delete(delete_url, payload)
|
73
80
|
end
|
74
81
|
|
75
82
|
end
|
@@ -6,7 +6,6 @@ module GnipApi
|
|
6
6
|
|
7
7
|
def initialize params = {}
|
8
8
|
@stream = params[:stream] || GnipApi.config.label
|
9
|
-
@source = params[:source] || GnipApi.config.source
|
10
9
|
set_config
|
11
10
|
end
|
12
11
|
|
@@ -61,7 +60,6 @@ module GnipApi
|
|
61
60
|
|
62
61
|
def set_config
|
63
62
|
raise 'MissingStream' if @stream.nil?
|
64
|
-
raise 'MissingSource' if @source.nil?
|
65
63
|
@user = GnipApi.configuration.user
|
66
64
|
@password = GnipApi.configuration.password
|
67
65
|
@account = GnipApi.configuration.account
|
@@ -70,7 +68,7 @@ module GnipApi
|
|
70
68
|
end
|
71
69
|
|
72
70
|
def endpoint
|
73
|
-
GnipApi::Endpoints.powertrack_stream(@
|
71
|
+
GnipApi::Endpoints.powertrack_stream(@stream)
|
74
72
|
end
|
75
73
|
|
76
74
|
end
|
data/lib/gnip_api/endpoints.rb
CHANGED
@@ -1,12 +1,24 @@
|
|
1
1
|
module GnipApi
|
2
2
|
class Endpoints
|
3
3
|
class << self
|
4
|
-
def powertrack_rules
|
5
|
-
URI("https://api.
|
4
|
+
def powertrack_rules label
|
5
|
+
URI("https://gnip-api.twitter.com/rules/powertrack/accounts/#{account}/publishers/twitter/#{label}.json")
|
6
6
|
end
|
7
7
|
|
8
|
-
def powertrack_stream
|
9
|
-
URI("https://stream.
|
8
|
+
def powertrack_stream label
|
9
|
+
URI("https://gnip-stream.twitter.com/stream/powertrack/accounts/#{account}/publishers/twitter/#{label}.json")
|
10
|
+
end
|
11
|
+
|
12
|
+
def powertrack_rule_validator label
|
13
|
+
URI("https://gnip-api.twitter.com/rules/powertrack/accounts/#{account}/publishers/twitter/#{label}/validation.json")
|
14
|
+
end
|
15
|
+
|
16
|
+
def powertrack_stream_replay label
|
17
|
+
URI("https://gnip-stream.twitter.com/replay/powertrack/accounts/#{account}/publishers/twitter/#{label}.json")
|
18
|
+
end
|
19
|
+
|
20
|
+
def powertrack_rule_replay label
|
21
|
+
URI("https://gnip-api.twitter.com/rules/powertrack-replay/accounts/#{account}/publishers/twitter/#{label}.json")
|
10
22
|
end
|
11
23
|
|
12
24
|
def search_activities label
|
data/lib/gnip_api/gnip/url.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Gnip
|
2
2
|
class Url < Gnip::Message
|
3
|
-
attr_reader :url, :expanded_url, :expanded_status, :display_url, :indices
|
3
|
+
attr_reader :url, :expanded_url, :expanded_status, :display_url, :indices, :expanded_url_title, :expanded_url_description
|
4
4
|
|
5
5
|
def initialize params={}
|
6
6
|
@url = params['url']
|
@@ -8,6 +8,8 @@ module Gnip
|
|
8
8
|
@display_url = params['display_url']
|
9
9
|
@expanded_status = params['expanded_status']
|
10
10
|
@indices = params['indices']
|
11
|
+
@expanded_url_title = params['expanded_url_title']
|
12
|
+
@expanded_url_description = params['expanded_url_description']
|
11
13
|
end
|
12
14
|
|
13
15
|
def url
|
@@ -21,6 +23,7 @@ module Gnip
|
|
21
23
|
def original_attributes
|
22
24
|
{
|
23
25
|
:url => @url,
|
26
|
+
:title => @title,
|
24
27
|
:display_url => @display_url,
|
25
28
|
:expanded_url => @expanded_url,
|
26
29
|
:expanded_status => @expanded_status,
|
data/lib/gnip_api/request.rb
CHANGED
@@ -12,7 +12,7 @@ module GnipApi
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def new_delete uri, payload, headers=nil
|
15
|
-
new(:uri => uri, :headers => headers, :payload => payload, :request_method => GnipApi::Adapter::
|
15
|
+
new(:uri => uri, :headers => headers, :payload => payload, :request_method => GnipApi::Adapter::POST)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
data/lib/gnip_api/response.rb
CHANGED
data/lib/gnip_api/version.rb
CHANGED
@@ -1,227 +1,115 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
"id": 593895901145346000,
|
116
|
-
"id_str": "593895901145346048",
|
117
|
-
"indices": [
|
118
|
-
54,
|
119
|
-
76
|
120
|
-
],
|
121
|
-
"media_url": "http://pbs.twimg.com/media/CD3xLO1UMAAvBgO.png",
|
122
|
-
"media_url_https": "https://pbs.twimg.com/media/CD3xLO1UMAAvBgO.png",
|
123
|
-
"url": "http://t.co/ZvgHovKZq4",
|
124
|
-
"display_url": "pic.twitter.com/ZvgHovKZq4",
|
125
|
-
"expanded_url": "http://twitter.com/johnd_test/status/593895901623496704/photo/1",
|
126
|
-
"type": "photo",
|
127
|
-
"sizes": {
|
128
|
-
"small": {
|
129
|
-
"w": 340,
|
130
|
-
"h": 340,
|
131
|
-
"resize": "fit"
|
132
|
-
},
|
133
|
-
"thumb": {
|
134
|
-
"w": 150,
|
135
|
-
"h": 150,
|
136
|
-
"resize": "crop"
|
137
|
-
},
|
138
|
-
"large": {
|
139
|
-
"w": 512,
|
140
|
-
"h": 512,
|
141
|
-
"resize": "fit"
|
142
|
-
},
|
143
|
-
"medium": {
|
144
|
-
"w": 512,
|
145
|
-
"h": 512,
|
146
|
-
"resize": "fit"
|
147
|
-
}
|
148
|
-
}
|
149
|
-
}
|
150
|
-
]
|
151
|
-
},
|
152
|
-
"twitter_extended_entities": {
|
153
|
-
"media": [
|
154
|
-
{
|
155
|
-
"id": 593895901145346000,
|
156
|
-
"id_str": "593895901145346048",
|
157
|
-
"indices": [
|
158
|
-
54,
|
159
|
-
76
|
160
|
-
],
|
161
|
-
"media_url": "http://pbs.twimg.com/media/CD3xLO1UMAAvBgO.png",
|
162
|
-
"media_url_https": "https://pbs.twimg.com/media/CD3xLO1UMAAvBgO.png",
|
163
|
-
"url": "http://t.co/ZvgHovKZq4",
|
164
|
-
"display_url": "pic.twitter.com/ZvgHovKZq4",
|
165
|
-
"expanded_url": "http://twitter.com/johnd_test/status/593895901623496704/photo/1",
|
166
|
-
"type": "photo",
|
167
|
-
"sizes": {
|
168
|
-
"small": {
|
169
|
-
"w": 340,
|
170
|
-
"h": 340,
|
171
|
-
"resize": "fit"
|
172
|
-
},
|
173
|
-
"thumb": {
|
174
|
-
"w": 150,
|
175
|
-
"h": 150,
|
176
|
-
"resize": "crop"
|
177
|
-
},
|
178
|
-
"large": {
|
179
|
-
"w": 512,
|
180
|
-
"h": 512,
|
181
|
-
"resize": "fit"
|
182
|
-
},
|
183
|
-
"medium": {
|
184
|
-
"w": 512,
|
185
|
-
"h": 512,
|
186
|
-
"resize": "fit"
|
187
|
-
}
|
188
|
-
}
|
189
|
-
}
|
190
|
-
]
|
191
|
-
},
|
192
|
-
"twitter_filter_level": "low",
|
193
|
-
"twitter_lang": "en",
|
194
|
-
"retweetCount": 0,
|
195
|
-
"gnip": {
|
196
|
-
"urls": [
|
197
|
-
{
|
198
|
-
"url": "http://t.co/ZvgHovKZq4",
|
199
|
-
"expanded_url": "http://twitter.com/johnd_test/status/593895901623496704/photo/1",
|
200
|
-
"expanded_status": 200
|
201
|
-
}
|
202
|
-
],
|
203
|
-
"language": {
|
204
|
-
"value": "en"
|
205
|
-
},
|
206
|
-
"profileLocations": [
|
207
|
-
{
|
208
|
-
"objectType": "place",
|
209
|
-
"geo": {
|
210
|
-
"type": "point",
|
211
|
-
"coordinates": [
|
212
|
-
-104.9847,
|
213
|
-
39.73915
|
214
|
-
]
|
215
|
-
},
|
216
|
-
"address": {
|
217
|
-
"country": "United States",
|
218
|
-
"countryCode": "US",
|
219
|
-
"locality": "Denver",
|
220
|
-
"region": "Colorado",
|
221
|
-
"subRegion": "Denver County"
|
222
|
-
},
|
223
|
-
"displayName": "Denver, Colorado, United States"
|
224
|
-
}
|
225
|
-
]
|
226
|
-
}
|
2
|
+
"id": "tag:search.twitter.com,2005:715999188836827140",
|
3
|
+
"objectType": "activity",
|
4
|
+
"verb": "post",
|
5
|
+
"postedTime": "2016-04-01T20:28:03.000Z",
|
6
|
+
"generator": {
|
7
|
+
"displayName": "Twitter Web Client",
|
8
|
+
"link": "http:\/\/twitter.com"
|
9
|
+
},
|
10
|
+
"provider": {
|
11
|
+
"objectType": "service",
|
12
|
+
"displayName": "Twitter",
|
13
|
+
"link": "http:\/\/www.twitter.com"
|
14
|
+
},
|
15
|
+
"link": "http:\/\/twitter.com\/furiouscamper\/statuses\/715999188836827140",
|
16
|
+
"body": "It's Friday!!! \ud83d\udc79 #AprilFools - funny pranks https:\/\/t.co\/b9ZdzRxzFK",
|
17
|
+
"actor": {
|
18
|
+
"objectType": "person",
|
19
|
+
"id": "id:twitter.com:3001969357",
|
20
|
+
"link": "http:\/\/www.twitter.com\/furiouscamper",
|
21
|
+
"displayName": "Jordan Brinks",
|
22
|
+
"postedTime": "2015-01-29T18:27:49.340Z",
|
23
|
+
"image": "https:\/\/pbs.twimg.com\/profile_images\/601155672395227136\/qakfE9EU_normal.jpg",
|
24
|
+
"summary": "Alter Ego - Twitter PE",
|
25
|
+
"friendsCount": 24,
|
26
|
+
"followersCount": 15,
|
27
|
+
"listedCount": 1,
|
28
|
+
"statusesCount": 222,
|
29
|
+
"twitterTimeZone": "Mountain Time (US & Canada)",
|
30
|
+
"verified": false,
|
31
|
+
"utcOffset": "-21600",
|
32
|
+
"preferredUsername": "furiouscamper",
|
33
|
+
"languages": ["en"],
|
34
|
+
"links": [{
|
35
|
+
"href": "http:\/\/indigofiddle.com",
|
36
|
+
"rel": "me"
|
37
|
+
}],
|
38
|
+
"location": {
|
39
|
+
"objectType": "place",
|
40
|
+
"displayName": "Birmingham"
|
41
|
+
},
|
42
|
+
"favoritesCount": 14
|
43
|
+
},
|
44
|
+
"object": {
|
45
|
+
"objectType": "note",
|
46
|
+
"id": "object:search.twitter.com,2005:715999188836827140",
|
47
|
+
"summary": "It's Friday!!! \ud83d\udc79 #AprilFools - funny pranks https:\/\/t.co\/b9ZdzRxzFK",
|
48
|
+
"link": "http:\/\/twitter.com\/furiouscamper\/statuses\/715999188836827140",
|
49
|
+
"postedTime": "2016-04-01T20:28:03.000Z"
|
50
|
+
},
|
51
|
+
"location": {
|
52
|
+
"objectType": "place",
|
53
|
+
"displayName": "Boulder, CO",
|
54
|
+
"name": "Boulder",
|
55
|
+
"country_code": "United States",
|
56
|
+
"twitter_country_code": "US",
|
57
|
+
"twitter_place_type": "city",
|
58
|
+
"link": "https:\/\/api.twitter.com\/1.1\/geo\/id\/fd70c22040963ac7.json",
|
59
|
+
"geo": {
|
60
|
+
"type": "Polygon",
|
61
|
+
"coordinates": [
|
62
|
+
[
|
63
|
+
[-105.301776, 39.953552],
|
64
|
+
[-105.301776, 40.094411],
|
65
|
+
[-105.183597, 40.094411],
|
66
|
+
[-105.183597, 39.953552]
|
67
|
+
]
|
68
|
+
]
|
69
|
+
}
|
70
|
+
},
|
71
|
+
"twitter_entities": {
|
72
|
+
"hashtags": [{
|
73
|
+
"text": "AprilFools",
|
74
|
+
"indices": [17, 28]
|
75
|
+
}],
|
76
|
+
"urls": [{
|
77
|
+
"url": "https:\/\/t.co\/b9ZdzRxzFK",
|
78
|
+
"expanded_url": "http:\/\/www.today.com\/parents\/joke-s-you-kid-11-family-friendly-april-fools-pranks-t83276",
|
79
|
+
"display_url": "today.com\/parents\/joke-s\u2026",
|
80
|
+
"indices": [44, 67]
|
81
|
+
}],
|
82
|
+
"user_mentions": [],
|
83
|
+
"symbols": []
|
84
|
+
},
|
85
|
+
"twitter_lang": "en",
|
86
|
+
"gnip": {
|
87
|
+
"matching_rules": [{
|
88
|
+
"tag": null,
|
89
|
+
"id": 715947673707089920
|
90
|
+
}],
|
91
|
+
"urls": [{
|
92
|
+
"url": "https:\/\/t.co\/b9ZdzRxzFK",
|
93
|
+
"expanded_url": "http:\/\/www.today.com\/parents\/joke-s-you-kid-11-family-friendly-april-fools-pranks-t83276",
|
94
|
+
"expanded_status": 200,
|
95
|
+
"expanded_url_title": "The joke's on you, kid: 11 family-friendly April Fools pranks",
|
96
|
+
"expanded_url_description": "If your kids are practical jokers, turn this April Fools' Day into a family affair."
|
97
|
+
}],
|
98
|
+
"profileLocations": [{
|
99
|
+
"address": {
|
100
|
+
"country": "United States",
|
101
|
+
"countryCode": "US",
|
102
|
+
"locality": "Birmingham",
|
103
|
+
"region": "Alabama",
|
104
|
+
"subRegion": "Jefferson County"
|
105
|
+
},
|
106
|
+
"displayName": "Birmingham, Alabama, United States",
|
107
|
+
"geo": {
|
108
|
+
"coordinates": [-86.80249, 33.52066],
|
109
|
+
"type": "point"
|
110
|
+
},
|
111
|
+
"objectType": "place"
|
112
|
+
}]
|
113
|
+
},
|
114
|
+
"twitter_filter_level": "low"
|
227
115
|
}
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe GnipApi::Apis::PowerTrack::Stream do
|
4
4
|
before do
|
5
5
|
configure_gem
|
6
|
-
@stream = GnipApi::Apis::PowerTrack::Stream.new
|
6
|
+
@stream = GnipApi::Apis::PowerTrack::Stream.new
|
7
7
|
end
|
8
8
|
|
9
9
|
describe '#process_entries' do
|
@@ -9,15 +9,12 @@ describe GnipApi::Endpoints do
|
|
9
9
|
|
10
10
|
describe '.powertrack_rules' do
|
11
11
|
it 'returns URI object' do
|
12
|
-
expect(GnipApi::Endpoints.powertrack_rules(@
|
12
|
+
expect(GnipApi::Endpoints.powertrack_rules(@label).kind_of?(URI)).to eq(true)
|
13
13
|
end
|
14
14
|
|
15
15
|
describe 'URI returned' do
|
16
16
|
before do
|
17
|
-
@uri = GnipApi::Endpoints.powertrack_rules(@
|
18
|
-
end
|
19
|
-
it 'contains source in path' do
|
20
|
-
expect(@uri.path.include?(@source)).to eq(true)
|
17
|
+
@uri = GnipApi::Endpoints.powertrack_rules(@label)
|
21
18
|
end
|
22
19
|
|
23
20
|
it 'contains label in path' do
|
@@ -32,15 +29,12 @@ describe GnipApi::Endpoints do
|
|
32
29
|
|
33
30
|
describe '.powertrack_stream' do
|
34
31
|
it 'returns URI object' do
|
35
|
-
expect(GnipApi::Endpoints.powertrack_stream(@
|
32
|
+
expect(GnipApi::Endpoints.powertrack_stream(@label).kind_of?(URI)).to eq(true)
|
36
33
|
end
|
37
34
|
|
38
35
|
describe 'URI returned' do
|
39
36
|
before do
|
40
|
-
@uri = GnipApi::Endpoints.powertrack_stream(@
|
41
|
-
end
|
42
|
-
it 'contains source in path' do
|
43
|
-
expect(@uri.path.include?(@source)).to eq(true)
|
37
|
+
@uri = GnipApi::Endpoints.powertrack_stream(@label)
|
44
38
|
end
|
45
39
|
|
46
40
|
it 'contains label in path' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gnip_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rayko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: byebug
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: httparty
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,6 +173,7 @@ files:
|
|
159
173
|
- lib/gnip_api/adapters/httparty_adapter.rb
|
160
174
|
- lib/gnip_api/apis/power_track/buffer.rb
|
161
175
|
- lib/gnip_api/apis/power_track/rule.rb
|
176
|
+
- lib/gnip_api/apis/power_track/rule_validator.rb
|
162
177
|
- lib/gnip_api/apis/power_track/rules.rb
|
163
178
|
- lib/gnip_api/apis/power_track/stream.rb
|
164
179
|
- lib/gnip_api/apis/search.rb
|