Class: Geet::Github::Gist

Inherits:
Object
  • Object
show all
Defined in:
lib/geet/github/gist.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Gist

Returns a new instance of Gist.



21
22
23
# File 'lib/geet/github/gist.rb', line 21

def initialize(id)
  @id = id
end

Class Method Details

.create(filename, content, api_interface, description: nil, publik: false) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/geet/github/gist.rb', line 9

def self.create(filename, content, api_interface, description: nil, publik: false)
  api_path = '/gists'

  request_data = prepare_request_data(filename, content, description, publik)

  response = api_interface.send_request(api_path, data: request_data)

  id = response.fetch('id')

  new(id)
end

Instance Method Details



25
26
27
# File 'lib/geet/github/gist.rb', line 25

def link
  "https://gist.github.com/#{@id}"
end