Class: Rlaunchpadlib::Project

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ Project

Returns a new instance of Project.



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

def initialize(project)
    @project = project
    @client = Rlaunchpadlib::Client.new
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.



77
78
79
# File 'lib/rlaunchpadlib/project.rb', line 77

def method_missing(name, *args, &block)
  overview.has_key?(name.to_s) ? overview[name.to_s] : super
end

Instance Attribute Details

#branch_dataObject

Returns the value of attribute branch_data.



8
9
10
# File 'lib/rlaunchpadlib/project.rb', line 8

def branch_data
  @branch_data
end

#bug_dataObject

Returns the value of attribute bug_data.



7
8
9
# File 'lib/rlaunchpadlib/project.rb', line 7

def bug_data
  @bug_data
end

#merge_proposal_dataObject

Returns the value of attribute merge_proposal_data.



9
10
11
# File 'lib/rlaunchpadlib/project.rb', line 9

def merge_proposal_data
  @merge_proposal_data
end

#overview_dataObject

Returns the value of attribute overview_data.



5
6
7
# File 'lib/rlaunchpadlib/project.rb', line 5

def overview_data
  @overview_data
end

#projectObject

Returns the value of attribute project.



4
5
6
# File 'lib/rlaunchpadlib/project.rb', line 4

def project
  @project
end

#subscription_dataObject

Returns the value of attribute subscription_data.



10
11
12
# File 'lib/rlaunchpadlib/project.rb', line 10

def subscription_data
  @subscription_data
end

#timeline_dataObject

Returns the value of attribute timeline_data.



11
12
13
# File 'lib/rlaunchpadlib/project.rb', line 11

def timeline_data
  @timeline_data
end

Instance Method Details

#branchesObject



35
36
37
38
39
40
# File 'lib/rlaunchpadlib/project.rb', line 35

def branches
    if @branch_data.nil?
        @branch_data = @client.get(@project, 'getBranches')
    end
    @branch_data
end

#bugsObject



27
28
29
30
31
32
# File 'lib/rlaunchpadlib/project.rb', line 27

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

#clear_cacheObject



65
66
67
68
69
70
71
72
# File 'lib/rlaunchpadlib/project.rb', line 65

def clear_cache
    @overview_data = nil
    @subscription_data = nil
    @branch_data = nil
    @merge_proposal_data = nil
    @bug_data = nil
    @timeline_data = nil
end

#merge_proposalsObject



43
44
45
46
47
48
# File 'lib/rlaunchpadlib/project.rb', line 43

def merge_proposals
    if @merge_proposal_data.nil?
        @merge_proposal_data = @client.get(@project, 'getMergeProposals')
    end
    @merge_proposal_data
end

#overviewObject



18
19
20
21
22
23
24
# File 'lib/rlaunchpadlib/project.rb', line 18

def overview
    if @overview_data.nil?
        @client.get(@project)
    else
        @overview_data
    end
end

#subscriptionsObject



50
51
52
53
54
55
# File 'lib/rlaunchpadlib/project.rb', line 50

def subscriptions
    if @subscription_data.nil?
        @subscription_data = @client.get(@project, 'getSubscriptions')
    end
    @subscription_data
end

#timelineObject



57
58
59
60
61
62
# File 'lib/rlaunchpadlib/project.rb', line 57

def timeline
    if @timeline_data.nil?
        @timeline_data = @client.get(@project, 'get_timeline')
    end
    @timeline_data
end