Class: GithubIssueImporter::Launchpad
- Inherits:
-
Object
- Object
- GithubIssueImporter::Launchpad
- Defined in:
- lib/github-issue-importer/launchpad.rb
Instance Method Summary collapse
- #get(url) ⇒ Object
- #get_bug(id) ⇒ Object
- #get_bug_comments(id) ⇒ Object
- #get_bug_entries(project) ⇒ Object
- #get_owner(id) ⇒ Object
-
#initialize ⇒ Launchpad
constructor
A new instance of Launchpad.
Constructor Details
#initialize ⇒ Launchpad
Returns a new instance of Launchpad.
7 8 9 |
# File 'lib/github-issue-importer/launchpad.rb', line 7 def initialize @owners = Hash.new end |
Instance Method Details
#get(url) ⇒ Object
49 50 51 |
# File 'lib/github-issue-importer/launchpad.rb', line 49 def get(url) JSON.parse open(url).read end |
#get_bug(id) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/github-issue-importer/launchpad.rb', line 16 def get_bug(id) if id.is_a? Hash bug_link = id['bug_link'] else bug_link = "https://api.launchpad.net/1.0/bugs/#{id}" end get bug_link end |
#get_bug_comments(id) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/github-issue-importer/launchpad.rb', line 25 def get_bug_comments(id) if id.is_a? Hash bug_comments_link = id['messages_collection_link'] else bug_comments_link = "https://api.launchpad.net/1.0/bugs/#{id}/comments" end comments = get bug_comments_link comments['entries'] end |
#get_bug_entries(project) ⇒ Object
11 12 13 14 |
# File 'lib/github-issue-importer/launchpad.rb', line 11 def get_bug_entries(project) bugs = get "https://api.launchpad.net/1.0/#{project}?ws.op=searchTasks" bugs['entries'] end |
#get_owner(id) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/github-issue-importer/launchpad.rb', line 35 def get_owner(id) if id.is_a? Hash owner_link = id['owner_link'] else owner_link = "https://api.launchpad.net/1.0/~#{id}" end if @owners[owner_link].nil? @owners[owner_link] = get owner_link end @owners[owner_link] end |