id int32 0 24.9k | repo stringlengths 5 58 | path stringlengths 9 168 | func_name stringlengths 9 130 | original_string stringlengths 66 10.5k | language stringclasses 1
value | code stringlengths 66 10.5k | code_tokens list | docstring stringlengths 8 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 94 266 |
|---|---|---|---|---|---|---|---|---|---|---|---|
12,500 | markdownlint/markdownlint | lib/mdl/doc.rb | MarkdownLint.Doc.extract_text | def extract_text(element, prefix="", restore_whitespace = true)
quotes = {
:rdquo => '"',
:ldquo => '"',
:lsquo => "'",
:rsquo => "'"
}
# If anything goes amiss here, e.g. unknown type, then nil will be
# returned and we'll just not catch that part of the text, wh... | ruby | def extract_text(element, prefix="", restore_whitespace = true)
quotes = {
:rdquo => '"',
:ldquo => '"',
:lsquo => "'",
:rsquo => "'"
}
# If anything goes amiss here, e.g. unknown type, then nil will be
# returned and we'll just not catch that part of the text, wh... | [
"def",
"extract_text",
"(",
"element",
",",
"prefix",
"=",
"\"\"",
",",
"restore_whitespace",
"=",
"true",
")",
"quotes",
"=",
"{",
":rdquo",
"=>",
"'\"'",
",",
":ldquo",
"=>",
"'\"'",
",",
":lsquo",
"=>",
"\"'\"",
",",
":rsquo",
"=>",
"\"'\"",
"}",
"#... | Extracts the text from an element whose children consist of text
elements and other things | [
"Extracts",
"the",
"text",
"from",
"an",
"element",
"whose",
"children",
"consist",
"of",
"text",
"elements",
"and",
"other",
"things"
] | a9e80fcf3989d73b654b00bb2225a00be53983e8 | https://github.com/markdownlint/markdownlint/blob/a9e80fcf3989d73b654b00bb2225a00be53983e8/lib/mdl/doc.rb#L249-L275 |
12,501 | markdownlint/markdownlint | lib/mdl/doc.rb | MarkdownLint.Doc.add_levels | def add_levels(elements, level=1)
elements.each do |e|
e.options[:element_level] = level
add_levels(e.children, level+1)
end
end | ruby | def add_levels(elements, level=1)
elements.each do |e|
e.options[:element_level] = level
add_levels(e.children, level+1)
end
end | [
"def",
"add_levels",
"(",
"elements",
",",
"level",
"=",
"1",
")",
"elements",
".",
"each",
"do",
"|",
"e",
"|",
"e",
".",
"options",
"[",
":element_level",
"]",
"=",
"level",
"add_levels",
"(",
"e",
".",
"children",
",",
"level",
"+",
"1",
")",
"e... | Adds a 'level' option to all elements to show how nested they are | [
"Adds",
"a",
"level",
"option",
"to",
"all",
"elements",
"to",
"show",
"how",
"nested",
"they",
"are"
] | a9e80fcf3989d73b654b00bb2225a00be53983e8 | https://github.com/markdownlint/markdownlint/blob/a9e80fcf3989d73b654b00bb2225a00be53983e8/lib/mdl/doc.rb#L282-L287 |
12,502 | mojombo/chronic | lib/chronic/parser.rb | Chronic.Parser.guess | def guess(span, mode = :middle)
return span if not mode
return span.begin + span.width / 2 if span.width > 1 and (mode == true or mode == :middle)
return span.end if mode == :end
span.begin
end | ruby | def guess(span, mode = :middle)
return span if not mode
return span.begin + span.width / 2 if span.width > 1 and (mode == true or mode == :middle)
return span.end if mode == :end
span.begin
end | [
"def",
"guess",
"(",
"span",
",",
"mode",
"=",
":middle",
")",
"return",
"span",
"if",
"not",
"mode",
"return",
"span",
".",
"begin",
"+",
"span",
".",
"width",
"/",
"2",
"if",
"span",
".",
"width",
">",
"1",
"and",
"(",
"mode",
"==",
"true",
"or... | Guess a specific time within the given span.
span - The Chronic::Span object to calcuate a guess from.
Returns a new Time object. | [
"Guess",
"a",
"specific",
"time",
"within",
"the",
"given",
"span",
"."
] | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/parser.rb#L152-L157 |
12,503 | mojombo/chronic | lib/chronic/dictionary.rb | Chronic.Dictionary.definitions | def definitions
defined_items.each_with_object({}) do |word, defs|
word_type = "#{word.capitalize.to_s + 'Definitions'}"
defs[word] = Chronic.const_get(word_type).new(options).definitions
end
end | ruby | def definitions
defined_items.each_with_object({}) do |word, defs|
word_type = "#{word.capitalize.to_s + 'Definitions'}"
defs[word] = Chronic.const_get(word_type).new(options).definitions
end
end | [
"def",
"definitions",
"defined_items",
".",
"each_with_object",
"(",
"{",
"}",
")",
"do",
"|",
"word",
",",
"defs",
"|",
"word_type",
"=",
"\"#{word.capitalize.to_s + 'Definitions'}\"",
"defs",
"[",
"word",
"]",
"=",
"Chronic",
".",
"const_get",
"(",
"word_type"... | returns a hash of each word's Definitions | [
"returns",
"a",
"hash",
"of",
"each",
"word",
"s",
"Definitions"
] | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/dictionary.rb#L14-L19 |
12,504 | mojombo/chronic | lib/chronic/handlers.rb | Chronic.Handlers.handle_od_rm | def handle_od_rm(tokens, options)
day = tokens[0].get_tag(OrdinalDay).type
month = tokens[2].get_tag(RepeaterMonth)
handle_m_d(month, day, tokens[3..tokens.size], options)
end | ruby | def handle_od_rm(tokens, options)
day = tokens[0].get_tag(OrdinalDay).type
month = tokens[2].get_tag(RepeaterMonth)
handle_m_d(month, day, tokens[3..tokens.size], options)
end | [
"def",
"handle_od_rm",
"(",
"tokens",
",",
"options",
")",
"day",
"=",
"tokens",
"[",
"0",
"]",
".",
"get_tag",
"(",
"OrdinalDay",
")",
".",
"type",
"month",
"=",
"tokens",
"[",
"2",
"]",
".",
"get_tag",
"(",
"RepeaterMonth",
")",
"handle_m_d",
"(",
... | Handle ordinal this month | [
"Handle",
"ordinal",
"this",
"month"
] | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/handlers.rb#L54-L58 |
12,505 | mojombo/chronic | lib/chronic/handlers.rb | Chronic.Handlers.handle_r | def handle_r(tokens, options)
dd_tokens = dealias_and_disambiguate_times(tokens, options)
get_anchor(dd_tokens, options)
end | ruby | def handle_r(tokens, options)
dd_tokens = dealias_and_disambiguate_times(tokens, options)
get_anchor(dd_tokens, options)
end | [
"def",
"handle_r",
"(",
"tokens",
",",
"options",
")",
"dd_tokens",
"=",
"dealias_and_disambiguate_times",
"(",
"tokens",
",",
"options",
")",
"get_anchor",
"(",
"dd_tokens",
",",
"options",
")",
"end"
] | anchors
Handle repeaters | [
"anchors",
"Handle",
"repeaters"
] | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/handlers.rb#L432-L435 |
12,506 | mojombo/chronic | lib/chronic/handlers.rb | Chronic.Handlers.handle_orr | def handle_orr(tokens, outer_span, options)
repeater = tokens[1].get_tag(Repeater)
repeater.start = outer_span.begin - 1
ordinal = tokens[0].get_tag(Ordinal).type
span = nil
ordinal.times do
span = repeater.next(:future)
if span.begin >= outer_span.end
span = ni... | ruby | def handle_orr(tokens, outer_span, options)
repeater = tokens[1].get_tag(Repeater)
repeater.start = outer_span.begin - 1
ordinal = tokens[0].get_tag(Ordinal).type
span = nil
ordinal.times do
span = repeater.next(:future)
if span.begin >= outer_span.end
span = ni... | [
"def",
"handle_orr",
"(",
"tokens",
",",
"outer_span",
",",
"options",
")",
"repeater",
"=",
"tokens",
"[",
"1",
"]",
".",
"get_tag",
"(",
"Repeater",
")",
"repeater",
".",
"start",
"=",
"outer_span",
".",
"begin",
"-",
"1",
"ordinal",
"=",
"tokens",
"... | narrows
Handle oridinal repeaters | [
"narrows",
"Handle",
"oridinal",
"repeaters"
] | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/handlers.rb#L488-L504 |
12,507 | mojombo/chronic | lib/chronic/handlers.rb | Chronic.Handlers.find_within | def find_within(tags, span, pointer)
puts "--#{span}" if Chronic.debug
return span if tags.empty?
head = tags.shift
head.start = (pointer == :future ? span.begin : span.end)
h = head.this(:none)
if span.cover?(h.begin) || span.cover?(h.end)
find_within(tags, h, pointer)
... | ruby | def find_within(tags, span, pointer)
puts "--#{span}" if Chronic.debug
return span if tags.empty?
head = tags.shift
head.start = (pointer == :future ? span.begin : span.end)
h = head.this(:none)
if span.cover?(h.begin) || span.cover?(h.end)
find_within(tags, h, pointer)
... | [
"def",
"find_within",
"(",
"tags",
",",
"span",
",",
"pointer",
")",
"puts",
"\"--#{span}\"",
"if",
"Chronic",
".",
"debug",
"return",
"span",
"if",
"tags",
".",
"empty?",
"head",
"=",
"tags",
".",
"shift",
"head",
".",
"start",
"=",
"(",
"pointer",
"=... | Recursively finds repeaters within other repeaters.
Returns a Span representing the innermost time span
or nil if no repeater union could be found | [
"Recursively",
"finds",
"repeaters",
"within",
"other",
"repeaters",
".",
"Returns",
"a",
"Span",
"representing",
"the",
"innermost",
"time",
"span",
"or",
"nil",
"if",
"no",
"repeater",
"union",
"could",
"be",
"found"
] | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/handlers.rb#L584-L595 |
12,508 | mojombo/chronic | lib/chronic/handler.rb | Chronic.Handler.match | def match(tokens, definitions)
token_index = 0
@pattern.each do |elements|
was_optional = false
elements = [elements] unless elements.is_a?(Array)
elements.each_index do |i|
name = elements[i].to_s
optional = name[-1, 1] == '?'
name = name.chop if optio... | ruby | def match(tokens, definitions)
token_index = 0
@pattern.each do |elements|
was_optional = false
elements = [elements] unless elements.is_a?(Array)
elements.each_index do |i|
name = elements[i].to_s
optional = name[-1, 1] == '?'
name = name.chop if optio... | [
"def",
"match",
"(",
"tokens",
",",
"definitions",
")",
"token_index",
"=",
"0",
"@pattern",
".",
"each",
"do",
"|",
"elements",
"|",
"was_optional",
"=",
"false",
"elements",
"=",
"[",
"elements",
"]",
"unless",
"elements",
".",
"is_a?",
"(",
"Array",
"... | pattern - An Array of patterns to match tokens against.
handler_method - A Symbol representing the method to be invoked
when a pattern matches.
tokens - An Array of tokens to process.
definitions - A Hash of definitions to check against.
Returns true if a match is found. | [
"pattern",
"-",
"An",
"Array",
"of",
"patterns",
"to",
"match",
"tokens",
"against",
".",
"handler_method",
"-",
"A",
"Symbol",
"representing",
"the",
"method",
"to",
"be",
"invoked",
"when",
"a",
"pattern",
"matches",
".",
"tokens",
"-",
"An",
"Array",
"o... | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/handler.rb#L20-L68 |
12,509 | piotrmurach/github | lib/github_api/client/repos.rb | Github.Client::Repos.create | def create(*args)
arguments(args) do
assert_required %w[ name ]
end
params = arguments.params
# Requires authenticated user
if (org = params.delete('org') || org)
post_request("/orgs/#{org}/repos", params)
else
post_request("/user/repos", params)
end
... | ruby | def create(*args)
arguments(args) do
assert_required %w[ name ]
end
params = arguments.params
# Requires authenticated user
if (org = params.delete('org') || org)
post_request("/orgs/#{org}/repos", params)
else
post_request("/user/repos", params)
end
... | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
")",
"do",
"assert_required",
"%w[",
"name",
"]",
"end",
"params",
"=",
"arguments",
".",
"params",
"# Requires authenticated user",
"if",
"(",
"org",
"=",
"params",
".",
"delete",
"(",
"'or... | Create a new repository for the authenticated user.
@param [Hash] params
@option params [String] :name
Required string
@option params [String] :description
Optional string
@option params [String] :homepage
Optional string
@option params [Boolean] :private
Optional boolean - true to create a private r... | [
"Create",
"a",
"new",
"repository",
"for",
"the",
"authenticated",
"user",
"."
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos.rb#L240-L252 |
12,510 | piotrmurach/github | lib/github_api/client/users.rb | Github.Client::Users.get | def get(*args)
params = arguments(args).params
if user_name = params.delete('user')
get_request("/users/#{user_name}", params)
else
get_request("/user", params)
end
end | ruby | def get(*args)
params = arguments(args).params
if user_name = params.delete('user')
get_request("/users/#{user_name}", params)
else
get_request("/user", params)
end
end | [
"def",
"get",
"(",
"*",
"args",
")",
"params",
"=",
"arguments",
"(",
"args",
")",
".",
"params",
"if",
"user_name",
"=",
"params",
".",
"delete",
"(",
"'user'",
")",
"get_request",
"(",
"\"/users/#{user_name}\"",
",",
"params",
")",
"else",
"get_request",... | Get a single unauthenticated user
@example
github = Github.new
github.users.get user: 'user-name'
Get the authenticated user
@example
github = Github.new oauth_token: '...'
github.users.get
@api public | [
"Get",
"a",
"single",
"unauthenticated",
"user"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/users.rb#L68-L76 |
12,511 | piotrmurach/github | lib/github_api/client/pull_requests/reviews.rb | Github.Client::PullRequests::Reviews.create | def create(*args)
arguments(args, required: [:user, :repo, :number])
params = arguments.params
params["accept"] ||= PREVIEW_MEDIA
post_request("/repos/#{arguments.user}/#{arguments.repo}/pulls/#{arguments.number}/reviews", params)
end | ruby | def create(*args)
arguments(args, required: [:user, :repo, :number])
params = arguments.params
params["accept"] ||= PREVIEW_MEDIA
post_request("/repos/#{arguments.user}/#{arguments.repo}/pulls/#{arguments.number}/reviews", params)
end | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":number",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"\"accept\"",
"]",
"||=",
"PREVIEW_MEDIA",
"post_reque... | Create a pull request review
@param [Hash] params
@option params [String] :event
Required string - The review action (event) to perform; can be one of
APPROVE, REQUEST_CHANGES, or COMMENT. If left blank, the API returns
HTTP 422 (Unrecognizable entity) and the review is left PENDING
@option params [String]... | [
"Create",
"a",
"pull",
"request",
"review"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/pull_requests/reviews.rb#L86-L93 |
12,512 | piotrmurach/github | lib/github_api/client/pull_requests/reviews.rb | Github.Client::PullRequests::Reviews.update | def update(*args)
arguments(args, required: [:user, :repo, :number, :id])
params = arguments.params
params["accept"] ||= PREVIEW_MEDIA
post_request("/repos/#{arguments.user}/#{arguments.repo}/pulls/#{arguments.number}/reviews/#{arguments.id}/events", params)
end | ruby | def update(*args)
arguments(args, required: [:user, :repo, :number, :id])
params = arguments.params
params["accept"] ||= PREVIEW_MEDIA
post_request("/repos/#{arguments.user}/#{arguments.repo}/pulls/#{arguments.number}/reviews/#{arguments.id}/events", params)
end | [
"def",
"update",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":number",
",",
":id",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"\"accept\"",
"]",
"||=",
"PREVIEW_MEDIA... | Update a pull request review
@param [Hash] params
@option params [String] :state
Required string - The review action (event) to perform; can be one of
APPROVE, REQUEST_CHANGES, or COMMENT. If left blank, the API returns
HTTP 422 (Unrecognizable entity) and the review is left PENDING
@optoin params [String]... | [
"Update",
"a",
"pull",
"request",
"review"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/pull_requests/reviews.rb#L112-L119 |
12,513 | piotrmurach/github | lib/github_api/client/activity/feeds.rb | Github.Client::Activity::Feeds.get | def get(*args)
arguments(args, required: [:name])
name = arguments.name
response = list.body._links[name]
if response
params = arguments.params
params['accept'] = response.type
get_request(response.href, params)
end
end | ruby | def get(*args)
arguments(args, required: [:name])
name = arguments.name
response = list.body._links[name]
if response
params = arguments.params
params['accept'] = response.type
get_request(response.href, params)
end
end | [
"def",
"get",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":name",
"]",
")",
"name",
"=",
"arguments",
".",
"name",
"response",
"=",
"list",
".",
"body",
".",
"_links",
"[",
"name",
"]",
"if",
"response",
"params",
"... | Get all the items for a named timeline
@see https://developer.github.com/v3/activity/feeds/#list-feeds
@example
github = Github.new
github.activity.feeds.get "timeline"
@param [String] name
the name of the timeline resource
@api public | [
"Get",
"all",
"the",
"items",
"for",
"a",
"named",
"timeline"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/activity/feeds.rb#L37-L47 |
12,514 | piotrmurach/github | lib/github_api/client/projects/cards.rb | Github.Client::Projects::Cards.list | def list(*args)
arguments(args, required: [:column_id])
params = arguments.params
params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
response = get_request("/projects/columns/#{arguments.column_id}/cards", params)
return response unless block_given?
response.each { |el... | ruby | def list(*args)
arguments(args, required: [:column_id])
params = arguments.params
params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
response = get_request("/projects/columns/#{arguments.column_id}/cards", params)
return response unless block_given?
response.each { |el... | [
"def",
"list",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":column_id",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"\"accept\"",
"]",
"||=",
"::",
"Github",
"::",
"Client",
"::",
"Projects",
"::... | List project cards for a column
@example
github = Github.new
github.projects.cards.list :column_id
@see https://developer.github.com/v3/projects/cards/#list-project-cards
@api public | [
"List",
"project",
"cards",
"for",
"a",
"column"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/projects/cards.rb#L19-L29 |
12,515 | piotrmurach/github | lib/github_api/client/projects/cards.rb | Github.Client::Projects::Cards.create | def create(*args)
arguments(args, required: [:column_id])
params = arguments.params
params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
post_request("/projects/columns/#{arguments.column_id}/cards", params)
end | ruby | def create(*args)
arguments(args, required: [:column_id])
params = arguments.params
params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
post_request("/projects/columns/#{arguments.column_id}/cards", params)
end | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":column_id",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"\"accept\"",
"]",
"||=",
"::",
"Github",
"::",
"Client",
"::",
"Projects",
"... | Create a project card for a column
@param [Hash] params
@option params [String] :note
The card's note content. Only valid for cards without another type of
content, so this must be omitted if content_id and content_type are
specified.
@option params [Integer] :content_id
The id of the Issue to associate wit... | [
"Create",
"a",
"project",
"card",
"for",
"a",
"column"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/projects/cards.rb#L75-L82 |
12,516 | piotrmurach/github | lib/github_api/client/projects/cards.rb | Github.Client::Projects::Cards.update | def update(*args)
arguments(args, required: [:card_id])
params = arguments.params
params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
patch_request("/projects/columns/cards/#{arguments.card_id}", params)
end | ruby | def update(*args)
arguments(args, required: [:card_id])
params = arguments.params
params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
patch_request("/projects/columns/cards/#{arguments.card_id}", params)
end | [
"def",
"update",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":card_id",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"\"accept\"",
"]",
"||=",
"::",
"Github",
"::",
"Client",
"::",
"Projects",
"::... | Update a project card
@param [Hash] params
@option params [String] :note
The card's note content. Only valid for cards without another type of
content, so this cannot be specified if the card already has a
content_id and content_type.
@example
github = Github.new
github.projects.cards.update :card_i... | [
"Update",
"a",
"project",
"card"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/projects/cards.rb#L99-L106 |
12,517 | piotrmurach/github | lib/github_api/client/projects/cards.rb | Github.Client::Projects::Cards.delete | def delete(*args)
arguments(args, required: [:card_id])
params = arguments.params
params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
delete_request("/projects/columns/cards/#{arguments.card_id}", params)
end | ruby | def delete(*args)
arguments(args, required: [:card_id])
params = arguments.params
params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
delete_request("/projects/columns/cards/#{arguments.card_id}", params)
end | [
"def",
"delete",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":card_id",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"\"accept\"",
"]",
"||=",
"::",
"Github",
"::",
"Client",
"::",
"Projects",
"::... | Delete a project card
@example
github = Github.new
github.projects.cards.delete :card_id
@see https://developer.github.com/v3/projects/cards/#delete-a-project-card
@api public | [
"Delete",
"a",
"project",
"card"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/projects/cards.rb#L118-L125 |
12,518 | piotrmurach/github | lib/github_api/client/projects/cards.rb | Github.Client::Projects::Cards.move | def move(*args)
arguments(args, required: [:card_id]) do
assert_required REQUIRED_MOVE_CARD_PARAMS
end
params = arguments.params
params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
post_request("/projects/columns/cards/#{arguments.card_id}/moves", params)
end | ruby | def move(*args)
arguments(args, required: [:card_id]) do
assert_required REQUIRED_MOVE_CARD_PARAMS
end
params = arguments.params
params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
post_request("/projects/columns/cards/#{arguments.card_id}/moves", params)
end | [
"def",
"move",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":card_id",
"]",
")",
"do",
"assert_required",
"REQUIRED_MOVE_CARD_PARAMS",
"end",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"\"accept\"",
"]",
"||=",
... | Move a project card
@param [Hash] params
@option params [String] :position
Required. Required. Can be one of 'first', 'last', or
'after:<column-id>', where <column-id> is the id value of a column in
the same project.
@example
github = Github.new
github.projects.cards.move :card_id, position: 'bottom'
... | [
"Move",
"a",
"project",
"card"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/projects/cards.rb#L147-L156 |
12,519 | piotrmurach/github | lib/github_api/client/issues.rb | Github.Client::Issues.list | def list(*args)
params = arguments(args) do
assert_values VALID_ISSUE_PARAM_VALUES
end.params
response = if (org = params.delete('org'))
get_request("/orgs/#{org}/issues", params)
elsif (user_name = params.delete('user')) &&
(repo_name = params.delete('repo'))
... | ruby | def list(*args)
params = arguments(args) do
assert_values VALID_ISSUE_PARAM_VALUES
end.params
response = if (org = params.delete('org'))
get_request("/orgs/#{org}/issues", params)
elsif (user_name = params.delete('user')) &&
(repo_name = params.delete('repo'))
... | [
"def",
"list",
"(",
"*",
"args",
")",
"params",
"=",
"arguments",
"(",
"args",
")",
"do",
"assert_values",
"VALID_ISSUE_PARAM_VALUES",
"end",
".",
"params",
"response",
"=",
"if",
"(",
"org",
"=",
"params",
".",
"delete",
"(",
"'org'",
")",
")",
"get_req... | List your issues
List all issues across all the authenticated user’s visible repositories
including owned repositories, member repositories,
and organization repositories.
@example
github = Github.new oauth_token: '...'
github.issues.list
List all issues across owned and member repositories for the
authent... | [
"List",
"your",
"issues"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/issues.rb#L125-L144 |
12,520 | piotrmurach/github | lib/github_api/client/repos/releases/assets.rb | Github.Client::Repos::Releases::Assets.upload | def upload(*args)
arguments(args, required: [:owner, :repo, :id, :filepath]) do
permit VALID_ASSET_PARAM_NAMES
end
params = arguments.params
unless type = params['content_type']
type = infer_media(arguments.filepath)
end
file = Faraday::UploadIO.new(arguments.filepa... | ruby | def upload(*args)
arguments(args, required: [:owner, :repo, :id, :filepath]) do
permit VALID_ASSET_PARAM_NAMES
end
params = arguments.params
unless type = params['content_type']
type = infer_media(arguments.filepath)
end
file = Faraday::UploadIO.new(arguments.filepa... | [
"def",
"upload",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":owner",
",",
":repo",
",",
":id",
",",
":filepath",
"]",
")",
"do",
"permit",
"VALID_ASSET_PARAM_NAMES",
"end",
"params",
"=",
"arguments",
".",
"params",
"unl... | Upload a release asset
@param [Hash] params
@input params [String] :name
Required string. The file name of the asset
@input params [String] :content_type
Required string. The content type of the asset.
Example: “application/zip”.
@example
github = Github.new
github.repos.releases.assets.upload 'own... | [
"Upload",
"a",
"release",
"asset"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos/releases/assets.rb#L62-L84 |
12,521 | piotrmurach/github | lib/github_api/client/repos/releases/assets.rb | Github.Client::Repos::Releases::Assets.infer_media | def infer_media(filepath)
require 'mime/types'
types = MIME::Types.type_for(filepath)
types.empty? ? 'application/octet-stream' : types.first
rescue LoadError
raise Github::Error::UnknownMedia.new(filepath)
end | ruby | def infer_media(filepath)
require 'mime/types'
types = MIME::Types.type_for(filepath)
types.empty? ? 'application/octet-stream' : types.first
rescue LoadError
raise Github::Error::UnknownMedia.new(filepath)
end | [
"def",
"infer_media",
"(",
"filepath",
")",
"require",
"'mime/types'",
"types",
"=",
"MIME",
"::",
"Types",
".",
"type_for",
"(",
"filepath",
")",
"types",
".",
"empty?",
"?",
"'application/octet-stream'",
":",
"types",
".",
"first",
"rescue",
"LoadError",
"ra... | Infer media type of the asset | [
"Infer",
"media",
"type",
"of",
"the",
"asset"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos/releases/assets.rb#L88-L94 |
12,522 | piotrmurach/github | lib/github_api/client/repos/releases/assets.rb | Github.Client::Repos::Releases::Assets.edit | def edit(*args)
arguments(args, required: [:owner, :repo, :id]) do
permit VALID_ASSET_PARAM_NAMES
end
patch_request("/repos/#{arguments.owner}/#{arguments.repo}/releases/assets/#{arguments.id}", arguments.params)
end | ruby | def edit(*args)
arguments(args, required: [:owner, :repo, :id]) do
permit VALID_ASSET_PARAM_NAMES
end
patch_request("/repos/#{arguments.owner}/#{arguments.repo}/releases/assets/#{arguments.id}", arguments.params)
end | [
"def",
"edit",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":owner",
",",
":repo",
",",
":id",
"]",
")",
"do",
"permit",
"VALID_ASSET_PARAM_NAMES",
"end",
"patch_request",
"(",
"\"/repos/#{arguments.owner}/#{arguments.repo}/releases... | Edit a release asset
Users with push access to the repository can edit a release asset.
@param [Hash] params
@input params [String] :name
Required. The file name of the asset.
@input params [String] :label
An alternate short description of the asset.
Used in place of the filename.
@example
github = ... | [
"Edit",
"a",
"release",
"asset"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos/releases/assets.rb#L114-L120 |
12,523 | piotrmurach/github | lib/github_api/client/markdown.rb | Github.Client::Markdown.render | def render(*args)
arguments(args) do
assert_required ['text']
end
params = arguments.params
params['raw'] = true
post_request("markdown", arguments.params)
end | ruby | def render(*args)
arguments(args) do
assert_required ['text']
end
params = arguments.params
params['raw'] = true
post_request("markdown", arguments.params)
end | [
"def",
"render",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
")",
"do",
"assert_required",
"[",
"'text'",
"]",
"end",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"'raw'",
"]",
"=",
"true",
"post_request",
"(",
"\"markdown\"",
",",
"arg... | Render an arbitrary Markdown document
= Parameters
<tt>:text</tt> - Required string - The Markdown text to render
<tt>:mode<tt> - Optional string - The rendering mode
* <tt>markdown</tt> to render a document as plain Markdown, just
like README files are rendered.
* <tt>gfm</tt> to ... | [
"Render",
"an",
"arbitrary",
"Markdown",
"document"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/markdown.rb#L29-L37 |
12,524 | piotrmurach/github | lib/github_api/client/markdown.rb | Github.Client::Markdown.render_raw | def render_raw(*args)
params = arguments(args).params
params['data'] = args.shift
params['raw'] = true
params['accept'] = params.fetch('accept') { 'text/plain' }
post_request("markdown/raw", params)
end | ruby | def render_raw(*args)
params = arguments(args).params
params['data'] = args.shift
params['raw'] = true
params['accept'] = params.fetch('accept') { 'text/plain' }
post_request("markdown/raw", params)
end | [
"def",
"render_raw",
"(",
"*",
"args",
")",
"params",
"=",
"arguments",
"(",
"args",
")",
".",
"params",
"params",
"[",
"'data'",
"]",
"=",
"args",
".",
"shift",
"params",
"[",
"'raw'",
"]",
"=",
"true",
"params",
"[",
"'accept'",
"]",
"=",
"params",... | Render a Markdown document in raw mode
= Input
The raw API it not JSON-based. It takes a Markdown document as plaintext
<tt>text/plain</tt> or <tt>text/x-markdown</tt> and renders it as plain
Markdown without a repository context (just like a README.md file is
rendered – this is the simplest way to preview a ... | [
"Render",
"a",
"Markdown",
"document",
"in",
"raw",
"mode"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/markdown.rb#L52-L59 |
12,525 | piotrmurach/github | lib/github_api/client/repos/statuses.rb | Github.Client::Repos::Statuses.create | def create(*args)
arguments(args, required: [:user, :repo, :sha]) do
permit VALID_STATUS_PARAM_NAMES, recursive: false
assert_required REQUIRED_PARAMS
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/statuses/#{arguments.sha}", arguments.params)
end | ruby | def create(*args)
arguments(args, required: [:user, :repo, :sha]) do
permit VALID_STATUS_PARAM_NAMES, recursive: false
assert_required REQUIRED_PARAMS
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/statuses/#{arguments.sha}", arguments.params)
end | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":sha",
"]",
")",
"do",
"permit",
"VALID_STATUS_PARAM_NAMES",
",",
"recursive",
":",
"false",
"assert_required",
"REQUIRED_PARAMS",
"end"... | Create a status
@param [Hash] params
@input params [String] :state
Required. The state of the status. Can be one of pending,
success, error, or failure.
@input params [String] :target_url
The target URL to associate with this status. This URL will
be linked from the GitHub UI to allow users to easily se... | [
"Create",
"a",
"status"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos/statuses.rb#L82-L89 |
12,526 | piotrmurach/github | lib/github_api/client/activity/starring.rb | Github.Client::Activity::Starring.starring? | def starring?(*args)
arguments(args, required: [:user, :repo])
get_request("/user/starred/#{arguments.user}/#{arguments.repo}", arguments.params)
true
rescue Github::Error::NotFound
false
end | ruby | def starring?(*args)
arguments(args, required: [:user, :repo])
get_request("/user/starred/#{arguments.user}/#{arguments.repo}", arguments.params)
true
rescue Github::Error::NotFound
false
end | [
"def",
"starring?",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
"]",
")",
"get_request",
"(",
"\"/user/starred/#{arguments.user}/#{arguments.repo}\"",
",",
"arguments",
".",
"params",
")",
"true",
"rescue",
... | Check if you are starring a repository
@see https://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository
@example
github = Github.new
github.activity.starring.starring? 'user-name', 'repo-name'
@example
github.activity.starring.starring? user: 'user-name', repo: 'repo-name'
... | [
"Check",
"if",
"you",
"are",
"starring",
"a",
"repository"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/activity/starring.rb#L81-L88 |
12,527 | piotrmurach/github | lib/github_api/client/gitignore.rb | Github.Client::Gitignore.list | def list(*args)
arguments(args)
response = get_request("/gitignore/templates", arguments.params)
return response unless block_given?
response.each { |el| yield el }
end | ruby | def list(*args)
arguments(args)
response = get_request("/gitignore/templates", arguments.params)
return response unless block_given?
response.each { |el| yield el }
end | [
"def",
"list",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
")",
"response",
"=",
"get_request",
"(",
"\"/gitignore/templates\"",
",",
"arguments",
".",
"params",
")",
"return",
"response",
"unless",
"block_given?",
"response",
".",
"each",
"{",
"|",
"el... | List all templates available to pass as an option
when creating a repository.
@see https://developer.github.com/v3/gitignore/#listing-available-templates
@example
github = Github.new
github.gitignore.list
github.gitignore.list { |template| ... }
@api public | [
"List",
"all",
"templates",
"available",
"to",
"pass",
"as",
"an",
"option",
"when",
"creating",
"a",
"repository",
"."
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/gitignore.rb#L20-L26 |
12,528 | piotrmurach/github | lib/github_api/client/gitignore.rb | Github.Client::Gitignore.get | def get(*args)
arguments(args, required: [:name])
params = arguments.params
if (media = params.delete('accept'))
params['accept'] = media
params['raw'] = true
end
get_request("/gitignore/templates/#{arguments.name}", params)
end | ruby | def get(*args)
arguments(args, required: [:name])
params = arguments.params
if (media = params.delete('accept'))
params['accept'] = media
params['raw'] = true
end
get_request("/gitignore/templates/#{arguments.name}", params)
end | [
"def",
"get",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":name",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"if",
"(",
"media",
"=",
"params",
".",
"delete",
"(",
"'accept'",
")",
")",
"params",
"[",
"'ac... | Get a single template
@see https://developer.github.com/v3/gitignore/#get-a-single-template
@example
github = Github.new
github.gitignore.get "template-name"
Use the raw media type to get the raw contents.
@examples
github = Github.new
github.gitignore.get "template-name", accept: 'applicatin/vnd.github... | [
"Get",
"a",
"single",
"template"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/gitignore.rb#L44-L54 |
12,529 | piotrmurach/github | lib/github_api/client/issues/labels.rb | Github.Client::Issues::Labels.get | def get(*args)
arguments(args, required: [:user, :repo, :label_name])
params = arguments.params
get_request("/repos/#{arguments.user}/#{arguments.repo}/labels/#{arguments.label_name}", params)
end | ruby | def get(*args)
arguments(args, required: [:user, :repo, :label_name])
params = arguments.params
get_request("/repos/#{arguments.user}/#{arguments.repo}/labels/#{arguments.label_name}", params)
end | [
"def",
"get",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":label_name",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"get_request",
"(",
"\"/repos/#{arguments.user}/#{arguments.repo}/labels/#{a... | Get a single label
@example
github = Github.new
github.issues.labels.find 'user-name', 'repo-name', 'label-name'
@example
github = Github.new user: 'user-name', repo: 'repo-name'
github.issues.labels.get label_name: 'bug'
@api public | [
"Get",
"a",
"single",
"label"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/issues/labels.rb#L59-L64 |
12,530 | piotrmurach/github | lib/github_api/client/issues/labels.rb | Github.Client::Issues::Labels.create | def create(*args)
arguments(args, required: [:user, :repo]) do
permit VALID_LABEL_INPUTS
assert_required VALID_LABEL_INPUTS
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/labels", arguments.params)
end | ruby | def create(*args)
arguments(args, required: [:user, :repo]) do
permit VALID_LABEL_INPUTS
assert_required VALID_LABEL_INPUTS
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/labels", arguments.params)
end | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
"]",
")",
"do",
"permit",
"VALID_LABEL_INPUTS",
"assert_required",
"VALID_LABEL_INPUTS",
"end",
"post_request",
"(",
"\"/repos/#{arguments.user}/#{a... | Create a label
@param [Hash] params
@option params [String] :name
Required string
@option params [String] :color
Required string - 6 character hex code, without leading
@example
github = Github.new user: 'user-name', repo: 'repo-name'
github.issues.labels.create name: 'API', color: 'FFFFFF'
@api pu... | [
"Create",
"a",
"label"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/issues/labels.rb#L80-L87 |
12,531 | piotrmurach/github | lib/github_api/client/issues/labels.rb | Github.Client::Issues::Labels.update | def update(*args)
arguments(args, required: [:user, :repo, :label_name]) do
permit VALID_LABEL_INPUTS
assert_required VALID_LABEL_INPUTS
end
patch_request("/repos/#{arguments.user}/#{arguments.repo}/labels/#{arguments.label_name}", arguments.params)
end | ruby | def update(*args)
arguments(args, required: [:user, :repo, :label_name]) do
permit VALID_LABEL_INPUTS
assert_required VALID_LABEL_INPUTS
end
patch_request("/repos/#{arguments.user}/#{arguments.repo}/labels/#{arguments.label_name}", arguments.params)
end | [
"def",
"update",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":label_name",
"]",
")",
"do",
"permit",
"VALID_LABEL_INPUTS",
"assert_required",
"VALID_LABEL_INPUTS",
"end",
"patch_request",
"(",
"\"/re... | Update a label
@param [Hash] params
@option params [String] :name
Required string
@option params [String] :color
Required string - 6 character hex code, without leading
@example
github = Github.new
github.issues.labels.update 'user-name', 'repo-name', 'label-name',
name: 'API', color: "FFFFFF"
... | [
"Update",
"a",
"label"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/issues/labels.rb#L103-L110 |
12,532 | piotrmurach/github | lib/github_api/client/issues/labels.rb | Github.Client::Issues::Labels.remove | def remove(*args)
arguments(args, required: [:user, :repo, :number])
params = arguments.params
user = arguments.user
repo = arguments.repo
number = arguments.number
if (label_name = params.delete('label_name'))
delete_request("/repos/#{user}/#{repo}/issues/#{number}/labe... | ruby | def remove(*args)
arguments(args, required: [:user, :repo, :number])
params = arguments.params
user = arguments.user
repo = arguments.repo
number = arguments.number
if (label_name = params.delete('label_name'))
delete_request("/repos/#{user}/#{repo}/issues/#{number}/labe... | [
"def",
"remove",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":number",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"user",
"=",
"arguments",
".",
"user",
"repo",
"=",
"arguments",
... | Remove a label from an issue
@example
github = Github.new
github.issues.labels.remove 'user-name', 'repo-name', 'issue-number',
label_name: 'label-name'
Remove all labels from an issue
@example
github = Github.new
github.issues.labels.remove 'user-name', 'repo-name', 'issue-number'
@api public | [
"Remove",
"a",
"label",
"from",
"an",
"issue"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/issues/labels.rb#L157-L169 |
12,533 | piotrmurach/github | lib/github_api/client/issues/labels.rb | Github.Client::Issues::Labels.replace | def replace(*args)
arguments(args, required: [:user, :repo, :number])
params = arguments.params
params['data'] = arguments.remaining unless arguments.remaining.empty?
put_request("/repos/#{arguments.user}/#{arguments.repo}/issues/#{arguments.number}/labels", params)
end | ruby | def replace(*args)
arguments(args, required: [:user, :repo, :number])
params = arguments.params
params['data'] = arguments.remaining unless arguments.remaining.empty?
put_request("/repos/#{arguments.user}/#{arguments.repo}/issues/#{arguments.number}/labels", params)
end | [
"def",
"replace",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":number",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"'data'",
"]",
"=",
"arguments",
".",
"remaining",
... | Replace all labels for an issue
Sending an empty array ([]) will remove all Labels from the Issue.
@example
github = Github.new
github.issues.labels.replace 'user-name', 'repo-name', 'issue-number',
'label1', 'label2', ...
@api public | [
"Replace",
"all",
"labels",
"for",
"an",
"issue"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/issues/labels.rb#L181-L187 |
12,534 | piotrmurach/github | lib/github_api/page_iterator.rb | Github.PageIterator.parse_page_params | def parse_page_params(uri, attr) # :nodoc:
return -1 if uri.nil? || uri.empty?
parsed = nil
begin
parsed = URI.parse(uri)
rescue URI::Error
return -1
end
param = parse_query_for_param(parsed.query, attr)
return -1 if param.nil? || param.empty?
begin
... | ruby | def parse_page_params(uri, attr) # :nodoc:
return -1 if uri.nil? || uri.empty?
parsed = nil
begin
parsed = URI.parse(uri)
rescue URI::Error
return -1
end
param = parse_query_for_param(parsed.query, attr)
return -1 if param.nil? || param.empty?
begin
... | [
"def",
"parse_page_params",
"(",
"uri",
",",
"attr",
")",
"# :nodoc:",
"return",
"-",
"1",
"if",
"uri",
".",
"nil?",
"||",
"uri",
".",
"empty?",
"parsed",
"=",
"nil",
"begin",
"parsed",
"=",
"URI",
".",
"parse",
"(",
"uri",
")",
"rescue",
"URI",
"::"... | Extracts query string parameter for given name | [
"Extracts",
"query",
"string",
"parameter",
"for",
"given",
"name"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/page_iterator.rb#L113-L128 |
12,535 | piotrmurach/github | lib/github_api/client/scopes.rb | Github.Client::Scopes.list | def list(*args)
arguments(args)
params = arguments.params
token = args.shift
if token.is_a?(Hash) && !params['token'].nil?
token = params.delete('token')
elsif token.nil?
token = oauth_token
end
if token.nil?
raise ArgumentError, 'Access token required... | ruby | def list(*args)
arguments(args)
params = arguments.params
token = args.shift
if token.is_a?(Hash) && !params['token'].nil?
token = params.delete('token')
elsif token.nil?
token = oauth_token
end
if token.nil?
raise ArgumentError, 'Access token required... | [
"def",
"list",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
")",
"params",
"=",
"arguments",
".",
"params",
"token",
"=",
"args",
".",
"shift",
"if",
"token",
".",
"is_a?",
"(",
"Hash",
")",
"&&",
"!",
"params",
"[",
"'token'",
"]",
".",
"nil?"... | Check what OAuth scopes you have.
@see https://developer.github.com/v3/oauth/#scopes
@example
github = Github.new oauth_token: 'e72e16c7e42f292c6912e7710c838347ae17'
github.scopes.all
@example
github = Github.new
github.scopes.list 'e72e16c7e42f292c6912e7710c838347ae17'
@example
github = Github.n... | [
"Check",
"what",
"OAuth",
"scopes",
"you",
"have",
"."
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/scopes.rb#L24-L43 |
12,536 | piotrmurach/github | lib/github_api/client/activity/events.rb | Github.Client::Activity::Events.received | def received(*args)
arguments(args, required: [:user])
params = arguments.params
public_events = if params['public']
params.delete('public')
'/public'
end
response = get_request("/users/#{arguments.user}/received_events#{public_events}", params)
return response unle... | ruby | def received(*args)
arguments(args, required: [:user])
params = arguments.params
public_events = if params['public']
params.delete('public')
'/public'
end
response = get_request("/users/#{arguments.user}/received_events#{public_events}", params)
return response unle... | [
"def",
"received",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"public_events",
"=",
"if",
"params",
"[",
"'public'",
"]",
"params",
".",
"delete",
"(",
"'pub... | List all events that a user has received
@see https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
These are events that you’ve received by watching repos
and following users. If you are authenticated as the given user,
you will see private events. Otherwise, you’ll only see publi... | [
"List",
"all",
"events",
"that",
"a",
"user",
"has",
"received"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/activity/events.rb#L150-L162 |
12,537 | piotrmurach/github | lib/github_api/pagination.rb | Github.Pagination.auto_paginate | def auto_paginate(auto=false)
if (current_api.auto_pagination? || auto) && self.body.is_a?(Array)
resources_bodies = []
each_page { |resource| resources_bodies += resource.body }
self.body = resources_bodies
end
self
end | ruby | def auto_paginate(auto=false)
if (current_api.auto_pagination? || auto) && self.body.is_a?(Array)
resources_bodies = []
each_page { |resource| resources_bodies += resource.body }
self.body = resources_bodies
end
self
end | [
"def",
"auto_paginate",
"(",
"auto",
"=",
"false",
")",
"if",
"(",
"current_api",
".",
"auto_pagination?",
"||",
"auto",
")",
"&&",
"self",
".",
"body",
".",
"is_a?",
"(",
"Array",
")",
"resources_bodies",
"=",
"[",
"]",
"each_page",
"{",
"|",
"resource"... | Iterate over results set pages by automatically calling `next_page`
until all pages are exhausted. Caution needs to be exercised when
using this feature - 100 pages iteration will perform 100 API calls.
By default this is off. You can set it on the client, individual API
instances or just per given request. | [
"Iterate",
"over",
"results",
"set",
"pages",
"by",
"automatically",
"calling",
"next_page",
"until",
"all",
"pages",
"are",
"exhausted",
".",
"Caution",
"needs",
"to",
"be",
"exercised",
"when",
"using",
"this",
"feature",
"-",
"100",
"pages",
"iteration",
"w... | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/pagination.rb#L28-L35 |
12,538 | piotrmurach/github | lib/github_api/client/projects/columns.rb | Github.Client::Projects::Columns.get | def get(*args)
arguments(args, required: [:column_id])
params = arguments.params
params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
get_request("/projects/columns/#{arguments.column_id}", params)
end | ruby | def get(*args)
arguments(args, required: [:column_id])
params = arguments.params
params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
get_request("/projects/columns/#{arguments.column_id}", params)
end | [
"def",
"get",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":column_id",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"\"accept\"",
"]",
"||=",
"::",
"Github",
"::",
"Client",
"::",
"Projects",
"::"... | Get a project columns
@example
github = Github.new
github.projects.columns.get :column_id
@see https://developer.github.com/v3/projects/columns/#get-a-project-column
@api public | [
"Get",
"a",
"project",
"columns"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/projects/columns.rb#L42-L49 |
12,539 | piotrmurach/github | lib/github_api/client/git_data/trees.rb | Github.Client::GitData::Trees.get | def get(*args)
arguments(args, required: [:user, :repo, :sha])
user = arguments.user
repo = arguments.repo
sha = arguments.sha
params = arguments.params
response = if params['recursive']
params['recursive'] = 1
get_request("/repos/#{user}/#{repo}/git/trees/#{s... | ruby | def get(*args)
arguments(args, required: [:user, :repo, :sha])
user = arguments.user
repo = arguments.repo
sha = arguments.sha
params = arguments.params
response = if params['recursive']
params['recursive'] = 1
get_request("/repos/#{user}/#{repo}/git/trees/#{s... | [
"def",
"get",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":sha",
"]",
")",
"user",
"=",
"arguments",
".",
"user",
"repo",
"=",
"arguments",
".",
"repo",
"sha",
"=",
"arguments",
".",
"sha... | Get a tree
@example
github = Github.new
github.git_data.trees.get 'user-name', 'repo-name', 'sha'
github.git_data.trees.get 'user-name', 'repo-name', 'sha' do |file|
file.path
end
Get a tree recursively
@example
github = Github.new
github.git_data.trees.get 'user-name', 'repo-name', 'sha', recursi... | [
"Get",
"a",
"tree"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/git_data/trees.rb#L40-L55 |
12,540 | piotrmurach/github | lib/github_api/client/git_data/trees.rb | Github.Client::GitData::Trees.create | def create(*args)
arguments(args, required: [:user, :repo]) do
assert_required %w[ tree ]
permit VALID_TREE_PARAM_NAMES, 'tree', { recursive: true }
assert_values VALID_TREE_PARAM_VALUES, 'tree'
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/git/trees", arguments... | ruby | def create(*args)
arguments(args, required: [:user, :repo]) do
assert_required %w[ tree ]
permit VALID_TREE_PARAM_NAMES, 'tree', { recursive: true }
assert_values VALID_TREE_PARAM_VALUES, 'tree'
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/git/trees", arguments... | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
"]",
")",
"do",
"assert_required",
"%w[",
"tree",
"]",
"permit",
"VALID_TREE_PARAM_NAMES",
",",
"'tree'",
",",
"{",
"recursive",
":",
"tru... | Create a tree
The tree creation API will take nested entries as well.
If both a tree and a nested path modifying that tree are specified,
it will overwrite the contents of that tree with the new path contents
and write a new tree out.
@param [Hash] params
@input params [String] :base_tree
The SHA1 of the tre... | [
"Create",
"a",
"tree"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/git_data/trees.rb#L103-L111 |
12,541 | piotrmurach/github | lib/github_api/client/git_data/commits.rb | Github.Client::GitData::Commits.create | def create(*args)
arguments(args, required: [:user, :repo]) do
permit VALID_COMMIT_PARAM_NAMES
assert_required REQUIRED_COMMIT_PARAMS
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/git/commits", arguments.params)
end | ruby | def create(*args)
arguments(args, required: [:user, :repo]) do
permit VALID_COMMIT_PARAM_NAMES
assert_required REQUIRED_COMMIT_PARAMS
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/git/commits", arguments.params)
end | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
"]",
")",
"do",
"permit",
"VALID_COMMIT_PARAM_NAMES",
"assert_required",
"REQUIRED_COMMIT_PARAMS",
"end",
"post_request",
"(",
"\"/repos/#{arguments... | Create a commit
@param [Hash] params
@input params [String] :message
The commit message
@input params [String] :tree
String of the SHA of the tree object this commit points to
@input params [Array[String]] :parents
Array of the SHAs of the commits that were the parents of this commit.
If omitted or emp... | [
"Create",
"a",
"commit"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/git_data/commits.rb#L92-L99 |
12,542 | piotrmurach/github | lib/github_api/client/issues/assignees.rb | Github.Client::Issues::Assignees.remove | def remove(*args)
arguments(args, required: [:user, :repo, :number])
params = arguments.params
params['data'] = { 'assignees' => arguments.remaining } unless arguments.remaining.empty?
delete_request("/repos/#{arguments.user}/#{arguments.repo}/issues/#{arguments.number}/assignees", params)
... | ruby | def remove(*args)
arguments(args, required: [:user, :repo, :number])
params = arguments.params
params['data'] = { 'assignees' => arguments.remaining } unless arguments.remaining.empty?
delete_request("/repos/#{arguments.user}/#{arguments.repo}/issues/#{arguments.number}/assignees", params)
... | [
"def",
"remove",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":number",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"'data'",
"]",
"=",
"{",
"'assignees'",
"=>",
"arg... | Remove a assignees from an issue
@example
github = Github.new
github.issues.assignees.remove 'user', 'repo', 'issue-number',
'hubot', 'other_assignee'
@api public | [
"Remove",
"a",
"assignees",
"from",
"an",
"issue"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/issues/assignees.rb#L69-L75 |
12,543 | piotrmurach/github | lib/github_api/api.rb | Github.API.filter_callbacks | def filter_callbacks(kind, action_name)
self.class.send("#{kind}_callbacks").select do |callback|
callback[:only].nil? || callback[:only].include?(action_name)
end
end | ruby | def filter_callbacks(kind, action_name)
self.class.send("#{kind}_callbacks").select do |callback|
callback[:only].nil? || callback[:only].include?(action_name)
end
end | [
"def",
"filter_callbacks",
"(",
"kind",
",",
"action_name",
")",
"self",
".",
"class",
".",
"send",
"(",
"\"#{kind}_callbacks\"",
")",
".",
"select",
"do",
"|",
"callback",
"|",
"callback",
"[",
":only",
"]",
".",
"nil?",
"||",
"callback",
"[",
":only",
... | Filter callbacks based on kind
@param [Symbol] kind
one of :before or :after
@return [Array[Hash]]
@api private | [
"Filter",
"callbacks",
"based",
"on",
"kind"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/api.rb#L224-L228 |
12,544 | piotrmurach/github | lib/github_api/api.rb | Github.API.run_callbacks | def run_callbacks(action_name, &block)
filter_callbacks(:before, action_name).each { |hook| send hook[:callback] }
yield if block_given?
filter_callbacks(:after, action_name).each { |hook| send hook[:callback] }
end | ruby | def run_callbacks(action_name, &block)
filter_callbacks(:before, action_name).each { |hook| send hook[:callback] }
yield if block_given?
filter_callbacks(:after, action_name).each { |hook| send hook[:callback] }
end | [
"def",
"run_callbacks",
"(",
"action_name",
",",
"&",
"block",
")",
"filter_callbacks",
"(",
":before",
",",
"action_name",
")",
".",
"each",
"{",
"|",
"hook",
"|",
"send",
"hook",
"[",
":callback",
"]",
"}",
"yield",
"if",
"block_given?",
"filter_callbacks"... | Run all callbacks associated with this action
@apram [Symbol] action_name
@api private | [
"Run",
"all",
"callbacks",
"associated",
"with",
"this",
"action"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/api.rb#L235-L239 |
12,545 | piotrmurach/github | lib/github_api/api.rb | Github.API.set | def set(option, value=(not_set=true), ignore_setter=false, &block)
raise ArgumentError, 'value not set' if block and !not_set
return self if !not_set and value.nil?
if not_set
set_options option
return self
end
if respond_to?("#{option}=") and not ignore_setter
re... | ruby | def set(option, value=(not_set=true), ignore_setter=false, &block)
raise ArgumentError, 'value not set' if block and !not_set
return self if !not_set and value.nil?
if not_set
set_options option
return self
end
if respond_to?("#{option}=") and not ignore_setter
re... | [
"def",
"set",
"(",
"option",
",",
"value",
"=",
"(",
"not_set",
"=",
"true",
")",
",",
"ignore_setter",
"=",
"false",
",",
"&",
"block",
")",
"raise",
"ArgumentError",
",",
"'value not set'",
"if",
"block",
"and",
"!",
"not_set",
"return",
"self",
"if",
... | Set a configuration option for a given namespace
@param [String] option
@param [Object] value
@param [Boolean] ignore_setter
@return [self]
@api public | [
"Set",
"a",
"configuration",
"option",
"for",
"a",
"given",
"namespace"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/api.rb#L294-L309 |
12,546 | piotrmurach/github | lib/github_api/api.rb | Github.API.set_options | def set_options(options)
unless options.respond_to?(:each)
raise ArgumentError, 'cannot iterate over value'
end
options.each { |key, value| set(key, value) }
end | ruby | def set_options(options)
unless options.respond_to?(:each)
raise ArgumentError, 'cannot iterate over value'
end
options.each { |key, value| set(key, value) }
end | [
"def",
"set_options",
"(",
"options",
")",
"unless",
"options",
".",
"respond_to?",
"(",
":each",
")",
"raise",
"ArgumentError",
",",
"'cannot iterate over value'",
"end",
"options",
".",
"each",
"{",
"|",
"key",
",",
"value",
"|",
"set",
"(",
"key",
",",
... | Set multiple options
@api private | [
"Set",
"multiple",
"options"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/api.rb#L366-L371 |
12,547 | piotrmurach/github | lib/github_api/api.rb | Github.API.define_accessors | def define_accessors(option, value)
setter = proc { |val| set option, val, true }
getter = proc { value }
define_singleton_method("#{option}=", setter) if setter
define_singleton_method(option, getter) if getter
end | ruby | def define_accessors(option, value)
setter = proc { |val| set option, val, true }
getter = proc { value }
define_singleton_method("#{option}=", setter) if setter
define_singleton_method(option, getter) if getter
end | [
"def",
"define_accessors",
"(",
"option",
",",
"value",
")",
"setter",
"=",
"proc",
"{",
"|",
"val",
"|",
"set",
"option",
",",
"val",
",",
"true",
"}",
"getter",
"=",
"proc",
"{",
"value",
"}",
"define_singleton_method",
"(",
"\"#{option}=\"",
",",
"set... | Define setters and getters
@api private | [
"Define",
"setters",
"and",
"getters"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/api.rb#L376-L382 |
12,548 | piotrmurach/github | lib/github_api/api.rb | Github.API.define_singleton_method | def define_singleton_method(method_name, content=Proc.new)
(class << self; self; end).class_eval do
undef_method(method_name) if method_defined?(method_name)
if String === content
class_eval("def #{method_name}() #{content}; end")
else
define_method(method_name, &conten... | ruby | def define_singleton_method(method_name, content=Proc.new)
(class << self; self; end).class_eval do
undef_method(method_name) if method_defined?(method_name)
if String === content
class_eval("def #{method_name}() #{content}; end")
else
define_method(method_name, &conten... | [
"def",
"define_singleton_method",
"(",
"method_name",
",",
"content",
"=",
"Proc",
".",
"new",
")",
"(",
"class",
"<<",
"self",
";",
"self",
";",
"end",
")",
".",
"class_eval",
"do",
"undef_method",
"(",
"method_name",
")",
"if",
"method_defined?",
"(",
"m... | Dynamically define a method for setting request option
@api private | [
"Dynamically",
"define",
"a",
"method",
"for",
"setting",
"request",
"option"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/api.rb#L387-L396 |
12,549 | piotrmurach/github | lib/github_api/client/git_data/tags.rb | Github.Client::GitData::Tags.create | def create(*args)
arguments(args, required: [:user, :repo]) do
permit VALID_TAG_PARAM_NAMES
assert_values VALID_TAG_PARAM_VALUES
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/git/tags", arguments.params)
end | ruby | def create(*args)
arguments(args, required: [:user, :repo]) do
permit VALID_TAG_PARAM_NAMES
assert_values VALID_TAG_PARAM_VALUES
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/git/tags", arguments.params)
end | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
"]",
")",
"do",
"permit",
"VALID_TAG_PARAM_NAMES",
"assert_values",
"VALID_TAG_PARAM_VALUES",
"end",
"post_request",
"(",
"\"/repos/#{arguments.user... | Create a tag object
Note that creating a tag object does not create the reference that
makes a tag in Git. If you want to create an annotated tag in Git,
you have to do this call to create the tag object, and then create
the refs/tags/[tag] reference. If you want to create a lightweight
tag, you simply have to cr... | [
"Create",
"a",
"tag",
"object"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/git_data/tags.rb#L86-L93 |
12,550 | piotrmurach/github | lib/github_api/client/users/followers.rb | Github.Client::Users::Followers.list | def list(*args)
params = arguments(args).params
response = if user_name = arguments.remaining.first
get_request("/users/#{user_name}/followers", params)
else
get_request("/user/followers", params)
end
return response unless block_given?
response.each { |el| yield el ... | ruby | def list(*args)
params = arguments(args).params
response = if user_name = arguments.remaining.first
get_request("/users/#{user_name}/followers", params)
else
get_request("/user/followers", params)
end
return response unless block_given?
response.each { |el| yield el ... | [
"def",
"list",
"(",
"*",
"args",
")",
"params",
"=",
"arguments",
"(",
"args",
")",
".",
"params",
"response",
"=",
"if",
"user_name",
"=",
"arguments",
".",
"remaining",
".",
"first",
"get_request",
"(",
"\"/users/#{user_name}/followers\"",
",",
"params",
"... | List a user's followers
@example
github = Github.new
github.users.followers.list 'user-name'
github.users.followers.list 'user-name' { |user| ... }
List the authenticated user's followers
@example
github = Github.new oauth_token: '...'
github.users.followers
github.users.followers { |user| ... }
@ap... | [
"List",
"a",
"user",
"s",
"followers"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/users/followers.rb#L23-L33 |
12,551 | piotrmurach/github | lib/github_api/client/users/followers.rb | Github.Client::Users::Followers.following? | def following?(*args)
arguments(args, required: [:username])
params = arguments.params
if target_user = params.delete('target_user')
get_request("/users/#{arguments.username}/following/#{target_user}", params)
else
get_request("/user/following/#{arguments.username}", params)
... | ruby | def following?(*args)
arguments(args, required: [:username])
params = arguments.params
if target_user = params.delete('target_user')
get_request("/users/#{arguments.username}/following/#{target_user}", params)
else
get_request("/user/following/#{arguments.username}", params)
... | [
"def",
"following?",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":username",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"if",
"target_user",
"=",
"params",
".",
"delete",
"(",
"'target_user'",
")",
"get_request",
... | Check if you are following a user
@example
github = Github.new oauth_token: '...'
github.users.followers.following? 'user-name'
github.users.followers.following? username: 'user-name'
Check if one user follows another
@example
github = Github.new oauth_token: '...'
github.users.followers.following?... | [
"Check",
"if",
"you",
"are",
"following",
"a",
"user"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/users/followers.rb#L77-L88 |
12,552 | piotrmurach/github | lib/github_api/client/activity/watching.rb | Github.Client::Activity::Watching.watched | def watched(*args)
arguments(args)
params = arguments.params
response = if (user_name = params.delete('user'))
get_request("/users/#{user_name}/subscriptions", params)
else
get_request('/user/subscriptions', params)
end
return response unless block_given?
respo... | ruby | def watched(*args)
arguments(args)
params = arguments.params
response = if (user_name = params.delete('user'))
get_request("/users/#{user_name}/subscriptions", params)
else
get_request('/user/subscriptions', params)
end
return response unless block_given?
respo... | [
"def",
"watched",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
")",
"params",
"=",
"arguments",
".",
"params",
"response",
"=",
"if",
"(",
"user_name",
"=",
"params",
".",
"delete",
"(",
"'user'",
")",
")",
"get_request",
"(",
"\"/users/#{user_name}/su... | List repos being watched by a user
@see https://developer.github.com/v3/activity/watching/#list-repositories-being-watched
@example
github = Github.new
github.activity.watching.watched user: 'user-name'
List repos being watched by the authenticated user
@example
github = Github.new oauth_token: '...'
... | [
"List",
"repos",
"being",
"watched",
"by",
"a",
"user"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/activity/watching.rb#L43-L54 |
12,553 | piotrmurach/github | lib/github_api/client/orgs/members.rb | Github.Client::Orgs::Members.member? | def member?(*args)
params = arguments(args, required: [:org_name, :user]).params
org_name = arguments.org_name
user = arguments.user
response = if params.delete('public')
get_request("/orgs/#{org_name}/public_members/#{user}", params)
else
... | ruby | def member?(*args)
params = arguments(args, required: [:org_name, :user]).params
org_name = arguments.org_name
user = arguments.user
response = if params.delete('public')
get_request("/orgs/#{org_name}/public_members/#{user}", params)
else
... | [
"def",
"member?",
"(",
"*",
"args",
")",
"params",
"=",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":org_name",
",",
":user",
"]",
")",
".",
"params",
"org_name",
"=",
"arguments",
".",
"org_name",
"user",
"=",
"arguments",
".",
"user",
"resp... | Check if user is, publicly or privately, a member of an organization
@example
github = Github.new
github.orgs.members.member? 'org-name', 'member-name'
Check if a user is a public member of an organization
@example
github = Github.new
github.orgs.members.member? 'org-name', 'member-name', public: true... | [
"Check",
"if",
"user",
"is",
"publicly",
"or",
"privately",
"a",
"member",
"of",
"an",
"organization"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/orgs/members.rb#L75-L88 |
12,554 | piotrmurach/github | lib/github_api/client/repos/branches/protections.rb | Github.Client::Repos::Branches::Protections.edit | def edit(*args)
arguments(args, required: [:user, :repo, :branch]) do
permit VALID_PROTECTION_PARAM_NAMES
end
put_request("/repos/#{arguments.user}/#{arguments.repo}/branches/#{arguments.branch}/protection", arguments.params)
end | ruby | def edit(*args)
arguments(args, required: [:user, :repo, :branch]) do
permit VALID_PROTECTION_PARAM_NAMES
end
put_request("/repos/#{arguments.user}/#{arguments.repo}/branches/#{arguments.branch}/protection", arguments.params)
end | [
"def",
"edit",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":branch",
"]",
")",
"do",
"permit",
"VALID_PROTECTION_PARAM_NAMES",
"end",
"put_request",
"(",
"\"/repos/#{arguments.user}/#{arguments.repo}/bra... | Edit a branch protection
Users with push access to the repository can edit a branch protection.
@param [Hash] params
@input params [String] :required_status_checks
Required.
@input params [String] :enforce_admins
Required.
@input params [String] :restrictions
Required.
@input params [String] :required_... | [
"Edit",
"a",
"branch",
"protection"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos/branches/protections.rb#L52-L58 |
12,555 | piotrmurach/github | lib/github_api/parameter_filter.rb | Github.ParameterFilter.filter! | def filter!(keys, params, options={:recursive => true}) # :nodoc:
case params
when Hash, ParamsHash
params.keys.each do |k, v|
unless (keys.include?(k) or Github::Validations::VALID_API_KEYS.include?(k))
params.delete(k)
else
filter!(keys, params[k]) if o... | ruby | def filter!(keys, params, options={:recursive => true}) # :nodoc:
case params
when Hash, ParamsHash
params.keys.each do |k, v|
unless (keys.include?(k) or Github::Validations::VALID_API_KEYS.include?(k))
params.delete(k)
else
filter!(keys, params[k]) if o... | [
"def",
"filter!",
"(",
"keys",
",",
"params",
",",
"options",
"=",
"{",
":recursive",
"=>",
"true",
"}",
")",
"# :nodoc:",
"case",
"params",
"when",
"Hash",
",",
"ParamsHash",
"params",
".",
"keys",
".",
"each",
"do",
"|",
"k",
",",
"v",
"|",
"unless... | Removes any keys from nested hashes that don't match predefiend keys | [
"Removes",
"any",
"keys",
"from",
"nested",
"hashes",
"that",
"don",
"t",
"match",
"predefiend",
"keys"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/parameter_filter.rb#L14-L32 |
12,556 | piotrmurach/github | lib/github_api/client/orgs/teams.rb | Github.Client::Orgs::Teams.team_repo? | def team_repo?(*args)
arguments(args, required: [:id, :user, :repo])
response = get_request("/teams/#{arguments.id}/repos/#{arguments.user}/#{arguments.repo}", arguments.params)
response.status == 204
rescue Github::Error::NotFound
false
end | ruby | def team_repo?(*args)
arguments(args, required: [:id, :user, :repo])
response = get_request("/teams/#{arguments.id}/repos/#{arguments.user}/#{arguments.repo}", arguments.params)
response.status == 204
rescue Github::Error::NotFound
false
end | [
"def",
"team_repo?",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":id",
",",
":user",
",",
":repo",
"]",
")",
"response",
"=",
"get_request",
"(",
"\"/teams/#{arguments.id}/repos/#{arguments.user}/#{arguments.repo}\"",
",",
"argumen... | Check if a repository belongs to a team
@see https://developer.github.com/v3/orgs/teams/#get-team-repo
@example
github = Github.new oauth_token: '...'
github.orgs.teams.team_repo? 'team-id', 'user-name', 'repo-name'
@api public | [
"Check",
"if",
"a",
"repository",
"belongs",
"to",
"a",
"team"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/orgs/teams.rb#L356-L363 |
12,557 | piotrmurach/github | lib/github_api/response/raise_error.rb | Github.Response::RaiseError.on_complete | def on_complete(env)
status_code = env[:status].to_i
service_error = Github::Error::ServiceError
error_class = service_error.error_mapping[status_code]
if !error_class and (400...600) === status_code
error_class = service_error
end
raise error_class.new(env) if error_class
... | ruby | def on_complete(env)
status_code = env[:status].to_i
service_error = Github::Error::ServiceError
error_class = service_error.error_mapping[status_code]
if !error_class and (400...600) === status_code
error_class = service_error
end
raise error_class.new(env) if error_class
... | [
"def",
"on_complete",
"(",
"env",
")",
"status_code",
"=",
"env",
"[",
":status",
"]",
".",
"to_i",
"service_error",
"=",
"Github",
"::",
"Error",
"::",
"ServiceError",
"error_class",
"=",
"service_error",
".",
"error_mapping",
"[",
"status_code",
"]",
"if",
... | Check if status code requires raising a ServiceError
@api private | [
"Check",
"if",
"status",
"code",
"requires",
"raising",
"a",
"ServiceError"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/response/raise_error.rb#L12-L20 |
12,558 | piotrmurach/github | lib/github_api/client/repos/deployments.rb | Github.Client::Repos::Deployments.create | def create(*args)
arguments(args, required: [:user, :repo]) do
permit VALID_DEPLOYMENTS_OPTIONS
assert_required %w[ ref ]
end
params = arguments.params
params['accept'] ||= PREVIEW_MEDIA
post_request("repos/#{arguments.user}/#{arguments.repo}/deployments", arguments.params... | ruby | def create(*args)
arguments(args, required: [:user, :repo]) do
permit VALID_DEPLOYMENTS_OPTIONS
assert_required %w[ ref ]
end
params = arguments.params
params['accept'] ||= PREVIEW_MEDIA
post_request("repos/#{arguments.user}/#{arguments.repo}/deployments", arguments.params... | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
"]",
")",
"do",
"permit",
"VALID_DEPLOYMENTS_OPTIONS",
"assert_required",
"%w[",
"ref",
"]",
"end",
"params",
"=",
"arguments",
".",
"params... | Create a deployment
@param [Hash] params
@option params [String] :ref
Required string. The ref to deploy. This can be a branch, tag, or sha.
@option params [Boolean] :auto_merge
Optional boolean. Merge the default branch into the requested.
@option params [Array] :required_contexts
Optional array of statu... | [
"Create",
"a",
"deployment"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos/deployments.rb#L76-L85 |
12,559 | piotrmurach/github | lib/github_api/client/repos/deployments.rb | Github.Client::Repos::Deployments.statuses | def statuses(*args)
arguments(args, required: [:user, :repo, :id])
params = arguments.params
params['accept'] ||= PREVIEW_MEDIA
statuses = get_request("repos/#{arguments.user}/#{arguments.repo}/deployments/#{arguments.id}/statuses", params)
return statuses unless block_given?
status... | ruby | def statuses(*args)
arguments(args, required: [:user, :repo, :id])
params = arguments.params
params['accept'] ||= PREVIEW_MEDIA
statuses = get_request("repos/#{arguments.user}/#{arguments.repo}/deployments/#{arguments.id}/statuses", params)
return statuses unless block_given?
status... | [
"def",
"statuses",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":id",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"'accept'",
"]",
"||=",
"PREVIEW_MEDIA",
"statuses",
"... | List the statuses of a deployment.
@param [Hash] params
@option params [String] :id
Required string. Id of the deployment being queried.
@example
github = Github.new
github.repos.deployments.statuses 'user-name', 'repo-name', DEPLOYMENT_ID
github.repos.deployments.statuses 'user-name', 'repo-name', DEPLOY... | [
"List",
"the",
"statuses",
"of",
"a",
"deployment",
"."
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos/deployments.rb#L99-L107 |
12,560 | piotrmurach/github | lib/github_api/client/repos/deployments.rb | Github.Client::Repos::Deployments.create_status | def create_status(*args)
arguments(args, required: [:user, :repo, :id]) do
assert_required %w[ state ]
permit VALID_STATUS_OPTIONS
end
params = arguments.params
params['accept'] ||= PREVIEW_MEDIA
post_request("repos/#{arguments.user}/#{arguments.repo}/deployments/#{argumen... | ruby | def create_status(*args)
arguments(args, required: [:user, :repo, :id]) do
assert_required %w[ state ]
permit VALID_STATUS_OPTIONS
end
params = arguments.params
params['accept'] ||= PREVIEW_MEDIA
post_request("repos/#{arguments.user}/#{arguments.repo}/deployments/#{argumen... | [
"def",
"create_status",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":id",
"]",
")",
"do",
"assert_required",
"%w[",
"state",
"]",
"permit",
"VALID_STATUS_OPTIONS",
"end",
"params",
"=",
"argument... | Create a deployment status
@param [Hash] params
@option params [String] :id
Required string. Id of the deployment being referenced.
@option params [String] :state
Required string. State of the deployment. Can be one of:
pending, success, error, or failure.
@option params [String] :target_url
Optional s... | [
"Create",
"a",
"deployment",
"status"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos/deployments.rb#L127-L136 |
12,561 | piotrmurach/github | lib/github_api/params_hash.rb | Github.ParamsHash.options | def options
opts = fetch('options', {})
headers = fetch('headers', {})
if value = accept
headers[:accept] = value
end
opts[:raw] = key?('raw') ? self['raw'] : false
opts[:headers] = headers unless headers.empty?
opts
end | ruby | def options
opts = fetch('options', {})
headers = fetch('headers', {})
if value = accept
headers[:accept] = value
end
opts[:raw] = key?('raw') ? self['raw'] : false
opts[:headers] = headers unless headers.empty?
opts
end | [
"def",
"options",
"opts",
"=",
"fetch",
"(",
"'options'",
",",
"{",
"}",
")",
"headers",
"=",
"fetch",
"(",
"'headers'",
",",
"{",
"}",
")",
"if",
"value",
"=",
"accept",
"headers",
"[",
":accept",
"]",
"=",
"value",
"end",
"opts",
"[",
":raw",
"]"... | Configuration options from request
@return [Hash]
@api public | [
"Configuration",
"options",
"from",
"request"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/params_hash.rb#L71-L80 |
12,562 | piotrmurach/github | lib/github_api/params_hash.rb | Github.ParamsHash.merge_default | def merge_default(defaults)
if defaults && !defaults.empty?
defaults.each do |key, value|
self[key] = value unless self.key?(key)
end
end
self
end | ruby | def merge_default(defaults)
if defaults && !defaults.empty?
defaults.each do |key, value|
self[key] = value unless self.key?(key)
end
end
self
end | [
"def",
"merge_default",
"(",
"defaults",
")",
"if",
"defaults",
"&&",
"!",
"defaults",
".",
"empty?",
"defaults",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"self",
"[",
"key",
"]",
"=",
"value",
"unless",
"self",
".",
"key?",
"(",
"key",
")",... | Update hash with default parameters for non existing keys | [
"Update",
"hash",
"with",
"default",
"parameters",
"for",
"non",
"existing",
"keys"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/params_hash.rb#L84-L91 |
12,563 | piotrmurach/github | lib/github_api/params_hash.rb | Github.ParamsHash.strict_encode64 | def strict_encode64(key)
value = self[key]
encoded = if Base64.respond_to?(:strict_encode64)
Base64.strict_encode64(value)
else
[value].pack('m0')
end
self[key] = encoded.delete("\n\r")
end | ruby | def strict_encode64(key)
value = self[key]
encoded = if Base64.respond_to?(:strict_encode64)
Base64.strict_encode64(value)
else
[value].pack('m0')
end
self[key] = encoded.delete("\n\r")
end | [
"def",
"strict_encode64",
"(",
"key",
")",
"value",
"=",
"self",
"[",
"key",
"]",
"encoded",
"=",
"if",
"Base64",
".",
"respond_to?",
"(",
":strict_encode64",
")",
"Base64",
".",
"strict_encode64",
"(",
"value",
")",
"else",
"[",
"value",
"]",
".",
"pack... | Base64 encode string removing newline characters
@api public | [
"Base64",
"encode",
"string",
"removing",
"newline",
"characters"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/params_hash.rb#L96-L104 |
12,564 | piotrmurach/github | lib/github_api/client/repos/comments.rb | Github.Client::Repos::Comments.create | def create(*args)
arguments(args, required: [:user, :repo, :sha]) do
assert_required REQUIRED_COMMENT_OPTIONS
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/commits/#{arguments.sha}/comments", arguments.params)
end | ruby | def create(*args)
arguments(args, required: [:user, :repo, :sha]) do
assert_required REQUIRED_COMMENT_OPTIONS
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/commits/#{arguments.sha}/comments", arguments.params)
end | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":sha",
"]",
")",
"do",
"assert_required",
"REQUIRED_COMMENT_OPTIONS",
"end",
"post_request",
"(",
"\"/repos/#{arguments.user}/#{arguments.repo... | Creates a commit comment
@param [Hash] params
@option params [String] :body
Required. The contents of the comment.
@option params [String] :path
Required. Relative path of the file to comment on.
@option params [Number] :position
Required number - Line index in the diff to comment on.
@option params [Num... | [
"Creates",
"a",
"commit",
"comment"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos/comments.rb#L84-L90 |
12,565 | piotrmurach/github | lib/github_api/client/repos/comments.rb | Github.Client::Repos::Comments.update | def update(*args)
arguments(args, required: [:user, :repo, :id]) do
assert_required REQUIRED_COMMENT_OPTIONS
end
patch_request("/repos/#{arguments.user}/#{arguments.repo}/comments/#{arguments.id}", arguments.params)
end | ruby | def update(*args)
arguments(args, required: [:user, :repo, :id]) do
assert_required REQUIRED_COMMENT_OPTIONS
end
patch_request("/repos/#{arguments.user}/#{arguments.repo}/comments/#{arguments.id}", arguments.params)
end | [
"def",
"update",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":id",
"]",
")",
"do",
"assert_required",
"REQUIRED_COMMENT_OPTIONS",
"end",
"patch_request",
"(",
"\"/repos/#{arguments.user}/#{arguments.repo... | Update a commit comment
@param [Hash] params
@option params [String] :body
Required. The contents of the comment.
@example
github = Github.new
github.repos.comments.update 'user-name', 'repo-name', 'id',
body: "Nice change"
@api public | [
"Update",
"a",
"commit",
"comment"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos/comments.rb#L104-L110 |
12,566 | piotrmurach/github | lib/github_api/client/repos/contents.rb | Github.Client::Repos::Contents.create | def create(*args)
arguments(args, required: [:user, :repo, :path]) do
assert_required REQUIRED_CONTENT_OPTIONS
end
params = arguments.params
params.strict_encode64('content')
put_request("/repos/#{arguments.user}/#{arguments.repo}/contents/#{arguments.path}", params)
end | ruby | def create(*args)
arguments(args, required: [:user, :repo, :path]) do
assert_required REQUIRED_CONTENT_OPTIONS
end
params = arguments.params
params.strict_encode64('content')
put_request("/repos/#{arguments.user}/#{arguments.repo}/contents/#{arguments.path}", params)
end | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":path",
"]",
")",
"do",
"assert_required",
"REQUIRED_CONTENT_OPTIONS",
"end",
"params",
"=",
"arguments",
".",
"params",
"params",
"."... | Create a file
This method creates a new file in a repository
@param [Hash] params
@option params [String] :path
Required string. The content path
@option params [String]
@option params [String] :message
Required string. The commit message.
@option params [String] :content
Required string. The new file ... | [
"Create",
"a",
"file"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos/contents.rb#L104-L112 |
12,567 | piotrmurach/github | lib/github_api/client/repos/contents.rb | Github.Client::Repos::Contents.delete | def delete(*args)
arguments(args, required: [:user, :repo, :path]) do
assert_required %w[ path message sha ]
end
delete_request("/repos/#{arguments.user}/#{arguments.repo}/contents/#{arguments.path}", arguments.params)
end | ruby | def delete(*args)
arguments(args, required: [:user, :repo, :path]) do
assert_required %w[ path message sha ]
end
delete_request("/repos/#{arguments.user}/#{arguments.repo}/contents/#{arguments.path}", arguments.params)
end | [
"def",
"delete",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":path",
"]",
")",
"do",
"assert_required",
"%w[",
"path",
"message",
"sha",
"]",
"end",
"delete_request",
"(",
"\"/repos/#{arguments.u... | Delete a file
This method deletes a file in a repository
@param [Hash] params
@option params [String] :path
Requried string. The content path
@option params [String]
@option params [String] :message
Requried string. The commit message.
@option params [String] :sha
Required string. The blob SHA of the f... | [
"Delete",
"a",
"file"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos/contents.rb#L202-L208 |
12,568 | piotrmurach/github | lib/github_api/client/repos/contents.rb | Github.Client::Repos::Contents.archive | def archive(*args)
arguments(args, required: [:user, :repo])
params = arguments.params
archive_format = params.delete('archive_format') || 'tarball'
ref = params.delete('ref') || 'master'
disable_redirects do
response = get_request("/repos/#{arguments.user}/#{ar... | ruby | def archive(*args)
arguments(args, required: [:user, :repo])
params = arguments.params
archive_format = params.delete('archive_format') || 'tarball'
ref = params.delete('ref') || 'master'
disable_redirects do
response = get_request("/repos/#{arguments.user}/#{ar... | [
"def",
"archive",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"archive_format",
"=",
"params",
".",
"delete",
"(",
"'archive_format'",
")",
"||",
... | Get archive link
This method will return a 302 to a URL to download a tarball or zipball
archive for a repository. Please make sure your HTTP framework is configured
to follow redirects or you will need to use the Location header to make
a second GET request.
@note
For private repositories, these links are te... | [
"Get",
"archive",
"link"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos/contents.rb#L234-L244 |
12,569 | piotrmurach/github | lib/github_api/normalizer.rb | Github.Normalizer.normalize! | def normalize!(params)
case params
when Hash
params.keys.each do |k|
params[k.to_s] = params.delete(k)
normalize!(params[k.to_s])
end
when Array
params.map! do |el|
normalize!(el)
end
end
params
end | ruby | def normalize!(params)
case params
when Hash
params.keys.each do |k|
params[k.to_s] = params.delete(k)
normalize!(params[k.to_s])
end
when Array
params.map! do |el|
normalize!(el)
end
end
params
end | [
"def",
"normalize!",
"(",
"params",
")",
"case",
"params",
"when",
"Hash",
"params",
".",
"keys",
".",
"each",
"do",
"|",
"k",
"|",
"params",
"[",
"k",
".",
"to_s",
"]",
"=",
"params",
".",
"delete",
"(",
"k",
")",
"normalize!",
"(",
"params",
"[",... | Turns any keys from nested hashes including nested arrays into strings | [
"Turns",
"any",
"keys",
"from",
"nested",
"hashes",
"including",
"nested",
"arrays",
"into",
"strings"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/normalizer.rb#L8-L21 |
12,570 | piotrmurach/github | lib/github_api/client/authorizations/app.rb | Github.Client::Authorizations::App.create | def create(*args)
raise_authentication_error unless authenticated?
arguments(args, required: [:client_id])
if arguments.client_id
put_request("/authorizations/clients/#{arguments.client_id}", arguments.params)
else
raise raise_app_authentication_error
end
end | ruby | def create(*args)
raise_authentication_error unless authenticated?
arguments(args, required: [:client_id])
if arguments.client_id
put_request("/authorizations/clients/#{arguments.client_id}", arguments.params)
else
raise raise_app_authentication_error
end
end | [
"def",
"create",
"(",
"*",
"args",
")",
"raise_authentication_error",
"unless",
"authenticated?",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":client_id",
"]",
")",
"if",
"arguments",
".",
"client_id",
"put_request",
"(",
"\"/authorizations/clients/#{argum... | Get-or-create an authorization for a specific app
@see https://developer.github.com/v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app
@param [Hash] params
@option params [String] client_secret
The 40 character OAuth app client secret associated with the client
ID specified in the URL.
... | [
"Get",
"-",
"or",
"-",
"create",
"an",
"authorization",
"for",
"a",
"specific",
"app"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/authorizations/app.rb#L27-L36 |
12,571 | piotrmurach/github | lib/github_api/client/authorizations/app.rb | Github.Client::Authorizations::App.check | def check(*args)
raise_authentication_error unless authenticated?
params = arguments(args, required: [:client_id, :access_token]).params
if arguments.client_id
begin
get_request("/applications/#{arguments.client_id}/tokens/#{arguments.access_token}", params)
rescue Github::E... | ruby | def check(*args)
raise_authentication_error unless authenticated?
params = arguments(args, required: [:client_id, :access_token]).params
if arguments.client_id
begin
get_request("/applications/#{arguments.client_id}/tokens/#{arguments.access_token}", params)
rescue Github::E... | [
"def",
"check",
"(",
"*",
"args",
")",
"raise_authentication_error",
"unless",
"authenticated?",
"params",
"=",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":client_id",
",",
":access_token",
"]",
")",
".",
"params",
"if",
"arguments",
".",
"client_id... | Check if an access token is a valid authorization for an application
@example
github = Github.new basic_auth: "client_id:client_secret"
github.oauth.app.check 'client_id', 'access-token'
@api public | [
"Check",
"if",
"an",
"access",
"token",
"is",
"a",
"valid",
"authorization",
"for",
"an",
"application"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/authorizations/app.rb#L45-L58 |
12,572 | piotrmurach/github | lib/github_api/client/authorizations/app.rb | Github.Client::Authorizations::App.delete | def delete(*args)
raise_authentication_error unless authenticated?
params = arguments(args, required: [:client_id]).params
if arguments.client_id
if access_token = (params.delete('access_token') || args[1])
delete_request("/applications/#{arguments.client_id}/tokens/#{access_token}"... | ruby | def delete(*args)
raise_authentication_error unless authenticated?
params = arguments(args, required: [:client_id]).params
if arguments.client_id
if access_token = (params.delete('access_token') || args[1])
delete_request("/applications/#{arguments.client_id}/tokens/#{access_token}"... | [
"def",
"delete",
"(",
"*",
"args",
")",
"raise_authentication_error",
"unless",
"authenticated?",
"params",
"=",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":client_id",
"]",
")",
".",
"params",
"if",
"arguments",
".",
"client_id",
"if",
"access_toke... | Revoke all authorizations for an application
@example
github = Github.new basic_auth: "client_id:client_secret"
github.oauth.app.delete 'client-id'
Revoke an authorization for an application
@example
github = Github.new basic_auth: "client_id:client_secret"
github.oauth.app.delete 'client-id', 'access-tok... | [
"Revoke",
"all",
"authorizations",
"for",
"an",
"application"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/authorizations/app.rb#L73-L87 |
12,573 | piotrmurach/github | lib/github_api/client/projects.rb | Github.Client::Projects.edit | def edit(*args)
arguments(args, required: [:id])
params = arguments.params
params["accept"] ||= PREVIEW_MEDIA
patch_request("/projects/#{arguments.id}", params)
end | ruby | def edit(*args)
arguments(args, required: [:id])
params = arguments.params
params["accept"] ||= PREVIEW_MEDIA
patch_request("/projects/#{arguments.id}", params)
end | [
"def",
"edit",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":id",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"\"accept\"",
"]",
"||=",
"PREVIEW_MEDIA",
"patch_request",
"(",
"\"/projects/#{arguments.id... | Edit a project
@param [Hash] params
@option params [String] :name
Optional string
@option params [String] :body
Optional string
@option params [String] :state
Optional string
@example
github = Github.new
github.projects.edit 1002604,
name: "Outcomes Tracker",
body: "The board to track work f... | [
"Edit",
"a",
"project"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/projects.rb#L57-L64 |
12,574 | piotrmurach/github | lib/github_api/client/gists.rb | Github.Client::Gists.list | def list(*args)
params = arguments(args).params
response = if (user = params.delete('user'))
get_request("/users/#{user}/gists", params)
elsif args.map(&:to_s).include?('public')
get_request("/gists/public", params)
else
get_request("/gists", params)
end
retu... | ruby | def list(*args)
params = arguments(args).params
response = if (user = params.delete('user'))
get_request("/users/#{user}/gists", params)
elsif args.map(&:to_s).include?('public')
get_request("/gists/public", params)
else
get_request("/gists", params)
end
retu... | [
"def",
"list",
"(",
"*",
"args",
")",
"params",
"=",
"arguments",
"(",
"args",
")",
".",
"params",
"response",
"=",
"if",
"(",
"user",
"=",
"params",
".",
"delete",
"(",
"'user'",
")",
")",
"get_request",
"(",
"\"/users/#{user}/gists\"",
",",
"params",
... | List a user's gists
@see https://developer.github.com/v3/gists/#list-a-users-gists
@example
github = Github.new
github.gists.list user: 'user-name'
List the authenticated user’s gists or if called anonymously,
this will returns all public gists
@example
github = Github.new oauth_token: '...'
github.gis... | [
"List",
"a",
"user",
"s",
"gists"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/gists.rb#L38-L50 |
12,575 | piotrmurach/github | lib/github_api/client/gists.rb | Github.Client::Gists.get | def get(*args)
arguments(args, required: [:id])
if (sha = arguments.params.delete('sha'))
get_request("/gists/#{arguments.id}/#{sha}")
else
get_request("/gists/#{arguments.id}", arguments.params)
end
end | ruby | def get(*args)
arguments(args, required: [:id])
if (sha = arguments.params.delete('sha'))
get_request("/gists/#{arguments.id}/#{sha}")
else
get_request("/gists/#{arguments.id}", arguments.params)
end
end | [
"def",
"get",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":id",
"]",
")",
"if",
"(",
"sha",
"=",
"arguments",
".",
"params",
".",
"delete",
"(",
"'sha'",
")",
")",
"get_request",
"(",
"\"/gists/#{arguments.id}/#{sha}\"",
... | Get a single gist
@see https://developer.github.com/v3/gists/#get-a-single-gist
@example
github = Github.new
github.gists.get 'gist-id'
Get a specific revision of gist
@see https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist
@example
github = Github.new
github.gists.get 'gist-... | [
"Get",
"a",
"single",
"gist"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/gists.rb#L90-L98 |
12,576 | piotrmurach/github | lib/github_api/authorization.rb | Github.Authorization.client | def client
@client ||= ::OAuth2::Client.new(client_id, client_secret,
{
:site => current_options.fetch(:site) { Github.site },
:authorize_url => 'login/oauth/authorize',
:token_url => 'login/oauth/access_token',
:ssl => { :verify => false }
... | ruby | def client
@client ||= ::OAuth2::Client.new(client_id, client_secret,
{
:site => current_options.fetch(:site) { Github.site },
:authorize_url => 'login/oauth/authorize',
:token_url => 'login/oauth/access_token',
:ssl => { :verify => false }
... | [
"def",
"client",
"@client",
"||=",
"::",
"OAuth2",
"::",
"Client",
".",
"new",
"(",
"client_id",
",",
"client_secret",
",",
"{",
":site",
"=>",
"current_options",
".",
"fetch",
"(",
":site",
")",
"{",
"Github",
".",
"site",
"}",
",",
":authorize_url",
"=... | Setup OAuth2 instance | [
"Setup",
"OAuth2",
"instance"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/authorization.rb#L9-L18 |
12,577 | piotrmurach/github | lib/github_api/client/orgs/projects.rb | Github.Client::Orgs::Projects.create | def create(*args)
arguments(args, required: [:org_name]) do
assert_required %w[ name ]
end
params = arguments.params
params["accept"] ||= PREVIEW_MEDIA
post_request("/orgs/#{arguments.org_name}/projects", params)
end | ruby | def create(*args)
arguments(args, required: [:org_name]) do
assert_required %w[ name ]
end
params = arguments.params
params["accept"] ||= PREVIEW_MEDIA
post_request("/orgs/#{arguments.org_name}/projects", params)
end | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":org_name",
"]",
")",
"do",
"assert_required",
"%w[",
"name",
"]",
"end",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"\"accept\"",
"]",
"||=",
... | Create a new project for the specified repo
@param [Hash] params
@option params [String] :name
Required string - The name of the project.
@option params [String] :body
Optional string - The body of the project.
@example
github = Github.new
github.repos.create 'owner-name', 'repo-name', name: 'project-na... | [
"Create",
"a",
"new",
"project",
"for",
"the",
"specified",
"repo"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/orgs/projects.rb#L46-L55 |
12,578 | piotrmurach/github | lib/github_api/request.rb | Github.Request.call | def call(current_options, params)
unless HTTP_METHODS.include?(action)
raise ArgumentError, "unknown http method: #{method}"
end
puts "EXECUTED: #{action} - #{path} with PARAMS: #{params.request_params}" if ENV['DEBUG']
request_options = params.options
connection_options = cur... | ruby | def call(current_options, params)
unless HTTP_METHODS.include?(action)
raise ArgumentError, "unknown http method: #{method}"
end
puts "EXECUTED: #{action} - #{path} with PARAMS: #{params.request_params}" if ENV['DEBUG']
request_options = params.options
connection_options = cur... | [
"def",
"call",
"(",
"current_options",
",",
"params",
")",
"unless",
"HTTP_METHODS",
".",
"include?",
"(",
"action",
")",
"raise",
"ArgumentError",
",",
"\"unknown http method: #{method}\"",
"end",
"puts",
"\"EXECUTED: #{action} - #{path} with PARAMS: #{params.request_params}... | Create a new Request
@return [Github::Request]
@api public
Performs a request
@param [Symbol] method - The Symbol the HTTP verb
@param [String] path - String relative URL to access
@param [ParamsHash] params - ParamsHash to configure the request API
@return [Github::ResponseWrapper]
@api private | [
"Create",
"a",
"new",
"Request"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/request.rb#L53-L83 |
12,579 | piotrmurach/github | lib/github_api/client/authorizations.rb | Github.Client::Authorizations.get | def get(*args)
raise_authentication_error unless authenticated?
arguments(args, required: [:id])
get_request("/authorizations/#{arguments.id}", arguments.params)
end | ruby | def get(*args)
raise_authentication_error unless authenticated?
arguments(args, required: [:id])
get_request("/authorizations/#{arguments.id}", arguments.params)
end | [
"def",
"get",
"(",
"*",
"args",
")",
"raise_authentication_error",
"unless",
"authenticated?",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":id",
"]",
")",
"get_request",
"(",
"\"/authorizations/#{arguments.id}\"",
",",
"arguments",
".",
"params",
")",
... | Get a single authorization
@see https://developer.github.com/v3/oauth_authorizations/#get-a-single-authorization
@example
github = Github.new basic_auth: 'login:password'
github.oauth.get 'authorization-id'
@return [ResponseWrapper]
@api public | [
"Get",
"a",
"single",
"authorization"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/authorizations.rb#L45-L50 |
12,580 | piotrmurach/github | lib/github_api/client/authorizations.rb | Github.Client::Authorizations.create | def create(*args)
raise_authentication_error unless authenticated?
arguments(args) do
assert_required :note, :scopes
end
post_request('/authorizations', arguments.params)
end | ruby | def create(*args)
raise_authentication_error unless authenticated?
arguments(args) do
assert_required :note, :scopes
end
post_request('/authorizations', arguments.params)
end | [
"def",
"create",
"(",
"*",
"args",
")",
"raise_authentication_error",
"unless",
"authenticated?",
"arguments",
"(",
"args",
")",
"do",
"assert_required",
":note",
",",
":scopes",
"end",
"post_request",
"(",
"'/authorizations'",
",",
"arguments",
".",
"params",
")"... | Create a new authorization
@see https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization
@param [Hash] params
@option params [Array[String]] :scopes
A list of scopes that this authorization is in.
@option params [String] :note
Required. A note to remind you what the OAuth token is fo... | [
"Create",
"a",
"new",
"authorization"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/authorizations.rb#L77-L84 |
12,581 | piotrmurach/github | lib/github_api/client/authorizations.rb | Github.Client::Authorizations.update | def update(*args)
raise_authentication_error unless authenticated?
arguments(args, required: [:id])
patch_request("/authorizations/#{arguments.id}", arguments.params)
end | ruby | def update(*args)
raise_authentication_error unless authenticated?
arguments(args, required: [:id])
patch_request("/authorizations/#{arguments.id}", arguments.params)
end | [
"def",
"update",
"(",
"*",
"args",
")",
"raise_authentication_error",
"unless",
"authenticated?",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":id",
"]",
")",
"patch_request",
"(",
"\"/authorizations/#{arguments.id}\"",
",",
"arguments",
".",
"params",
")... | Update an existing authorization
@see https://developer.github.com/v3/oauth_authorizations/#update-an-existing-authorization
@param [Hash] inputs
@option inputs [Array] :scopes
Optional array - A list of scopes that this authorization is in.
@option inputs [Array] :add_scopes
Optional array - A list of scop... | [
"Update",
"an",
"existing",
"authorization"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/authorizations.rb#L110-L115 |
12,582 | piotrmurach/github | lib/github_api/client/authorizations.rb | Github.Client::Authorizations.delete | def delete(*args)
raise_authentication_error unless authenticated?
arguments(args, required: [:id])
delete_request("/authorizations/#{arguments.id}", arguments.params)
end | ruby | def delete(*args)
raise_authentication_error unless authenticated?
arguments(args, required: [:id])
delete_request("/authorizations/#{arguments.id}", arguments.params)
end | [
"def",
"delete",
"(",
"*",
"args",
")",
"raise_authentication_error",
"unless",
"authenticated?",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":id",
"]",
")",
"delete_request",
"(",
"\"/authorizations/#{arguments.id}\"",
",",
"arguments",
".",
"params",
"... | Delete an authorization
@see https://developer.github.com/v3/oauth_authorizations/#delete-an-authorization
@example
github = Github.new
github.oauth.delete 'authorization-id'
@api public | [
"Delete",
"an",
"authorization"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/authorizations.rb#L127-L132 |
12,583 | piotrmurach/github | lib/github_api/client/activity/notifications.rb | Github.Client::Activity::Notifications.list | def list(*args)
arguments(args)
params = arguments.params
response = if ( (user_name = params.delete('user')) &&
(repo_name = params.delete('repo')) )
get_request("/repos/#{user_name}/#{repo_name}/notifications", params)
else
get_request('/notifications', p... | ruby | def list(*args)
arguments(args)
params = arguments.params
response = if ( (user_name = params.delete('user')) &&
(repo_name = params.delete('repo')) )
get_request("/repos/#{user_name}/#{repo_name}/notifications", params)
else
get_request('/notifications', p... | [
"def",
"list",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
")",
"params",
"=",
"arguments",
".",
"params",
"response",
"=",
"if",
"(",
"(",
"user_name",
"=",
"params",
".",
"delete",
"(",
"'user'",
")",
")",
"&&",
"(",
"repo_name",
"=",
"params"... | List your notifications
List all notifications for the current user, grouped by repository.
@see https://developer.github.com/v3/activity/notifications/#list-your-notifications
@param [Hash] params
@option params [Boolean] :all
If true, show notifications marked as read.
Default: false
@option params [Boo... | [
"List",
"your",
"notifications"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/activity/notifications.rb#L38-L50 |
12,584 | piotrmurach/github | lib/github_api/client/activity/notifications.rb | Github.Client::Activity::Notifications.mark | def mark(*args)
arguments(args)
params = arguments.params
if ( (user_name = params.delete('user')) &&
(repo_name = params.delete('repo')) )
put_request("/repos/#{user_name}/#{repo_name}/notifications", params)
elsif (thread_id = params.delete("id"))
patch_request("/n... | ruby | def mark(*args)
arguments(args)
params = arguments.params
if ( (user_name = params.delete('user')) &&
(repo_name = params.delete('repo')) )
put_request("/repos/#{user_name}/#{repo_name}/notifications", params)
elsif (thread_id = params.delete("id"))
patch_request("/n... | [
"def",
"mark",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
")",
"params",
"=",
"arguments",
".",
"params",
"if",
"(",
"(",
"user_name",
"=",
"params",
".",
"delete",
"(",
"'user'",
")",
")",
"&&",
"(",
"repo_name",
"=",
"params",
".",
"delete",
... | Mark as read
Marking a notification as “read” removes it from the default view on GitHub.com.
@see https://developer.github.com/v3/activity/notifications/#mark-as-read
@param [Hash] params
@option params [String] :last_read_at
Describes the last point that notifications were checked.
Anything updated since... | [
"Mark",
"as",
"read"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/activity/notifications.rb#L104-L117 |
12,585 | piotrmurach/github | lib/github_api/paged_request.rb | Github.PagedRequest.page_request | def page_request(path, params={})
if params[PARAM_PER_PAGE] == NOT_FOUND
params[PARAM_PER_PAGE] = default_page_size
end
if params[PARAM_PAGE] && params[PARAM_PAGE] == NOT_FOUND
params[PARAM_PAGE] = default_page
end
current_api.get_request(path, ParamsHash.new(params))
... | ruby | def page_request(path, params={})
if params[PARAM_PER_PAGE] == NOT_FOUND
params[PARAM_PER_PAGE] = default_page_size
end
if params[PARAM_PAGE] && params[PARAM_PAGE] == NOT_FOUND
params[PARAM_PAGE] = default_page
end
current_api.get_request(path, ParamsHash.new(params))
... | [
"def",
"page_request",
"(",
"path",
",",
"params",
"=",
"{",
"}",
")",
"if",
"params",
"[",
"PARAM_PER_PAGE",
"]",
"==",
"NOT_FOUND",
"params",
"[",
"PARAM_PER_PAGE",
"]",
"=",
"default_page_size",
"end",
"if",
"params",
"[",
"PARAM_PAGE",
"]",
"&&",
"para... | Perform http get request with pagination parameters | [
"Perform",
"http",
"get",
"request",
"with",
"pagination",
"parameters"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/paged_request.rb#L30-L39 |
12,586 | piotrmurach/github | lib/github_api/client/say.rb | Github.Client::Say.say | def say(*args)
params = arguments(*args).params
params[:s] = args.shift unless args.empty?
params['raw'] = true
get_request('/octocat', params)
end | ruby | def say(*args)
params = arguments(*args).params
params[:s] = args.shift unless args.empty?
params['raw'] = true
get_request('/octocat', params)
end | [
"def",
"say",
"(",
"*",
"args",
")",
"params",
"=",
"arguments",
"(",
"args",
")",
".",
"params",
"params",
"[",
":s",
"]",
"=",
"args",
".",
"shift",
"unless",
"args",
".",
"empty?",
"params",
"[",
"'raw'",
"]",
"=",
"true",
"get_request",
"(",
"'... | Generate ASCII octocat with speech bubble.
@example
Github::Client::Say.new.say "My custom string..."
@example
github = Github.new
github.octocat.say "My custom string..." | [
"Generate",
"ASCII",
"octocat",
"with",
"speech",
"bubble",
"."
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/say.rb#L17-L23 |
12,587 | piotrmurach/github | lib/github_api/response_wrapper.rb | Github.ResponseWrapper.each | def each
body_parts = self.body.respond_to?(:each) ? self.body : [self.body]
return body_parts.to_enum unless block_given?
body_parts.each { |part| yield(part) }
end | ruby | def each
body_parts = self.body.respond_to?(:each) ? self.body : [self.body]
return body_parts.to_enum unless block_given?
body_parts.each { |part| yield(part) }
end | [
"def",
"each",
"body_parts",
"=",
"self",
".",
"body",
".",
"respond_to?",
"(",
":each",
")",
"?",
"self",
".",
"body",
":",
"[",
"self",
".",
"body",
"]",
"return",
"body_parts",
".",
"to_enum",
"unless",
"block_given?",
"body_parts",
".",
"each",
"{",
... | Iterate over each resource inside the body | [
"Iterate",
"over",
"each",
"resource",
"inside",
"the",
"body"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/response_wrapper.rb#L113-L117 |
12,588 | piotrmurach/github | lib/github_api/api/actions.rb | Github.API.api_methods_in | def api_methods_in(klass)
methods = klass.send(:instance_methods, false) - [:actions]
methods.sort.each_with_object([]) do |method_name, accumulator|
unless method_name.to_s.include?('with') ||
method_name.to_s.include?('without')
accumulator << method_name
end
... | ruby | def api_methods_in(klass)
methods = klass.send(:instance_methods, false) - [:actions]
methods.sort.each_with_object([]) do |method_name, accumulator|
unless method_name.to_s.include?('with') ||
method_name.to_s.include?('without')
accumulator << method_name
end
... | [
"def",
"api_methods_in",
"(",
"klass",
")",
"methods",
"=",
"klass",
".",
"send",
"(",
":instance_methods",
",",
"false",
")",
"-",
"[",
":actions",
"]",
"methods",
".",
"sort",
".",
"each_with_object",
"(",
"[",
"]",
")",
"do",
"|",
"method_name",
",",
... | Finds api methods in a class
@param [Class] klass
The klass to inspect for methods.
@api private | [
"Finds",
"api",
"methods",
"in",
"a",
"class"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/api/actions.rb#L32-L41 |
12,589 | piotrmurach/github | lib/github_api/connection.rb | Github.Connection.default_options | def default_options(options = {})
headers = default_headers.merge(options[:headers] || {})
headers.merge!({USER_AGENT => options[:user_agent]})
{
headers: headers,
ssl: options[:ssl],
url: options[:endpoint]
}
end | ruby | def default_options(options = {})
headers = default_headers.merge(options[:headers] || {})
headers.merge!({USER_AGENT => options[:user_agent]})
{
headers: headers,
ssl: options[:ssl],
url: options[:endpoint]
}
end | [
"def",
"default_options",
"(",
"options",
"=",
"{",
"}",
")",
"headers",
"=",
"default_headers",
".",
"merge",
"(",
"options",
"[",
":headers",
"]",
"||",
"{",
"}",
")",
"headers",
".",
"merge!",
"(",
"{",
"USER_AGENT",
"=>",
"options",
"[",
":user_agent... | Create default connection options
@return [Hash[Symbol]]
the default options
@api private | [
"Create",
"default",
"connection",
"options"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/connection.rb#L41-L49 |
12,590 | piotrmurach/github | lib/github_api/connection.rb | Github.Connection.connection | def connection(api, options = {})
connection_options = default_options(options)
connection_options.merge!(builder: stack(options.merge!(api: api)))
if options[:connection_options]
connection_options.deep_merge!(options[:connection_options])
end
if ENV['DEBUG']
p "Connection... | ruby | def connection(api, options = {})
connection_options = default_options(options)
connection_options.merge!(builder: stack(options.merge!(api: api)))
if options[:connection_options]
connection_options.deep_merge!(options[:connection_options])
end
if ENV['DEBUG']
p "Connection... | [
"def",
"connection",
"(",
"api",
",",
"options",
"=",
"{",
"}",
")",
"connection_options",
"=",
"default_options",
"(",
"options",
")",
"connection_options",
".",
"merge!",
"(",
"builder",
":",
"stack",
"(",
"options",
".",
"merge!",
"(",
"api",
":",
"api"... | Creates http connection
Returns a Fraday::Connection object | [
"Creates",
"http",
"connection"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/connection.rb#L69-L80 |
12,591 | piotrmurach/github | lib/github_api/client/users/keys.rb | Github.Client::Users::Keys.update | def update(*args)
arguments(args, required: [:id]) do
permit VALID_KEY_PARAM_NAMES
end
patch_request("/user/keys/#{arguments.id}", arguments.params)
end | ruby | def update(*args)
arguments(args, required: [:id]) do
permit VALID_KEY_PARAM_NAMES
end
patch_request("/user/keys/#{arguments.id}", arguments.params)
end | [
"def",
"update",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":id",
"]",
")",
"do",
"permit",
"VALID_KEY_PARAM_NAMES",
"end",
"patch_request",
"(",
"\"/user/keys/#{arguments.id}\"",
",",
"arguments",
".",
"params",
")",
"end"
] | Update a public key for the authenticated user
@param [Hash] params
@option [String] :title
Required string
@option [String] :key
Required string. sha key
@example
github = Github.new oauth_token: '...'
github.users.keys.update 'key-id', "title": "octocat@octomac",
"key": "ssh-rsa AAA..."
@api pub... | [
"Update",
"a",
"public",
"key",
"for",
"the",
"authenticated",
"user"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/users/keys.rb#L85-L90 |
12,592 | piotrmurach/github | lib/github_api/mime_type.rb | Github.MimeType.parse | def parse(media)
version = 'v3'
media.sub!(/^[.]*|[.]*$/,"")
media = media.include?('+') ? media.split('+')[0] : media
version, media = media.split('.') if media.include?('.')
media_type = lookup_media(media)
"application/vnd.github.#{version}.#{media_type}"
end | ruby | def parse(media)
version = 'v3'
media.sub!(/^[.]*|[.]*$/,"")
media = media.include?('+') ? media.split('+')[0] : media
version, media = media.split('.') if media.include?('.')
media_type = lookup_media(media)
"application/vnd.github.#{version}.#{media_type}"
end | [
"def",
"parse",
"(",
"media",
")",
"version",
"=",
"'v3'",
"media",
".",
"sub!",
"(",
"/",
"/",
",",
"\"\"",
")",
"media",
"=",
"media",
".",
"include?",
"(",
"'+'",
")",
"?",
"media",
".",
"split",
"(",
"'+'",
")",
"[",
"0",
"]",
":",
"media",... | Parse media type param | [
"Parse",
"media",
"type",
"param"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/mime_type.rb#L17-L24 |
12,593 | piotrmurach/github | lib/github_api/client/orgs/hooks.rb | Github.Client::Orgs::Hooks.create | def create(*args)
arguments(args, required: [:org_name]) do
assert_required REQUIRED_PARAMS
end
post_request("/orgs/#{arguments.org_name}/hooks", arguments.params)
end | ruby | def create(*args)
arguments(args, required: [:org_name]) do
assert_required REQUIRED_PARAMS
end
post_request("/orgs/#{arguments.org_name}/hooks", arguments.params)
end | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":org_name",
"]",
")",
"do",
"assert_required",
"REQUIRED_PARAMS",
"end",
"post_request",
"(",
"\"/orgs/#{arguments.org_name}/hooks\"",
",",
"arguments",
".",
"params",
... | Create a hook
@see https://developer.github.com/v3/orgs/hooks/#create-a-hook
@param [Hash] params
@input params [String] :name
Required. The name of the service that is being called.
@input params [Hash] :config
Required. Key/value pairs to provide settings for this hook.
These settings vary between the ... | [
"Create",
"a",
"hook"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/orgs/hooks.rb#L97-L103 |
12,594 | piotrmurach/github | lib/github_api/client/issues/milestones.rb | Github.Client::Issues::Milestones.create | def create(*args)
arguments(args, required: [:user, :repo]) do
permit VALID_MILESTONE_INPUTS
assert_required %w[ title ]
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/milestones", arguments.params)
end | ruby | def create(*args)
arguments(args, required: [:user, :repo]) do
permit VALID_MILESTONE_INPUTS
assert_required %w[ title ]
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/milestones", arguments.params)
end | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
"]",
")",
"do",
"permit",
"VALID_MILESTONE_INPUTS",
"assert_required",
"%w[",
"title",
"]",
"end",
"post_request",
"(",
"\"/repos/#{arguments.us... | Create a milestone
@param [Hash] params
@option params [String] :title
Required string. The title of the milestone
@option params [String] :state
The state of the milestone. Either open or closed. Default: open.
@option params [String] :description
A description of the milestone
@option params [String] :... | [
"Create",
"a",
"milestone"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/issues/milestones.rb#L94-L101 |
12,595 | piotrmurach/github | lib/github_api/client/git_data/references.rb | Github.Client::GitData::References.get | def get(*args)
arguments(args, required: [:user, :repo, :ref])
validate_reference arguments.ref
params = arguments.params
get_request("/repos/#{arguments.user}/#{arguments.repo}/git/refs/#{arguments.ref}", params)
end | ruby | def get(*args)
arguments(args, required: [:user, :repo, :ref])
validate_reference arguments.ref
params = arguments.params
get_request("/repos/#{arguments.user}/#{arguments.repo}/git/refs/#{arguments.ref}", params)
end | [
"def",
"get",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":ref",
"]",
")",
"validate_reference",
"arguments",
".",
"ref",
"params",
"=",
"arguments",
".",
"params",
"get_request",
"(",
"\"/repo... | Get a reference
The ref in the URL must be formatted as <tt>heads/branch</tt>,
not just branch. For example, the call to get the data for a
branch named sc/featureA would be formatted as heads/sc/featureA
@example
github = Github.new
github.git_data.references.get 'user-name', 'repo-name', 'heads/branch'
@a... | [
"Get",
"a",
"reference"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/git_data/references.rb#L59-L65 |
12,596 | piotrmurach/github | lib/github_api/client/git_data/references.rb | Github.Client::GitData::References.create | def create(*args)
arguments(args, required: [:user, :repo]) do
permit VALID_REF_PARAM_NAMES
assert_required REQUIRED_REF_PARAMS
end
params = arguments.params
validate_reference params['ref']
post_request("/repos/#{arguments.user}/#{arguments.repo}/git/refs", params)
en... | ruby | def create(*args)
arguments(args, required: [:user, :repo]) do
permit VALID_REF_PARAM_NAMES
assert_required REQUIRED_REF_PARAMS
end
params = arguments.params
validate_reference params['ref']
post_request("/repos/#{arguments.user}/#{arguments.repo}/git/refs", params)
en... | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
"]",
")",
"do",
"permit",
"VALID_REF_PARAM_NAMES",
"assert_required",
"REQUIRED_REF_PARAMS",
"end",
"params",
"=",
"arguments",
".",
"params",
... | Create a reference
@param [Hash] params
@input params [String] :ref
The name of the fully qualified reference (ie: refs/heads/master).
If it doesn’t start with ‘refs’ and have at least two slashes,
it will be rejected.
@input params [String] :sha
The SHA1 value to set this reference to
@example
gith... | [
"Create",
"a",
"reference"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/git_data/references.rb#L85-L94 |
12,597 | piotrmurach/github | lib/github_api/client/git_data/references.rb | Github.Client::GitData::References.update | def update(*args)
arguments(args, required: [:user, :repo, :ref]) do
permit VALID_REF_PARAM_NAMES
assert_required %w[ sha ]
end
patch_request("/repos/#{arguments.user}/#{arguments.repo}/git/refs/#{arguments.ref}", arguments.params)
end | ruby | def update(*args)
arguments(args, required: [:user, :repo, :ref]) do
permit VALID_REF_PARAM_NAMES
assert_required %w[ sha ]
end
patch_request("/repos/#{arguments.user}/#{arguments.repo}/git/refs/#{arguments.ref}", arguments.params)
end | [
"def",
"update",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":ref",
"]",
")",
"do",
"permit",
"VALID_REF_PARAM_NAMES",
"assert_required",
"%w[",
"sha",
"]",
"end",
"patch_request",
"(",
"\"/repos... | Update a reference
@param [Hash] params
@input params [String] :sha
The SHA1 value to set this reference to
@input params [Boolean] :force
Indicates whether to force the update or to make sure the update
is a fast-forward update. Leaving this out or setting it to false
will make sure you’re not overwrit... | [
"Update",
"a",
"reference"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/git_data/references.rb#L113-L120 |
12,598 | piotrmurach/github | lib/github_api/client/git_data/references.rb | Github.Client::GitData::References.delete | def delete(*args)
arguments(args, required: [:user, :repo, :ref])
params = arguments.params
delete_request("/repos/#{arguments.user}/#{arguments.repo}/git/refs/#{arguments.ref}", params)
end | ruby | def delete(*args)
arguments(args, required: [:user, :repo, :ref])
params = arguments.params
delete_request("/repos/#{arguments.user}/#{arguments.repo}/git/refs/#{arguments.ref}", params)
end | [
"def",
"delete",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":ref",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"delete_request",
"(",
"\"/repos/#{arguments.user}/#{arguments.repo}/git/refs/#{... | Delete a reference
@example
github = Github.new
github.git_data.references.delete 'user-name', 'repo-name',
"heads/master"
@api public | [
"Delete",
"a",
"reference"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/git_data/references.rb#L130-L135 |
12,599 | ruby-i18n/i18n | lib/i18n/config.rb | I18n.Config.available_locales_set | def available_locales_set #:nodoc:
@@available_locales_set ||= available_locales.inject(Set.new) do |set, locale|
set << locale.to_s << locale.to_sym
end
end | ruby | def available_locales_set #:nodoc:
@@available_locales_set ||= available_locales.inject(Set.new) do |set, locale|
set << locale.to_s << locale.to_sym
end
end | [
"def",
"available_locales_set",
"#:nodoc:",
"@@available_locales_set",
"||=",
"available_locales",
".",
"inject",
"(",
"Set",
".",
"new",
")",
"do",
"|",
"set",
",",
"locale",
"|",
"set",
"<<",
"locale",
".",
"to_s",
"<<",
"locale",
".",
"to_sym",
"end",
"en... | Caches the available locales list as both strings and symbols in a Set, so
that we can have faster lookups to do the available locales enforce check. | [
"Caches",
"the",
"available",
"locales",
"list",
"as",
"both",
"strings",
"and",
"symbols",
"in",
"a",
"Set",
"so",
"that",
"we",
"can",
"have",
"faster",
"lookups",
"to",
"do",
"the",
"available",
"locales",
"enforce",
"check",
"."
] | 0c5dab494d9b043e00662d8e789229c33045c024 | https://github.com/ruby-i18n/i18n/blob/0c5dab494d9b043e00662d8e789229c33045c024/lib/i18n/config.rb#L50-L54 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.