class Rlaunchpadlib::Person

Wraps the Person object in Launchpad

launchpad.net/+apidoc/1.0.html#person

Provides READ ONLY access

Attributes

archive_subscriptions_data[RW]
branches_data[RW]
bug_subscribers_data[RW]
bugs_data[RW]
merge_proposals_data[RW]
profile_data[RW]
requested_reviews_data[RW]
username[RW]

Public Class Methods

new(username) click to toggle source
# File lib/rlaunchpadlib/person.rb, line 23
def initialize(username)
    @client = Rlaunchpadlib::Client.new
    @username = "~#{username}"
end

Public Instance Methods

archive_subscriptions() click to toggle source
# File lib/rlaunchpadlib/person.rb, line 35
def archive_subscriptions
    if @archive_subscriptions_data.nil?                
        @archive_subscriptions_data =  @client.get(@username, 'getArchiveSubscriptionUrls')
    end
    @archive_subscriptions_data
end
branches() click to toggle source
# File lib/rlaunchpadlib/person.rb, line 42
def branches
    if @branches_data.nil?
        @branches_data = @client.get(@username, 'getBranches')
    end
    @branches_data
end
bug_subscriber_packages() click to toggle source
# File lib/rlaunchpadlib/person.rb, line 49
def bug_subscriber_packages
    if @bug_subscribers_data.nil?
        @bug_subscribers_data = @client.get(@username, 'getBugSubscriberPackages')
    end
    @bug_subscribers_data
end
bugs() click to toggle source
# File lib/rlaunchpadlib/person.rb, line 70
def bugs
    if @bugs_data.nil?
        @bugs_data = @client.get(@username, 'searchTasks')
    end
    @bugs_data
end
clear_cache() click to toggle source
# File lib/rlaunchpadlib/person.rb, line 77
def clear_cache
    @profile_data = nil
    @archive_subscriptions_data = nil
    @branches_data = nil
    @bug_subscribers_data = nil
    @merge_proposals_data = nil
    @requested_reviews_data = nil
    @bugs_data = nil
end
merge_proposals() click to toggle source
# File lib/rlaunchpadlib/person.rb, line 56
def merge_proposals
    if @merge_proposals_data.nil?
        @merge_proposals_data = @client.get(@username, 'getMergeProposals')
    end
    @merge_proposals_data
end
method_missing(name, *args, &block) click to toggle source

I’m nuts so lets patch method missing for easy acces to profile data.

Calls superclass method
# File lib/rlaunchpadlib/person.rb, line 90
def method_missing(name, *args, &block)
  profile.has_key?(name.to_s) ? profile[name.to_s] : super
end
profile() click to toggle source
# File lib/rlaunchpadlib/person.rb, line 28
def profile
    if @profile_data.nil?
        @profile_data = @client.get(@username)
    end
    @profile_data
end
requested_reviews() click to toggle source
# File lib/rlaunchpadlib/person.rb, line 63
def requested_reviews
    if @requested_reviews_data.nil?
        @requested_reviews_data = @client.get(@username, 'getRequestedReviews')
    end
    @requested_reviews_data
end