Class: LiveJournal::Request::Friends

Inherits:
Req
  • Object
show all
Defined in:
lib/livejournal/friends.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Req

#dryrun!, #dumpresponse, #verbose!

Constructor Details

#initialize(user, opts = {}) ⇒ Friends

Allowed options:

:include_friendofs => true

also fill out @friendofs in single request



75
76
77
78
79
80
# File 'lib/livejournal/friends.rb', line 75

def initialize(user, opts={})
  super(user, 'getfriends')
  @friends = nil
  @friendofs = nil
  @request['includefriendof'] = true if opts.has_key? :include_friendofs
end

Instance Attribute Details

#friendofsObject (readonly)

Returns the value of attribute friendofs.



72
73
74
# File 'lib/livejournal/friends.rb', line 72

def friendofs
  @friendofs
end

#friendsObject (readonly)

Returns the value of attribute friends.



72
73
74
# File 'lib/livejournal/friends.rb', line 72

def friends
  @friends
end

Instance Method Details

#runObject

Returns an array of LiveJournal::Friend.



82
83
84
85
86
87
# File 'lib/livejournal/friends.rb', line 82

def run
  super
  @friends = build_array('friend') { |r| Friend.new.from_request(r) }
  @friendofs = build_array('friendof') { |r| Friend.new.from_request(r) }
  @friends
end