Sha256: b3ca9011c09352863b2ba7db2be175aeff38a0462bef1d1b4d91ab66572c3cd1
Contents?: true
Size: 794 Bytes
Versions: 1
Compression:
Stored size: 794 Bytes
Contents
# frozen_string_literal: true require 'octokit' module GistUpdater class Content attr_reader :name def initialize(user:, access_token:, gist_id:, file_name:) @client = Octokit::Client.new( login: user, access_token: access_token ) @gist_id = gist_id @name = file_name @basename = File.basename(file_name) end def gist @gist ||= client.gist(gist_id).files[basename].content end def local @local ||= File.read(name) end def update result = client.edit_gist( gist_id, files: { basename => { 'content' => local } } ) puts "Updated `#{name}` to #{result.html_url}" result end private attr_reader :client, :gist_id, :basename end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gist_updater-0.1.0 | lib/gist_updater/content.rb |