Class: Rlaunchpadlib::Person

Inherits:
Object
  • Object
show all
Defined in:
lib/rlaunchpadlib/person.rb

Overview

Wraps the Person object in Launchpad

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

Provides READ ONLY access

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username) ⇒ Person

Returns a new instance of Person.



23
24
25
26
# File 'lib/rlaunchpadlib/person.rb', line 23

def initialize(username)
    @client = Rlaunchpadlib::Client.new
    @username = "~#{username}"
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object

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



90
91
92
# 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

Instance Attribute Details

#archive_subscriptions_dataObject

Returns the value of attribute archive_subscriptions_data.



16
17
18
# File 'lib/rlaunchpadlib/person.rb', line 16

def archive_subscriptions_data
  @archive_subscriptions_data
end

#branches_dataObject

Returns the value of attribute branches_data.



17
18
19
# File 'lib/rlaunchpadlib/person.rb', line 17

def branches_data
  @branches_data
end

#bug_subscribers_dataObject

Returns the value of attribute bug_subscribers_data.



18
19
20
# File 'lib/rlaunchpadlib/person.rb', line 18

def bug_subscribers_data
  @bug_subscribers_data
end

#bugs_dataObject

Returns the value of attribute bugs_data.



21
22
23
# File 'lib/rlaunchpadlib/person.rb', line 21

def bugs_data
  @bugs_data
end

#merge_proposals_dataObject

Returns the value of attribute merge_proposals_data.



19
20
21
# File 'lib/rlaunchpadlib/person.rb', line 19

def merge_proposals_data
  @merge_proposals_data
end

#profile_dataObject

Returns the value of attribute profile_data.



15
16
17
# File 'lib/rlaunchpadlib/person.rb', line 15

def profile_data
  @profile_data
end

#requested_reviews_dataObject

Returns the value of attribute requested_reviews_data.



20
21
22
# File 'lib/rlaunchpadlib/person.rb', line 20

def requested_reviews_data
  @requested_reviews_data
end

#usernameObject

Returns the value of attribute username.



14
15
16
# File 'lib/rlaunchpadlib/person.rb', line 14

def username
  @username
end

Instance Method Details

#archive_subscriptionsObject



35
36
37
38
39
40
# 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

#branchesObject



42
43
44
45
46
47
# 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_packagesObject



49
50
51
52
53
54
# 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

#bugsObject



70
71
72
73
74
75
# File 'lib/rlaunchpadlib/person.rb', line 70

def bugs
    if @bugs_data.nil?
        @bugs_data = @client.get(@username, 'searchTasks')
    end
    @bugs_data
end

#clear_cacheObject



77
78
79
80
81
82
83
84
85
# 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_proposalsObject



56
57
58
59
60
61
# 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

#profileObject



28
29
30
31
32
33
# File 'lib/rlaunchpadlib/person.rb', line 28

def profile
    if @profile_data.nil?
        @profile_data = @client.get(@username)
    end
    @profile_data
end

#requested_reviewsObject



63
64
65
66
67
68
# 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