Class: GHTRetrieveOne
- Inherits:
-
GHTorrent::Command
- Object
- GHTorrent::Command
- GHTRetrieveOne
- Defined in:
- lib/ghtorrent/commands/ght_retrieve_one.rb
Constant Summary
Constants included from GHTorrent::Persister
GHTorrent::Persister::ADAPTERS
Constants included from GHTorrent::Settings
GHTorrent::Settings::CONFIGKEYS, GHTorrent::Settings::DEFAULTS
Instance Method Summary collapse
- #ght ⇒ Object
- #go ⇒ Object
- #logger ⇒ Object
- #persister ⇒ Object
- #prepare_options(options) ⇒ Object
- #retrieve_issue(args) ⇒ Object
- #retrieve_pullreq(args) ⇒ Object
- #validate ⇒ Object
Methods included from GHTorrent::Persister
Methods included from GHTorrent::Retriever
#get_event, #get_events, #get_repo_events, #retrieve_commit, #retrieve_commit_comment, #retrieve_commit_comments, #retrieve_commits, #retrieve_fork, #retrieve_forks, #retrieve_issue_comment, #retrieve_issue_comments, #retrieve_issue_event, #retrieve_issue_events, #retrieve_issue_labels, #retrieve_issues, #retrieve_languages, #retrieve_org, #retrieve_org_members, #retrieve_orgs, #retrieve_pull_req_comment, #retrieve_pull_req_comments, #retrieve_pull_req_commits, #retrieve_pull_request, #retrieve_pull_requests, #retrieve_repo, #retrieve_repo_collaborator, #retrieve_repo_collaborators, #retrieve_repo_label, #retrieve_repo_labels, #retrieve_user_byemail, #retrieve_user_byusername, #retrieve_user_follower, #retrieve_user_followers, #retrieve_user_following, #retrieve_watcher, #retrieve_watchers
Methods included from GHTorrent::Logging
#debug, #error, #info, #loggerr, #warn
Methods included from GHTorrent::Settings
#config, #merge, #merge_config_values, #override_config, #settings
Methods included from GHTorrent::Utils
included, #read_value, #user_type, #write_value
Methods included from GHTorrent::APIClient
#api_request, #num_pages, #paged_api_request
Methods inherited from GHTorrent::Command
#command_name, #override_config, #process_options, #queue_client, run, #version
Instance Method Details
#ght ⇒ Object
41 42 43 44 |
# File 'lib/ghtorrent/commands/ght_retrieve_one.rb', line 41 def ght @ght ||= TransactedGHTorrent.new(settings) @ght end |
#go ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ghtorrent/commands/ght_retrieve_one.rb', line 46 def go ght.get_db case ARGV[0] when /pullreq/ retrieve_pullreq(ARGV[1..-1]) when /issue/ retrieve_issue(ARGV[1..-1]) else Trollop::die "Don't know how to retrieve #{ARGV[0]}" end end |
#logger ⇒ Object
32 33 34 |
# File 'lib/ghtorrent/commands/ght_retrieve_one.rb', line 32 def logger ght.logger end |
#persister ⇒ Object
36 37 38 39 |
# File 'lib/ghtorrent/commands/ght_retrieve_one.rb', line 36 def persister @persister ||= connect(:mongo, settings) @persister end |
#prepare_options(options) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ghtorrent/commands/ght_retrieve_one.rb', line 15 def () . <<-BANNER Retrieve just one item #{command_name} [options] <what> options... what can have the following values and arguments * pullreq <owner> <repo> <github_id> * issue <owner> <repo> <github_id> BANNER end |
#retrieve_issue(args) ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/ghtorrent/commands/ght_retrieve_one.rb', line 67 def retrieve_issue(args) owner = args[0] repo = args[1] issue_id = args[2] ght.ensure_issue(wner, repo, issue_id) end |
#retrieve_pullreq(args) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/ghtorrent/commands/ght_retrieve_one.rb', line 59 def retrieve_pullreq(args) owner = args[0] repo = args[1] pull_req_id = args[2] ght.ensure_pull_request(owner, repo, pull_req_id) end |
#validate ⇒ Object
27 28 29 30 |
# File 'lib/ghtorrent/commands/ght_retrieve_one.rb', line 27 def validate super Trollop::die 'One argument required' unless args[0] && !args[0].empty? end |