Class: PixivApi::Response::Friend

Inherits:
Identity show all
Defined in:
lib/pixiv_api/response/friend.rb

Instance Attribute Summary collapse

Attributes inherited from PixivApi::Response

#attributes, #response

Instance Method Summary collapse

Methods inherited from PixivApi::Response

#[], attr_reader, define_attribute_method, define_attributes_method, define_blob_method, define_time_method, from_response

Constructor Details

#initialize(response, attributes) ⇒ Friend

Returns a new instance of Friend.



8
9
10
11
12
13
14
15
16
17
# File 'lib/pixiv_api/response/friend.rb', line 8

def initialize(response, attributes)
  user_id = attributes['user'].delete('id')

  merged = attributes['user'].merge(
    id: attributes['id'],
    user_id: user_id
  )

  super(response, merged)
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.



4
5
6
# File 'lib/pixiv_api/response/friend.rb', line 4

def 
  @account
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/pixiv_api/response/friend.rb', line 4

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/pixiv_api/response/friend.rb', line 4

def name
  @name
end

#user_idObject (readonly)

Returns the value of attribute user_id.



4
5
6
# File 'lib/pixiv_api/response/friend.rb', line 4

def user_id
  @user_id
end

Instance Method Details

#avatar_urlObject



19
20
21
# File 'lib/pixiv_api/response/friend.rb', line 19

def avatar_url
  blob_profile_image_urls['px_50x50']
end