Class: Ayadn::UserObject

Inherits:
Object show all
Defined in:
lib/ayadn/user_object.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash, username = nil) ⇒ UserObject

Returns a new instance of UserObject.



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
# File 'lib/ayadn/user_object.rb', line 84

def initialize hash, username = nil
  @input = hash['data'].nil? ? hash : hash['data']
  @meta = UserMetaObject.new(hash, username)
  @you_muted = @input["you_muted"]
  @you_can_subscribe = @input["you_can_subscribe"]
  @is_follower = @input["is_follower"]
  @is_following = @input["is_following"]
  @timezone = @input["timezone"]
  @you_follow = @input["you_follow"]
  @counts = UserCountsObject.new(@input) unless @input.empty?
  @canonical_url = @input["canonical_url"]
  @id = @input["id"]
  @locale = @input["locale"]
  @type = @input["type"]
  if !@input["annotations"].nil?
    @annotations = @input["annotations"].map { |hash| UserAnnotationObject.new(hash) }
  else
    @annotations = []
  end
  @username = @input["username"]
  @avatar_image = AvatarImageObject.new(@input) unless @input.empty?
  @description = UserDescriptionObject.new(@input) unless @input.empty?
  @is_muted = @input["is_muted"]
  @follows_you = @input["follows_you"]
  @you_can_follow = @input["you_can_follow"]
  @name = @input["name"].to_s.force_encoding("UTF-8")
  @created_at = @input["created_at"]
  @you_blocked = @input["you_blocked"]
  @cover_image = CoverImageObject.new(@input) unless @input.empty?
  @verified_domain = @input["verified_domain"]
end

Instance Attribute Details

#annotationsObject

Returns the value of attribute annotations.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def annotations
  @annotations
end

#avatar_imageObject

Returns the value of attribute avatar_image.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def avatar_image
  @avatar_image
end

#canonical_urlObject

Returns the value of attribute canonical_url.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def canonical_url
  @canonical_url
end

#countsObject

Returns the value of attribute counts.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def counts
  @counts
end

#cover_imageObject

Returns the value of attribute cover_image.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def cover_image
  @cover_image
end

#created_atObject

Returns the value of attribute created_at.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def created_at
  @created_at
end

#descriptionObject

Returns the value of attribute description.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def description
  @description
end

#follows_youObject

Returns the value of attribute follows_you.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def follows_you
  @follows_you
end

#idObject

Returns the value of attribute id.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def id
  @id
end

#inputObject

Returns the value of attribute input.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def input
  @input
end

#is_followerObject

Returns the value of attribute is_follower.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def is_follower
  @is_follower
end

#is_followingObject

Returns the value of attribute is_following.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def is_following
  @is_following
end

#is_mutedObject

Returns the value of attribute is_muted.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def is_muted
  @is_muted
end

#localeObject

Returns the value of attribute locale.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def locale
  @locale
end

#metaObject

Returns the value of attribute meta.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def meta
  @meta
end

#nameObject

Returns the value of attribute name.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def name
  @name
end

#timezoneObject

Returns the value of attribute timezone.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def timezone
  @timezone
end

#typeObject

Returns the value of attribute type.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def type
  @type
end

#usernameObject

Returns the value of attribute username.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def username
  @username
end

#verified_domainObject

Returns the value of attribute verified_domain.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def verified_domain
  @verified_domain
end

#you_blockedObject

Returns the value of attribute you_blocked.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def you_blocked
  @you_blocked
end

#you_can_followObject

Returns the value of attribute you_can_follow.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def you_can_follow
  @you_can_follow
end

#you_can_subscribeObject

Returns the value of attribute you_can_subscribe.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def you_can_subscribe
  @you_can_subscribe
end

#you_followObject

Returns the value of attribute you_follow.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def you_follow
  @you_follow
end

#you_mutedObject

Returns the value of attribute you_muted.



82
83
84
# File 'lib/ayadn/user_object.rb', line 82

def you_muted
  @you_muted
end