Class: Tweetkit::Response::Tweets::Tweet
- Inherits:
-
Object
- Object
- Tweetkit::Response::Tweets::Tweet
show all
- Defined in:
- lib/tweetkit/response.rb
Defined Under Namespace
Classes: Annotations, Attachments, Geo, Metrics
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(tweet) ⇒ Tweet
Returns a new instance of Tweet.
100
101
102
103
104
|
# File 'lib/tweetkit/response.rb', line 100
def initialize()
@data =
@annotations = Annotations.new(data['context_annotations'], data['entities'])
@attachments = Attachments.new(data['attachments'])
end
|
Instance Attribute Details
#annotations ⇒ Object
Returns the value of attribute annotations.
98
99
100
|
# File 'lib/tweetkit/response.rb', line 98
def annotations
@annotations
end
|
#attachments ⇒ Object
Returns the value of attribute attachments.
98
99
100
|
# File 'lib/tweetkit/response.rb', line 98
def attachments
@attachments
end
|
#data ⇒ Object
Returns the value of attribute data.
98
99
100
|
# File 'lib/tweetkit/response.rb', line 98
def data
@data
end
|
Instance Method Details
#author_id ⇒ Object
114
115
116
|
# File 'lib/tweetkit/response.rb', line 114
def author_id
data['author_id']
end
|
#context_annotations ⇒ Object
174
175
176
|
# File 'lib/tweetkit/response.rb', line 174
def context_annotations
@annotations.context_annotations || nil
end
|
#conversation_id ⇒ Object
118
119
120
|
# File 'lib/tweetkit/response.rb', line 118
def conversation_id
data['conversation_id']
end
|
#created_at ⇒ Object
122
123
124
|
# File 'lib/tweetkit/response.rb', line 122
def created_at
data['created_at']
end
|
#device ⇒ Object
158
159
160
|
# File 'lib/tweetkit/response.rb', line 158
def device
source
end
|
#entities ⇒ Object
182
183
184
|
# File 'lib/tweetkit/response.rb', line 182
def entities
@annotations.entity_annotations || nil
end
|
#entity_annotations ⇒ Object
178
179
180
|
# File 'lib/tweetkit/response.rb', line 178
def entity_annotations
entities
end
|
#id ⇒ Object
106
107
108
|
# File 'lib/tweetkit/response.rb', line 106
def id
data['id']
end
|
#in_reply_to_user_id ⇒ Object
130
131
132
|
# File 'lib/tweetkit/response.rb', line 130
def in_reply_to_user_id
data['in_reply_to_user_id']
end
|
#lang ⇒ Object
134
135
136
|
# File 'lib/tweetkit/response.rb', line 134
def lang
data['lang']
end
|
#nsfw? ⇒ Boolean
138
139
140
|
# File 'lib/tweetkit/response.rb', line 138
def nsfw?
possibly_sensitive
end
|
#permission ⇒ Object
150
151
152
|
# File 'lib/tweetkit/response.rb', line 150
def permission
reply_settings
end
|
#possibly_sensitive ⇒ Object
146
147
148
|
# File 'lib/tweetkit/response.rb', line 146
def possibly_sensitive
data['possibly_sensitive']
end
|
#reply_settings ⇒ Object
154
155
156
|
# File 'lib/tweetkit/response.rb', line 154
def reply_settings
data['reply_settings']
end
|
#reply_to ⇒ Object
126
127
128
|
# File 'lib/tweetkit/response.rb', line 126
def reply_to
in_reply_to_user_id
end
|
#sensitive? ⇒ Boolean
142
143
144
|
# File 'lib/tweetkit/response.rb', line 142
def sensitive?
possibly_sensitive
end
|
#source ⇒ Object
162
163
164
|
# File 'lib/tweetkit/response.rb', line 162
def source
data['source']
end
|
#text ⇒ Object
110
111
112
|
# File 'lib/tweetkit/response.rb', line 110
def text
data['text']
end
|
#withheld ⇒ Object
170
171
172
|
# File 'lib/tweetkit/response.rb', line 170
def withheld
data['withheld']
end
|
#withheld? ⇒ Boolean
166
167
168
|
# File 'lib/tweetkit/response.rb', line 166
def withheld?
withheld && !withheld.empty?
end
|