Class: PrGet::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/pr_get/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Client

Returns a new instance of Client.



7
8
9
# File 'lib/pr_get/client.rb', line 7

def initialize(**args)
  @github = Github.new user: args[:user], repo: args[:repo], oauth_token: args[:oauth_token]
end

Instance Method Details

#search(**search_key) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/pr_get/client.rb', line 11

def search(**search_key)
  search_key[:sort_key] ||= :number
  items = SearchItem.new(@github, search_key[:sha]).exec.sort_by {|item| item.send(search_key[:sort_key]) }
  items.map do |item|
    ItemResult.new(item)
  end
end