Class: Gist

Inherits:
Thor
  • Object
show all
Includes:
Gitius::Helpers
Defined in:
lib/gitius/gist.rb

Instance Method Summary collapse

Methods included from Gitius::Helpers

#change_config, #client, #get_config, #repo, #token, #user

Instance Method Details

#create(*paths) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/gitius/gist.rb', line 7

def create(*paths)
  paths.each do |f|
    options['files'] = { File.basename(f) => { 'content' => File.read(f).to_s } }
  end
  response = client.create_gist(options)
  puts response.html_url
rescue StandardError => e
  puts e.message
end

#delete(id) ⇒ Object



18
19
20
21
22
23
# File 'lib/gitius/gist.rb', line 18

def delete(id)
  response = client.delete_gist(id)
  puts response ? 'gist deleted' : 'error'
rescue StandardError => e
  puts e.message
end