gnip_api 1.2.2 → 1.2.3
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 +24 -3
- data/README.md +70 -33
- data/Rakefile +7 -0
- data/doc/rdoc/classes/Gnip/Activity.html +354 -0
- data/doc/rdoc/classes/Gnip/Actor.html +300 -0
- data/doc/rdoc/classes/Gnip/GnipData.html +154 -0
- data/doc/rdoc/classes/Gnip/Message.html +236 -0
- data/doc/rdoc/classes/Gnip/SystemMessage.html +190 -0
- data/doc/rdoc/classes/Gnip/TwitterComplianceMessage.html +194 -0
- data/doc/rdoc/classes/Gnip/UndefinedMessage.html +83 -0
- data/doc/rdoc/classes/Gnip/Url.html +194 -0
- data/doc/rdoc/classes/Gnip.html +95 -0
- data/doc/rdoc/classes/GnipApi/Adapter.html +287 -0
- data/doc/rdoc/classes/GnipApi/Configuration.html +194 -0
- data/doc/rdoc/classes/GnipApi/Endpoints.html +191 -0
- data/doc/rdoc/classes/GnipApi/Errors/Adapter/GnipSoftwareError.html +83 -0
- data/doc/rdoc/classes/GnipApi/Errors/Adapter/RateLimitError.html +83 -0
- data/doc/rdoc/classes/GnipApi/Errors/Adapter/RequestError.html +56 -0
- data/doc/rdoc/classes/GnipApi/Errors/Adapter.html +66 -0
- data/doc/rdoc/classes/GnipApi/Errors/Configuration/InvalidOutputFormat.html +83 -0
- data/doc/rdoc/classes/GnipApi/Errors/Configuration.html +58 -0
- data/doc/rdoc/classes/GnipApi/Errors/JsonParser/ParseError.html +56 -0
- data/doc/rdoc/classes/GnipApi/Errors/JsonParser.html +64 -0
- data/doc/rdoc/classes/GnipApi/Errors/MissingAdapter.html +83 -0
- data/doc/rdoc/classes/GnipApi/Errors/MissingCredentials.html +83 -0
- data/doc/rdoc/classes/GnipApi/Errors/PowerTrack/MissingRules.html +83 -0
- data/doc/rdoc/classes/GnipApi/Errors/PowerTrack/StreamDown.html +56 -0
- data/doc/rdoc/classes/GnipApi/Errors/PowerTrack.html +65 -0
- data/doc/rdoc/classes/GnipApi/Errors/Search/MissingParameters.html +83 -0
- data/doc/rdoc/classes/GnipApi/Errors/Search.html +64 -0
- data/doc/rdoc/classes/GnipApi/Errors.html +79 -0
- data/doc/rdoc/classes/GnipApi/JsonParser.html +101 -0
- data/doc/rdoc/classes/GnipApi/PowerTrack/Buffer.html +237 -0
- data/doc/rdoc/classes/GnipApi/PowerTrack/Rule.html +196 -0
- data/doc/rdoc/classes/GnipApi/PowerTrack/Rules.html +188 -0
- data/doc/rdoc/classes/GnipApi/PowerTrack/Stream.html +359 -0
- data/doc/rdoc/classes/GnipApi/PowerTrack.html +73 -0
- data/doc/rdoc/classes/GnipApi/Request.html +216 -0
- data/doc/rdoc/classes/GnipApi/Response.html +232 -0
- data/doc/rdoc/classes/GnipApi/Search.html +101 -0
- data/doc/rdoc/classes/GnipApi.html +252 -0
- data/doc/rdoc/created.rid +24 -0
- data/doc/rdoc/css/style.css +343 -0
- data/doc/rdoc/files/LICENSE_txt.html +73 -0
- data/doc/rdoc/files/README_md.html +299 -0
- data/doc/rdoc/files/lib/gnip_api/adapter_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/configuration_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/endpoints_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/errors_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/gnip/activity_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/gnip/actor_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/gnip/gnip_data_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/gnip/message_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/gnip/system_message_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/gnip/twitter_compliance_message_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/gnip/url_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/json_parser_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/power_track/buffer_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/power_track/rule_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/power_track/rules_rb.html +55 -0
- data/doc/rdoc/files/lib/gnip_api/power_track/stream_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/request_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/response_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api/search_rb.html +55 -0
- data/doc/rdoc/files/lib/gnip_api/version_rb.html +51 -0
- data/doc/rdoc/files/lib/gnip_api_rb.html +84 -0
- data/doc/rdoc/fr_class_index.html +92 -0
- data/doc/rdoc/fr_file_index.html +41 -0
- data/doc/rdoc/fr_method_index.html +4791 -0
- data/doc/rdoc/index.html +15 -0
- data/gnip_api.gemspec +3 -1
- data/lib/gnip_api/configuration.rb +18 -4
- data/lib/gnip_api/errors.rb +0 -1
- data/lib/gnip_api/power_track/buffer.rb +60 -14
- data/lib/gnip_api/power_track/stream.rb +52 -17
- data/lib/gnip_api/response.rb +3 -2
- data/lib/gnip_api/version.rb +1 -1
- data/spec/gnip_api/power_track/buffer_spec.rb +8 -0
- data/spec/gnip_api/response_spec.rb +16 -0
- data/spec/spec_helper.rb +1 -0
- metadata +97 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03b14ac2afa5946ca2801970eaa521fa0763664d
|
4
|
+
data.tar.gz: 01b6f881f339617348e818c71a1a747abf46e99d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd9eb46fa645ea6e13b9b54f4eb36ceeb4f740fb3c2234a75fcb6cdeaebb6323fa8a822ea56d729d67206d57513e7a7f0d7d4f0162c1732b9c59de83d5e25ca9
|
7
|
+
data.tar.gz: 8b68c3d84b54e42ab2533b423ed58dbfc0e4c586d8466ad40311c0a85e48d24eaad131ecf290275d603b9546d743474d10bb785b42d4b4657f4889c9425053b1
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gnip_api (1.2.
|
4
|
+
gnip_api (1.2.3)
|
5
5
|
addressable
|
6
6
|
httparty
|
7
7
|
yajl-ruby
|
@@ -14,6 +14,14 @@ GEM
|
|
14
14
|
byebug (9.0.6)
|
15
15
|
coderay (1.1.0)
|
16
16
|
diff-lcs (1.2.5)
|
17
|
+
ffi (1.9.18)
|
18
|
+
haml (5.0.3)
|
19
|
+
temple (>= 0.8.0)
|
20
|
+
tilt
|
21
|
+
hanna-nouveau (1.0.2)
|
22
|
+
haml (>= 4)
|
23
|
+
rdoc (>= 4.0)
|
24
|
+
sass
|
17
25
|
httparty (0.14.0)
|
18
26
|
multi_xml (>= 0.5.2)
|
19
27
|
method_source (0.8.2)
|
@@ -23,6 +31,10 @@ GEM
|
|
23
31
|
method_source (~> 0.8.1)
|
24
32
|
slop (~> 3.4)
|
25
33
|
rake (10.4.2)
|
34
|
+
rb-fsevent (0.10.2)
|
35
|
+
rb-inotify (0.9.10)
|
36
|
+
ffi (>= 0.5.0, < 2)
|
37
|
+
rdoc (5.1.0)
|
26
38
|
rspec (3.0.0)
|
27
39
|
rspec-core (~> 3.0.0)
|
28
40
|
rspec-expectations (~> 3.0.0)
|
@@ -35,9 +47,16 @@ GEM
|
|
35
47
|
rspec-mocks (3.0.3)
|
36
48
|
rspec-support (~> 3.0.0)
|
37
49
|
rspec-support (3.0.3)
|
50
|
+
sass (3.5.1)
|
51
|
+
sass-listen (~> 4.0.0)
|
52
|
+
sass-listen (4.0.0)
|
53
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
54
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
38
55
|
slop (3.6.0)
|
56
|
+
temple (0.8.0)
|
57
|
+
tilt (2.0.8)
|
39
58
|
timecop (0.7.1)
|
40
|
-
yajl-ruby (1.
|
59
|
+
yajl-ruby (1.3.1)
|
41
60
|
|
42
61
|
PLATFORMS
|
43
62
|
ruby
|
@@ -47,10 +66,12 @@ DEPENDENCIES
|
|
47
66
|
bundler (~> 1.6)
|
48
67
|
byebug
|
49
68
|
gnip_api!
|
69
|
+
hanna-nouveau
|
50
70
|
pry
|
51
71
|
rake (~> 10.0)
|
72
|
+
rdoc
|
52
73
|
rspec
|
53
74
|
timecop
|
54
75
|
|
55
76
|
BUNDLED WITH
|
56
|
-
1.
|
77
|
+
1.16.0
|
data/README.md
CHANGED
@@ -1,22 +1,59 @@
|
|
1
|
-
### Important: Gnip support for PowerTrack v1 are officially deprecated.
|
2
|
-
|
3
1
|
# GnipApi
|
4
2
|
|
5
|
-
Connect with different Gnip APIs and get data from streams.
|
3
|
+
Connect with different Gnip APIs and get data from streams. Currently
|
4
|
+
Full Archive Search and PowerTrack APIs for Twitter data are implemented.
|
5
|
+
|
6
|
+
Documentation about Gnip APIs can be found here[http://support.gnip.com/].
|
7
|
+
|
8
|
+
Gnip API status page can be found here[https://status.gnip.com/]
|
9
|
+
|
10
|
+
## What is Gnip?
|
11
|
+
|
12
|
+
A Twitter division that offers access to Twitter data both historically and in
|
13
|
+
real time. Gnip is not restricted to Twitter only though, it offers a set of
|
14
|
+
different data sources you can integrate, Twitter is their main one of course.
|
15
|
+
|
16
|
+
# Gnip APIs
|
17
|
+
|
18
|
+
## Full Archive Search
|
6
19
|
|
7
|
-
|
20
|
+
It provides historical data with some aggregiations and can fetch both activities
|
21
|
+
and counts over a period of time. There are some limitations so be sure to
|
22
|
+
check the documentation.
|
8
23
|
|
9
|
-
|
10
|
-
|
11
|
-
|
24
|
+
Search API could return a 503 Software Error, which to me is just a different
|
25
|
+
way of a 500 error. Usually this happens on specific situations with specific
|
26
|
+
queries, however, it's not repeatable 100% of the time. If you encounter this
|
27
|
+
error, make your script wait for some seconds and retry. Alternatively you
|
28
|
+
can break down further the rules you're using or the periods. As far as I'm
|
29
|
+
aware of, it's likely to happen when querying large amounts of data on wide
|
30
|
+
periods.
|
12
31
|
|
13
|
-
##
|
32
|
+
## PowerTrack
|
14
33
|
|
15
|
-
|
16
|
-
|
17
|
-
- RateLimiter and Mutex dropped due to lack of usage
|
34
|
+
Provides ways to setup rules that act as filters/matchers and an HTTP stream
|
35
|
+
endpoint that will send the results to the consumer.
|
18
36
|
|
19
|
-
|
37
|
+
The HTTP stream can suffer from unexpected connection loss.
|
38
|
+
Sometimes it's intended from Gnip, and sometimes it doesn't seem so. Depending
|
39
|
+
on what you're doing with the received data, you may be disconnected due to a
|
40
|
+
slow consumer. Ideally you shouldn't do anything else than read and do processing
|
41
|
+
on a different process/thread. GnipApi offers a few different methods to deal
|
42
|
+
with this.
|
43
|
+
|
44
|
+
## A word about rules
|
45
|
+
|
46
|
+
It can be tricky to define proper rules. Please read the documentation on
|
47
|
+
each APIs to know how rules work. Search API and PowerTrack both use similar
|
48
|
+
rule structure, but there are differences between what can each do.
|
49
|
+
|
50
|
+
In some cases a rule can match undesired information. This is because Gnip
|
51
|
+
tokenizes the data and applies the rules to that parsed data. For example,
|
52
|
+
URLs can be matched by accident, and it won't be clear why exaclty. Gnip
|
53
|
+
doesn't mention what fields of a source object is considering to match
|
54
|
+
so be sure to target the matching properly.
|
55
|
+
|
56
|
+
# Installation
|
20
57
|
|
21
58
|
Add this line to your application's Gemfile:
|
22
59
|
|
@@ -32,9 +69,11 @@ Or install it yourself as:
|
|
32
69
|
|
33
70
|
$ gem install gnip_api
|
34
71
|
|
35
|
-
|
72
|
+
Use the master branch to get more frequent updates on this gem.
|
36
73
|
|
37
|
-
|
74
|
+
# Usage
|
75
|
+
|
76
|
+
## Configure the gem
|
38
77
|
|
39
78
|
```ruby
|
40
79
|
GnipApi.configure |config|
|
@@ -46,7 +85,7 @@ GnipApi.configure |config|
|
|
46
85
|
config.label = 'mystream' # General stream label, if none defined when quering, this will be used
|
47
86
|
config.request_timeout = 120 # Default time out on all requests, defaults to 60
|
48
87
|
config.debug = false # Defaults to false, enables/disables debug output on log
|
49
|
-
config.
|
88
|
+
config.log_level = Logger::WARN # Set it to Logger::DEBUG if you have problems to inspect queries and data
|
50
89
|
end
|
51
90
|
```
|
52
91
|
|
@@ -54,13 +93,10 @@ Put the avobe code in an initializer if you're using Rails, or somewhere else if
|
|
54
93
|
|
55
94
|
Note that you'll need a source and a label. Source is the data source within Gnip, such as Twitter, and label is the identifier of your stream.
|
56
95
|
|
57
|
-
|
58
|
-
|
59
|
-
## Important
|
96
|
+
## Search API
|
60
97
|
|
61
|
-
While using the Full Archived Histocial keep in mind Gnip seems to have some issues with their pagination on certain situations. You may face 503 errors which are unrecoverable from client side. If you come across this error please report the situationt to Gnip.
|
62
98
|
|
63
|
-
|
99
|
+
### Some notes
|
64
100
|
|
65
101
|
While using the Full Archive Search or FAS as we call it we faced some issues that you may encounter as
|
66
102
|
well if you use it. The most notorious one is the 503 "You encountered a problem in our software" which
|
@@ -74,7 +110,7 @@ If you wonder who came up with this ugly solution, the answer is GNIP itself, up
|
|
74
110
|
area about this. It doesn't seem proper to include this on the gem since this errors is not supposed to happen,
|
75
111
|
but it may eventually be included as an alternative querying to mitigate the problem.
|
76
112
|
|
77
|
-
|
113
|
+
### Overview
|
78
114
|
|
79
115
|
The Search API allows you to get counts or activities in a time period, with a maximum period size of 30 days per request. PowerTrack rules are used as query parameter, but be careful **PowerTrack operators may not be supported on Search API or could behave differently**. Read the Gnip docs to make sure.
|
80
116
|
To access the Search API you will need a rule first, you can use PowerTrack Rule object for it:
|
@@ -115,7 +151,7 @@ When you query for more than 30 days or more activities than ```:max_results```,
|
|
115
151
|
results = GnipApi::Search.new.counts :rule => rule, :from_date => DateTime.parse('2016-01-01 00:00'), :to_date => DateTime.parse('2016-05-01 22:00'), :bucket => 'day', :next_token => 'token_from_previous_request'
|
116
152
|
```
|
117
153
|
|
118
|
-
|
154
|
+
## PowerTrack
|
119
155
|
|
120
156
|
PowerTrack API has various functions. You can upload, delete and get rules and you can stream the activities. To create rules you need to create the rule objects:
|
121
157
|
|
@@ -157,23 +193,22 @@ GnipApi::PowerTrack::Stream.new.consume do |messages|
|
|
157
193
|
end
|
158
194
|
```
|
159
195
|
|
160
|
-
|
196
|
+
# Documentation
|
161
197
|
|
162
|
-
|
163
|
-
|
164
|
-
- Be careful when putting this into a daemon, closing the stream can be tricky given how this was done
|
165
|
-
- I've experience issues with a Zlib error that I currently couldn't debug and fix, if you build a daemon for this, be sure to code restart procedures
|
198
|
+
RDoc was integrated for this gem and documents will be included in the repo to browse.
|
199
|
+
You can execute:
|
166
200
|
|
167
|
-
|
201
|
+
$ rake rdoc
|
168
202
|
|
169
|
-
|
170
|
-
In any case, you were warned about it. Feel free to fill my issues list on Github :)
|
203
|
+
To regenerate it. Browse doc/rdoc/index.html to inspect the bundled documentation.
|
171
204
|
|
172
|
-
|
205
|
+
# WIP State
|
173
206
|
|
174
|
-
|
207
|
+
Various Gnip features aren't implemented yet and I lack access to them. I could
|
208
|
+
implement them from documentation alone, but given the experience I have with Gnip,
|
209
|
+
it might not work at all.
|
175
210
|
|
176
|
-
|
211
|
+
# Contributing
|
177
212
|
|
178
213
|
1. Fork it ( https://github.com/[my-github-username]/gnip_api/fork )
|
179
214
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
@@ -181,4 +216,6 @@ In any case, you were warned about it. Feel free to fill my issues list on Githu
|
|
181
216
|
4. Push to the branch (`git push origin my-new-feature`)
|
182
217
|
5. Create a new Pull Request
|
183
218
|
|
219
|
+
Feel free to ask/suggest ideas or features, or to report any bugs or issues.
|
220
|
+
|
184
221
|
This library was constructed with the help of [Armando Andini](https://github.com/antico5) who provided the basis to connect with the Gnip APIs.
|
data/Rakefile
CHANGED
@@ -1,2 +1,9 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
|
3
|
+
require 'rdoc/task' # ensure this file is also required in order to use `RDoc::Task`
|
4
|
+
RDoc::Task.new do |rdoc|
|
5
|
+
rdoc.rdoc_dir = 'doc/rdoc'
|
6
|
+
rdoc.generator = 'hanna'
|
7
|
+
rdoc.main = 'README.md'
|
8
|
+
rdoc.rdoc_files.include('README.md', 'LICENSE.txt', 'lib/')
|
9
|
+
end
|
@@ -0,0 +1,354 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html lang='en'>
|
3
|
+
<head>
|
4
|
+
<title>Gnip::Activity</title>
|
5
|
+
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
|
6
|
+
<link href='../../css/style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
|
+
<script type='text/javascript'>
|
8
|
+
function popupCode(url) {
|
9
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
10
|
+
}
|
11
|
+
|
12
|
+
function toggleCode(id) {
|
13
|
+
var code = document.getElementById(id)
|
14
|
+
|
15
|
+
code.style.display = code.style.display != 'block' ? 'block' : 'none'
|
16
|
+
return true
|
17
|
+
}
|
18
|
+
|
19
|
+
// Make codeblocks hidden by default
|
20
|
+
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
|
21
|
+
</script>
|
22
|
+
</head>
|
23
|
+
<body class='page'>
|
24
|
+
<div class='class' id='wrapper'>
|
25
|
+
<div class='header'>
|
26
|
+
<h1 class='name'><span class='type'>class</span>
|
27
|
+
Gnip::Activity
|
28
|
+
</h1>
|
29
|
+
<ol class='paths'>
|
30
|
+
<li>
|
31
|
+
<a href="../../files/lib/gnip_api/gnip/activity_rb.html">lib/gnip_api/gnip/activity.rb</a>
|
32
|
+
</li>
|
33
|
+
</ol>
|
34
|
+
<div class='parent'>
|
35
|
+
Superclass:
|
36
|
+
<strong><a href="Message.html">Message</a></strong>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
<div id='content'>
|
40
|
+
<div id='text'>
|
41
|
+
<div id='description'></div>
|
42
|
+
<div id='method-list'>
|
43
|
+
<h2>Methods</h2>
|
44
|
+
<h3>Public Class</h3>
|
45
|
+
<ol>
|
46
|
+
<li><a href="#method-c-new">new</a></li>
|
47
|
+
</ol>
|
48
|
+
<h3>Public Instance</h3>
|
49
|
+
<ol>
|
50
|
+
<li><a href="#attribute-i-actor">actor</a></li>
|
51
|
+
<li><a href="#method-i-author">author</a></li>
|
52
|
+
<li><a href="#attribute-i-body">body</a></li>
|
53
|
+
<li><a href="#attribute-i-display_text_range">display_text_range</a></li>
|
54
|
+
<li><a href="#attribute-i-favorites_count">favorites_count</a></li>
|
55
|
+
<li><a href="#attribute-i-generator">generator</a></li>
|
56
|
+
<li><a href="#attribute-i-gnip">gnip</a></li>
|
57
|
+
<li><a href="#method-i-hidden_data-3F">hidden_data?</a></li>
|
58
|
+
<li><a href="#attribute-i-id">id</a></li>
|
59
|
+
<li><a href="#attribute-i-link">link</a></li>
|
60
|
+
<li><a href="#attribute-i-long_object">long_object</a></li>
|
61
|
+
<li><a href="#attribute-i-object">object</a></li>
|
62
|
+
<li><a href="#attribute-i-object_type">object_type</a></li>
|
63
|
+
<li><a href="#attribute-i-posted_time">posted_time</a></li>
|
64
|
+
<li><a href="#attribute-i-provider">provider</a></li>
|
65
|
+
<li><a href="#attribute-i-raw">raw</a></li>
|
66
|
+
<li><a href="#method-i-retweet-3F">retweet?</a></li>
|
67
|
+
<li><a href="#attribute-i-retweet_count">retweet_count</a></li>
|
68
|
+
<li><a href="#method-i-to_h">to_h</a></li>
|
69
|
+
<li><a href="#method-i-to_json">to_json</a></li>
|
70
|
+
<li><a href="#method-i-tweet_id">tweet_id</a></li>
|
71
|
+
<li><a href="#attribute-i-twitter_entities">twitter_entities</a></li>
|
72
|
+
<li><a href="#attribute-i-twitter_filter_level">twitter_filter_level</a></li>
|
73
|
+
<li><a href="#attribute-i-twitter_lang">twitter_lang</a></li>
|
74
|
+
<li><a href="#attribute-i-verb">verb</a></li>
|
75
|
+
</ol>
|
76
|
+
</div>
|
77
|
+
<div id='context'>
|
78
|
+
</div>
|
79
|
+
<div id='section'>
|
80
|
+
<div id='attribute-list'>
|
81
|
+
<h2 class='section-bar'>Attributes</h2>
|
82
|
+
<div class='name-list'>
|
83
|
+
<table>
|
84
|
+
<tr class='top-aligned-row context-row'>
|
85
|
+
<td class='context-item-name'>
|
86
|
+
<a name='attribute-i-actor'>actor</a>
|
87
|
+
</td>
|
88
|
+
<td class='context-item-value'>[R]</td>
|
89
|
+
<td class='context-item-desc'></td>
|
90
|
+
</tr>
|
91
|
+
<tr class='top-aligned-row context-row'>
|
92
|
+
<td class='context-item-name'>
|
93
|
+
<a name='attribute-i-body'>body</a>
|
94
|
+
</td>
|
95
|
+
<td class='context-item-value'>[R]</td>
|
96
|
+
<td class='context-item-desc'></td>
|
97
|
+
</tr>
|
98
|
+
<tr class='top-aligned-row context-row'>
|
99
|
+
<td class='context-item-name'>
|
100
|
+
<a name='attribute-i-display_text_range'>display_text_range</a>
|
101
|
+
</td>
|
102
|
+
<td class='context-item-value'>[R]</td>
|
103
|
+
<td class='context-item-desc'></td>
|
104
|
+
</tr>
|
105
|
+
<tr class='top-aligned-row context-row'>
|
106
|
+
<td class='context-item-name'>
|
107
|
+
<a name='attribute-i-favorites_count'>favorites_count</a>
|
108
|
+
</td>
|
109
|
+
<td class='context-item-value'>[R]</td>
|
110
|
+
<td class='context-item-desc'></td>
|
111
|
+
</tr>
|
112
|
+
<tr class='top-aligned-row context-row'>
|
113
|
+
<td class='context-item-name'>
|
114
|
+
<a name='attribute-i-generator'>generator</a>
|
115
|
+
</td>
|
116
|
+
<td class='context-item-value'>[R]</td>
|
117
|
+
<td class='context-item-desc'></td>
|
118
|
+
</tr>
|
119
|
+
<tr class='top-aligned-row context-row'>
|
120
|
+
<td class='context-item-name'>
|
121
|
+
<a name='attribute-i-gnip'>gnip</a>
|
122
|
+
</td>
|
123
|
+
<td class='context-item-value'>[R]</td>
|
124
|
+
<td class='context-item-desc'></td>
|
125
|
+
</tr>
|
126
|
+
<tr class='top-aligned-row context-row'>
|
127
|
+
<td class='context-item-name'>
|
128
|
+
<a name='attribute-i-id'>id</a>
|
129
|
+
</td>
|
130
|
+
<td class='context-item-value'>[R]</td>
|
131
|
+
<td class='context-item-desc'></td>
|
132
|
+
</tr>
|
133
|
+
<tr class='top-aligned-row context-row'>
|
134
|
+
<td class='context-item-name'>
|
135
|
+
<a name='attribute-i-link'>link</a>
|
136
|
+
</td>
|
137
|
+
<td class='context-item-value'>[R]</td>
|
138
|
+
<td class='context-item-desc'></td>
|
139
|
+
</tr>
|
140
|
+
<tr class='top-aligned-row context-row'>
|
141
|
+
<td class='context-item-name'>
|
142
|
+
<a name='attribute-i-long_object'>long_object</a>
|
143
|
+
</td>
|
144
|
+
<td class='context-item-value'>[R]</td>
|
145
|
+
<td class='context-item-desc'></td>
|
146
|
+
</tr>
|
147
|
+
<tr class='top-aligned-row context-row'>
|
148
|
+
<td class='context-item-name'>
|
149
|
+
<a name='attribute-i-object'>object</a>
|
150
|
+
</td>
|
151
|
+
<td class='context-item-value'>[R]</td>
|
152
|
+
<td class='context-item-desc'></td>
|
153
|
+
</tr>
|
154
|
+
<tr class='top-aligned-row context-row'>
|
155
|
+
<td class='context-item-name'>
|
156
|
+
<a name='attribute-i-object_type'>object_type</a>
|
157
|
+
</td>
|
158
|
+
<td class='context-item-value'>[R]</td>
|
159
|
+
<td class='context-item-desc'></td>
|
160
|
+
</tr>
|
161
|
+
<tr class='top-aligned-row context-row'>
|
162
|
+
<td class='context-item-name'>
|
163
|
+
<a name='attribute-i-posted_time'>posted_time</a>
|
164
|
+
</td>
|
165
|
+
<td class='context-item-value'>[R]</td>
|
166
|
+
<td class='context-item-desc'></td>
|
167
|
+
</tr>
|
168
|
+
<tr class='top-aligned-row context-row'>
|
169
|
+
<td class='context-item-name'>
|
170
|
+
<a name='attribute-i-provider'>provider</a>
|
171
|
+
</td>
|
172
|
+
<td class='context-item-value'>[R]</td>
|
173
|
+
<td class='context-item-desc'></td>
|
174
|
+
</tr>
|
175
|
+
<tr class='top-aligned-row context-row'>
|
176
|
+
<td class='context-item-name'>
|
177
|
+
<a name='attribute-i-raw'>raw</a>
|
178
|
+
</td>
|
179
|
+
<td class='context-item-value'>[R]</td>
|
180
|
+
<td class='context-item-desc'></td>
|
181
|
+
</tr>
|
182
|
+
<tr class='top-aligned-row context-row'>
|
183
|
+
<td class='context-item-name'>
|
184
|
+
<a name='attribute-i-retweet_count'>retweet_count</a>
|
185
|
+
</td>
|
186
|
+
<td class='context-item-value'>[R]</td>
|
187
|
+
<td class='context-item-desc'></td>
|
188
|
+
</tr>
|
189
|
+
<tr class='top-aligned-row context-row'>
|
190
|
+
<td class='context-item-name'>
|
191
|
+
<a name='attribute-i-twitter_entities'>twitter_entities</a>
|
192
|
+
</td>
|
193
|
+
<td class='context-item-value'>[R]</td>
|
194
|
+
<td class='context-item-desc'></td>
|
195
|
+
</tr>
|
196
|
+
<tr class='top-aligned-row context-row'>
|
197
|
+
<td class='context-item-name'>
|
198
|
+
<a name='attribute-i-twitter_filter_level'>twitter_filter_level</a>
|
199
|
+
</td>
|
200
|
+
<td class='context-item-value'>[R]</td>
|
201
|
+
<td class='context-item-desc'></td>
|
202
|
+
</tr>
|
203
|
+
<tr class='top-aligned-row context-row'>
|
204
|
+
<td class='context-item-name'>
|
205
|
+
<a name='attribute-i-twitter_lang'>twitter_lang</a>
|
206
|
+
</td>
|
207
|
+
<td class='context-item-value'>[R]</td>
|
208
|
+
<td class='context-item-desc'></td>
|
209
|
+
</tr>
|
210
|
+
<tr class='top-aligned-row context-row'>
|
211
|
+
<td class='context-item-name'>
|
212
|
+
<a name='attribute-i-verb'>verb</a>
|
213
|
+
</td>
|
214
|
+
<td class='context-item-value'>[R]</td>
|
215
|
+
<td class='context-item-desc'></td>
|
216
|
+
</tr>
|
217
|
+
</table>
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
<div id='methods'>
|
221
|
+
<h2>Public Class methods</h2>
|
222
|
+
<div class='method public-class' id='method-method-c-new'>
|
223
|
+
<a name='method-c-new'></a>
|
224
|
+
<div class='synopsis'>
|
225
|
+
<span class='name'>new</span>
|
226
|
+
<span class='arguments'>(params = {})</span>
|
227
|
+
|
228
|
+
</div>
|
229
|
+
<div class='description'>
|
230
|
+
|
231
|
+
</div>
|
232
|
+
<div class='source'>
|
233
|
+
<a class='source-toggle' href='#' onclick='toggleCode('method-c-new-source'); return false'>
|
234
|
+
[show source]
|
235
|
+
</a>
|
236
|
+
<pre id='method-c-new-source'><span class="ruby-comment"># File lib/gnip_api/gnip/activity.rb, line 7</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">params</span> = {}
 <span class="ruby-ivar">@raw</span> = <span class="ruby-identifier">params</span>
 <span class="ruby-ivar">@id</span> = <span class="ruby-identifier">params</span>[<span class="ruby-string">'id'</span>]
 <span class="ruby-ivar">@object_type</span> = <span class="ruby-identifier">params</span>[<span class="ruby-string">'objectType'</span>]
 <span class="ruby-ivar">@actor</span> = <span class="ruby-constant">Gnip</span><span class="ruby-operator">::</span><span class="ruby-constant">Actor</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">params</span>[<span class="ruby-string">'actor'</span>]
 <span class="ruby-ivar">@verb</span> = <span class="ruby-identifier">params</span>[<span class="ruby-string">'verb'</span>]
 <span class="ruby-ivar">@posted_time</span> = <span class="ruby-identifier">params</span>[<span class="ruby-string">'postedTime'</span>]
 <span class="ruby-ivar">@generator</span> = <span class="ruby-identifier">params</span>[<span class="ruby-string">'generator'</span>]
 <span class="ruby-ivar">@provider</span> = <span class="ruby-identifier">params</span>[<span class="ruby-string">'provider'</span>]
 <span class="ruby-ivar">@link</span> = <span class="ruby-identifier">params</span>[<span class="ruby-string">'link'</span>]
 <span class="ruby-ivar">@body</span> = <span class="ruby-identifier">params</span>[<span class="ruby-string">'body'</span>]
 <span class="ruby-ivar">@object</span> = <span class="ruby-identifier">retweet?</span> <span class="ruby-operator">?</span> <span class="ruby-constant">Gnip</span><span class="ruby-operator">::</span><span class="ruby-constant">Activity</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">params</span>[<span class="ruby-string">'object'</span>]) <span class="ruby-operator">:</span> <span class="ruby-identifier">params</span>[<span class="ruby-string">'object'</span>]
 <span class="ruby-ivar">@favorites_count</span> = <span class="ruby-identifier">params</span>[<span class="ruby-string">'favoritesCount'</span>]
 <span class="ruby-ivar">@twitter_entities</span> = <span class="ruby-identifier">params</span>[<span class="ruby-string">'twitter_entities'</span>]
 <span class="ruby-ivar">@twitter_filter_level</span> = <span class="ruby-identifier">params</span>[<span class="ruby-string">'twitter_filter_level'</span>]
 <span class="ruby-ivar">@twitter_lang</span> = <span class="ruby-identifier">params</span>[<span class="ruby-string">'twitter_lang'</span>]
 <span class="ruby-ivar">@retweet_count</span> = <span class="ruby-identifier">params</span>[<span class="ruby-string">'retweetCount'</span>]
 <span class="ruby-ivar">@long_object</span> = <span class="ruby-identifier">params</span>[<span class="ruby-string">'long_object'</span>]
 <span class="ruby-ivar">@display_text_range</span> = <span class="ruby-identifier">params</span>[<span class="ruby-string">'display_text_range'</span>]
 <span class="ruby-ivar">@gnip</span> = <span class="ruby-constant">Gnip</span><span class="ruby-operator">::</span><span class="ruby-constant">GnipData</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">params</span>[<span class="ruby-string">'gnip'</span>]) <span class="ruby-keyword">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-string">'gnip'</span>]
<span class="ruby-keyword">end</span></pre>
|
237
|
+
</div>
|
238
|
+
</div>
|
239
|
+
<h2>Public Instance methods</h2>
|
240
|
+
<div class='method public-instance' id='method-method-i-author'>
|
241
|
+
<a name='method-i-author'></a>
|
242
|
+
<div class='synopsis'>
|
243
|
+
<span class='name'>author</span>
|
244
|
+
<span class='arguments'>()</span>
|
245
|
+
|
246
|
+
</div>
|
247
|
+
<div class='description'>
|
248
|
+
|
249
|
+
</div>
|
250
|
+
<div class='source'>
|
251
|
+
<a class='source-toggle' href='#' onclick='toggleCode('method-i-author-source'); return false'>
|
252
|
+
[show source]
|
253
|
+
</a>
|
254
|
+
<pre id='method-i-author-source'><span class="ruby-comment"># File lib/gnip_api/gnip/activity.rb, line 68</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">author</span>
 <span class="ruby-identifier">actor</span>.<span class="ruby-identifier">display_name</span>
<span class="ruby-keyword">end</span></pre>
|
255
|
+
</div>
|
256
|
+
</div>
|
257
|
+
<div class='method public-instance' id='method-method-i-hidden_data-3F'>
|
258
|
+
<a name='method-i-hidden_data-3F'></a>
|
259
|
+
<div class='synopsis'>
|
260
|
+
<span class='name'>hidden_data?</span>
|
261
|
+
<span class='arguments'>()</span>
|
262
|
+
|
263
|
+
</div>
|
264
|
+
<div class='description'>
|
265
|
+
|
266
|
+
</div>
|
267
|
+
<div class='source'>
|
268
|
+
<a class='source-toggle' href='#' onclick='toggleCode('method-i-hidden_data-3F-source'); return false'>
|
269
|
+
[show source]
|
270
|
+
</a>
|
271
|
+
<pre id='method-i-hidden_data-3F-source'><span class="ruby-comment"># File lib/gnip_api/gnip/activity.rb, line 76</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">hidden_data?</span>
 <span class="ruby-operator">!</span><span class="ruby-ivar">@display_text_range</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@long_object</span>.<span class="ruby-identifier">nil?</span>
<span class="ruby-keyword">end</span></pre>
|
272
|
+
</div>
|
273
|
+
</div>
|
274
|
+
<div class='method public-instance' id='method-method-i-retweet-3F'>
|
275
|
+
<a name='method-i-retweet-3F'></a>
|
276
|
+
<div class='synopsis'>
|
277
|
+
<span class='name'>retweet?</span>
|
278
|
+
<span class='arguments'>()</span>
|
279
|
+
|
280
|
+
</div>
|
281
|
+
<div class='description'>
|
282
|
+
|
283
|
+
</div>
|
284
|
+
<div class='source'>
|
285
|
+
<a class='source-toggle' href='#' onclick='toggleCode('method-i-retweet-3F-source'); return false'>
|
286
|
+
[show source]
|
287
|
+
</a>
|
288
|
+
<pre id='method-i-retweet-3F-source'><span class="ruby-comment"># File lib/gnip_api/gnip/activity.rb, line 72</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">retweet?</span> 
 <span class="ruby-identifier">verb</span> <span class="ruby-operator">==</span> <span class="ruby-string">'share'</span>
<span class="ruby-keyword">end</span></pre>
|
289
|
+
</div>
|
290
|
+
</div>
|
291
|
+
<div class='method public-instance' id='method-method-i-to_h'>
|
292
|
+
<a name='method-i-to_h'></a>
|
293
|
+
<div class='synopsis'>
|
294
|
+
<span class='name'>to_h</span>
|
295
|
+
<span class='arguments'>()</span>
|
296
|
+
|
297
|
+
</div>
|
298
|
+
<div class='description'>
|
299
|
+
|
300
|
+
</div>
|
301
|
+
<div class='source'>
|
302
|
+
<a class='source-toggle' href='#' onclick='toggleCode('method-i-to_h-source'); return false'>
|
303
|
+
[show source]
|
304
|
+
</a>
|
305
|
+
<pre id='method-i-to_h-source'><span class="ruby-comment"># File lib/gnip_api/gnip/activity.rb, line 29</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_h</span>
 {
 <span class="ruby-value">:id</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@id</span>,
 <span class="ruby-value">:objectType</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@object_type</span>,
 <span class="ruby-value">:actor</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@actor</span>.<span class="ruby-identifier">to_h</span>,
 <span class="ruby-value">:verb</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@verb</span>,
 <span class="ruby-value">:postedTime</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@posted_time</span>,
 <span class="ruby-value">:generator</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@generator</span>,
 <span class="ruby-value">:provider</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@provider</span>,
 <span class="ruby-value">:link</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@link</span>,
 <span class="ruby-value">:body</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@body</span>,
 <span class="ruby-value">:object</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Gnip</span><span class="ruby-operator">::</span><span class="ruby-constant">Activity</span>) <span class="ruby-operator">?</span> <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">to_h</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@object</span>,
 <span class="ruby-value">:favoritesCount</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@favorites_count</span>,
 <span class="ruby-value">:twitter_entities</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@twitter_entities</span>,
 <span class="ruby-value">:twitter_filter_level</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@twitter_filter_level</span>,
 <span class="ruby-value">:twitter_lang</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@twitter_lang</span>,
 <span class="ruby-value">:retweetCount</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@retweet_count</span>,
 <span class="ruby-value">:longObject</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@long_object</span>,
 <span class="ruby-value">:display_text_range</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@display_text_range</span>,
 <span class="ruby-value">:gnip</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@gnip</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@gnip</span>.<span class="ruby-identifier">to_h</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
 }
<span class="ruby-keyword">end</span></pre>
|
306
|
+
</div>
|
307
|
+
</div>
|
308
|
+
<div class='method public-instance' id='method-method-i-to_json'>
|
309
|
+
<a name='method-i-to_json'></a>
|
310
|
+
<div class='synopsis'>
|
311
|
+
<span class='name'>to_json</span>
|
312
|
+
<span class='arguments'>()</span>
|
313
|
+
|
314
|
+
</div>
|
315
|
+
<div class='description'>
|
316
|
+
|
317
|
+
</div>
|
318
|
+
<div class='source'>
|
319
|
+
<a class='source-toggle' href='#' onclick='toggleCode('method-i-to_json-source'); return false'>
|
320
|
+
[show source]
|
321
|
+
</a>
|
322
|
+
<pre id='method-i-to_json-source'><span class="ruby-comment"># File lib/gnip_api/gnip/activity.rb, line 64</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_json</span>
 <span class="ruby-ivar">@raw</span>.<span class="ruby-identifier">to_json</span>
<span class="ruby-keyword">end</span></pre>
|
323
|
+
</div>
|
324
|
+
</div>
|
325
|
+
<div class='method public-instance' id='method-method-i-tweet_id'>
|
326
|
+
<a name='method-i-tweet_id'></a>
|
327
|
+
<div class='synopsis'>
|
328
|
+
<span class='name'>tweet_id</span>
|
329
|
+
<span class='arguments'>()</span>
|
330
|
+
|
331
|
+
</div>
|
332
|
+
<div class='description'>
|
333
|
+
|
334
|
+
</div>
|
335
|
+
<div class='source'>
|
336
|
+
<a class='source-toggle' href='#' onclick='toggleCode('method-i-tweet_id-source'); return false'>
|
337
|
+
[show source]
|
338
|
+
</a>
|
339
|
+
<pre id='method-i-tweet_id-source'><span class="ruby-comment"># File lib/gnip_api/gnip/activity.rb, line 60</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">tweet_id</span>
 <span class="ruby-ivar">@id</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">':'</span>).<span class="ruby-identifier">last</span>
<span class="ruby-keyword">end</span></pre>
|
340
|
+
</div>
|
341
|
+
</div>
|
342
|
+
</div>
|
343
|
+
</div>
|
344
|
+
|
345
|
+
</div>
|
346
|
+
</div>
|
347
|
+
|
348
|
+
<div id='footer-push'></div>
|
349
|
+
</div>
|
350
|
+
<div id='footer'>
|
351
|
+
<a href="https://github.com/rdoc/hanna-nouveau"><strong>Hanna Nouveau</strong> RDoc template</a>
|
352
|
+
</div>
|
353
|
+
</body>
|
354
|
+
</html>
|