Class: Gnip::Actor

Inherits:
Message show all
Defined in:
lib/gnip_api/gnip/actor.rb

Constant Summary

Constants inherited from Message

Message::SYSTEM_MESSAGE_TYPES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Message

#activity?, build, #error?, #generate_json, #info?, #system_message?, #warn?

Constructor Details

#initialize(params = {}) ⇒ Actor

Returns a new instance of Actor.


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/gnip_api/gnip/actor.rb', line 7

def initialize params = {}
  @object_type = params['objectType']
  @id = params['id']
  @link = params['link']
  @display_name = params['displayName']
  @posted_time = params['postedTime']
  @image = params['image']
  @summary = params['summary']
  @links = params['links']
  @friends_count = params['friendsCount']
  @followers_count = params['followersCount']
  @listed_count = params['listedCount']
  @statuses_count = params['statusesCount']
  @twitter_time_zone = params['twitterTimeZone']
  @verified = params['verified']
  @utc_offset = params['utcOffset']
  @preferred_username = params['preferredUsername']
  @languages = params['languages'].join(',')
  @location = params['location']
  @favorites_count = params['favoritesCount']
end

Instance Attribute Details

#display_nameObject (readonly)

Returns the value of attribute display_name.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def display_name
  @display_name
end

#favorites_countObject (readonly)

Returns the value of attribute favorites_count.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def favorites_count
  @favorites_count
end

#followers_countObject (readonly)

Returns the value of attribute followers_count.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def followers_count
  @followers_count
end

#friends_countObject (readonly)

Returns the value of attribute friends_count.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def friends_count
  @friends_count
end

#idObject (readonly)

Returns the value of attribute id.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def id
  @id
end

#imageObject (readonly)

Returns the value of attribute image.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def image
  @image
end

#languagesObject (readonly)

Returns the value of attribute languages.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def languages
  @languages
end

Returns the value of attribute link.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def link
  @link
end

Returns the value of attribute links.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def links
  @links
end

#locationObject (readonly)

Returns the value of attribute location.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def location
  @location
end

#object_typeObject (readonly)

Returns the value of attribute object_type.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def object_type
  @object_type
end

#posted_timeObject (readonly)

Returns the value of attribute posted_time.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def posted_time
  @posted_time
end

#preferred_usernameObject (readonly)

Returns the value of attribute preferred_username.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def preferred_username
  @preferred_username
end

#statuses_countObject (readonly)

Returns the value of attribute statuses_count.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def statuses_count
  @statuses_count
end

#summaryObject (readonly)

Returns the value of attribute summary.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def summary
  @summary
end

#twitter_time_zoneObject (readonly)

Returns the value of attribute twitter_time_zone.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def twitter_time_zone
  @twitter_time_zone
end

#utc_offsetObject (readonly)

Returns the value of attribute utc_offset.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def utc_offset
  @utc_offset
end

#verifiedObject (readonly)

Returns the value of attribute verified.


3
4
5
# File 'lib/gnip_api/gnip/actor.rb', line 3

def verified
  @verified
end

Instance Method Details

#original_attributesObject


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/gnip_api/gnip/actor.rb', line 29

def original_attributes
  {
    :objectType => @object_type,
    :id => @id,
    :link => @link,
    :displayName => @display_name,
    :postedTime => @posted_time,
    :image => @image,
    :summary => @summary,
    :links => @links,
    :friendsCount => @friends_count,
    :followersCount => @followers_count,
    :listedCount => @listed_count,
    :statusesCount => @statuses_count,
    :twitterTimeZone => @twitter_time_zone,
    :verified => @verified,
    :utcOffset => @utc_offset,
    :preferredUsername => @preferred_username,
    :languages => @languages.split(','),
    :location => @location,
    :favoritesCount => @favorites_count
  }
end

#to_jsonObject


61
62
63
# File 'lib/gnip_api/gnip/actor.rb', line 61

def to_json
  generate_json(original_attributes)
end

#user_idObject


53
54
55
# File 'lib/gnip_api/gnip/actor.rb', line 53

def user_id
  @id.split(':').last
end