Class: Gnip::Activity
Constant Summary
Constants inherited from Message
Instance Attribute Summary collapse
-
#actor ⇒ Object
readonly
Returns the value of attribute actor.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#favorites_count ⇒ Object
readonly
Returns the value of attribute favorites_count.
-
#generator ⇒ Object
readonly
Returns the value of attribute generator.
-
#gnip ⇒ Object
readonly
Returns the value of attribute gnip.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#object_type ⇒ Object
readonly
Returns the value of attribute object_type.
-
#posted_time ⇒ Object
readonly
Returns the value of attribute posted_time.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#retweet_count ⇒ Object
readonly
Returns the value of attribute retweet_count.
-
#twitter_entities ⇒ Object
readonly
Returns the value of attribute twitter_entities.
-
#twitter_filter_level ⇒ Object
readonly
Returns the value of attribute twitter_filter_level.
-
#twitter_lang ⇒ Object
readonly
Returns the value of attribute twitter_lang.
-
#verb ⇒ Object
readonly
Returns the value of attribute verb.
Instance Method Summary collapse
- #author ⇒ Object
-
#initialize(params = {}) ⇒ Activity
constructor
A new instance of Activity.
- #original_attributes ⇒ Object
- #retweet? ⇒ Boolean
- #to_json ⇒ Object
- #tweet_id ⇒ Object
Methods inherited from Message
#activity?, build, #error?, #generate_json, #info?, #system_message?, #warn?
Constructor Details
permalink #initialize(params = {}) ⇒ Activity
Returns a new instance of Activity.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gnip_api/gnip/activity.rb', line 7 def initialize params = {} @id = params['id'] @object_type = params['objectType'] @actor = Gnip::Actor.new params['actor'] @verb = params['verb'] @posted_time = params['postedTime'] @generator = params['generator'] @provider = params['provider'] @link = params['link'] @body = params['body'] @object = retweet? ? Gnip::Activity.new(params['object']) : params['object'] @favorites_count = params['favoritesCount'] @twitter_entities = params['twitter_entities'] @twitter_filter_level = params['twitter_filter_level'] @twitter_lang = params['twitter_lang'] @retweet_count = params['retweetCount'] @gnip = Gnip::GnipData.new(params['gnip']) if params['gnip'] end |
Instance Attribute Details
permalink #actor ⇒ Object (readonly)
Returns the value of attribute actor.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def actor @actor end |
permalink #body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def body @body end |
permalink #favorites_count ⇒ Object (readonly)
Returns the value of attribute favorites_count.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def favorites_count @favorites_count end |
permalink #generator ⇒ Object (readonly)
Returns the value of attribute generator.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def generator @generator end |
permalink #gnip ⇒ Object (readonly)
Returns the value of attribute gnip.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def gnip @gnip end |
permalink #id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def id @id end |
permalink #link ⇒ Object (readonly)
Returns the value of attribute link.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def link @link end |
permalink #object ⇒ Object (readonly)
Returns the value of attribute object.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def object @object end |
permalink #object_type ⇒ Object (readonly)
Returns the value of attribute object_type.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def object_type @object_type end |
permalink #posted_time ⇒ Object (readonly)
Returns the value of attribute posted_time.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def posted_time @posted_time end |
permalink #provider ⇒ Object (readonly)
Returns the value of attribute provider.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def provider @provider end |
permalink #retweet_count ⇒ Object (readonly)
Returns the value of attribute retweet_count.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def retweet_count @retweet_count end |
permalink #twitter_entities ⇒ Object (readonly)
Returns the value of attribute twitter_entities.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def twitter_entities @twitter_entities end |
permalink #twitter_filter_level ⇒ Object (readonly)
Returns the value of attribute twitter_filter_level.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def twitter_filter_level @twitter_filter_level end |
permalink #twitter_lang ⇒ Object (readonly)
Returns the value of attribute twitter_lang.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def twitter_lang @twitter_lang end |
permalink #verb ⇒ Object (readonly)
Returns the value of attribute verb.
3 4 5 |
# File 'lib/gnip_api/gnip/activity.rb', line 3 def verb @verb end |
Instance Method Details
permalink #author ⇒ Object
[View source]
63 64 65 |
# File 'lib/gnip_api/gnip/activity.rb', line 63 def actor.display_name end |
permalink #original_attributes ⇒ Object
[View source]
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/gnip_api/gnip/activity.rb', line 26 def original_attributes { :id => @id, :objectType => @object_type, :actor => @actor.original_attributes, :verb => @verb, :postedTime => @posted_time, :generator => @generator, :provider => @provider, :link => @link, :body => @body, :object => @object.kind_of?(Gnip::Activity) ? @object.original_attributes : @object, :favoritesCount => @favorites_count, :twitter_entities => @twitter_entities, :twitter_filter_level => @twitter_filter_level, :twitter_lang => @twitter_lang, :retweetCount => @retweet_count, :gnip => @gnip ? @gnip.original_attributes : nil } end |
permalink #retweet? ⇒ Boolean
67 68 69 |
# File 'lib/gnip_api/gnip/activity.rb', line 67 def retweet? verb == 'share' end |
permalink #to_json ⇒ Object
[View source]
59 60 61 |
# File 'lib/gnip_api/gnip/activity.rb', line 59 def to_json generate_json(original_attributes) end |
permalink #tweet_id ⇒ Object
[View source]
55 56 57 |
# File 'lib/gnip_api/gnip/activity.rb', line 55 def tweet_id @id.split(':').last end |