Closed jamesdabbs closed 8 years ago
require "httparty" require "pry" require "./token"
# #
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 #
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" )
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
Write (and run) a ruby script that
You'll probably want to use
File.read __FILE__
for the script to read its own contents.