Module: Rik::Client::User

Included in:
Rik::Client
Defined in:
lib/rik/client/user.rb

Instance Method Summary collapse

Instance Method Details

#followers(*args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rik/client/user.rb', line 6

def followers(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  
  user = args.first || get_user_id
  
  begin
    call 'qik.user.followers', user
  rescue Rik::API::Error => error
    unless error.fault_code == 2002 
      STDERR << error
      nil
    else # invalid session lets renew
      recreate
      retry
    end
  end
end

#following(*args) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rik/client/user.rb', line 24

def following(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  
  user = args.first || get_user_id
  
  begin
    call 'qik.user.following', user
  rescue Rik::API::Error => error
    unless error.fault_code == 2002 
      STDERR << error
      nil
    else # invalid session lets renew
      recreate
      retry
    end
  end
end

#public_profile(*args) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/rik/client/user.rb', line 42

def public_profile(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  
  user = args.first || get_user_id
  
  detailed = options[:detailed] ? '_detailed' : ''
  by_id = user.is_a?(Numeric) ? '_by_id' : ''

  begin 
    call "qik.user.public#{detailed}_profile#{by_id}", user
  rescue Rik::API::Error => error
    unless error.fault_code == 2002 
      STDERR << error
      nil
    else # invalid session lets renew
      recreate
      retry
    end
  end
end