tiyd-ror-2016-06 / class-notes

The Fightin' Aardwolves
0 stars 0 forks source link

Close this #7

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/7/comments", headers: { "Authorization" => "token #{Token}", "User-Agent" => "Microsoft Windows" }, body: comment )

puts c #

puts c