tiyd-ror-2016-06 / class-notes

The Fightin' Aardwolves
0 stars 0 forks source link

Close this #8

Closed jamesdabbs closed 8 years ago

jamesdabbs commented 8 years ago

Write (and run) a ruby script that

You'll probably want to use File.read __FILE__ for the script to read its own contents.

vegajdr commented 8 years ago

require "httparty" require "pry" require "./token"

def get_repos page_number

HTTParty.get(

"https://api.github.com/users/jamesdabbs/repos?page=#{page_number}",

query: {

page: 2

},

headers: {

"Authorization" => "token #{Token}",

"User-Agent" => "microsoft wandows"

}

)

# #

end

body = { state: "closed" }.to_json

s = HTTParty.patch( "https://api.github.com/repos/jamesdabbs/class-notes/issues/7", headers: { "Authorization" => "token #{Token}", "User-Agent" => "Microsoft Windows" }, body: body

)

a = (File.read FILE)

comment = { body: a }.to_json

c = HTTParty.post( "https://api.github.com/repos/jamesdabbs/class-notes/issues/8/comments", headers: { "Authorization" => "token #{Token}", "User-Agent" => "Microsoft Windows" }, body: comment )

puts c #

puts c

ptMcGit commented 8 years ago

Close this issue... (maybe?) require 'httparty' require 'pry'

require './token'

this_file = File.read FILE

Url = "https://api.github.com/"

def comment_on_issue owner, repo, issue_no, comment http_path = File.join( Url, "repos", owner, repo, "issues", issue_no.to_s, "comments" )

POST /repos/:owner/:repo/issues/:number/comments

body = { "body"=> comment }.to_json HTTParty.post( http_path, headers: { "Authorization" => "token #{Token}", "User-Agent" => "ruffus 2.0" }, body: body ) end

owner = "tiyd-ror-2016-06" repo = "class-notes"

response = comment_on_issue(owner, repo, 8, "Close this issue... (maybe?)\n" + this_file)

binding.pry

get appropriate issue number

issue 8

create a comment

{ "body": "Close this issue." + this_file