Class: Geet::Github::Gist
- Inherits:
-
Object
- Object
- Geet::Github::Gist
- Extended by:
- T::Sig
- Defined in:
- lib/geet/github/gist.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id) ⇒ Gist
constructor
A new instance of Gist.
- #link ⇒ Object
Constructor Details
#initialize(id) ⇒ Gist
Returns a new instance of Gist.
34 35 36 |
# File 'lib/geet/github/gist.rb', line 34 def initialize(id) @id = id end |
Class Method Details
.create(filename, content, api_interface, description: nil, publik: false) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/geet/github/gist.rb', line 21 def self.create(filename, content, api_interface, description: nil, publik: false) api_path = "/gists" request_data = prepare_request_data(filename, content, description, publik) response = T.cast(api_interface.send_request(api_path, data: T.unsafe(request_data)), T::Hash[String, T.untyped]) id = T.cast(response.fetch("id"), String) new(id) end |
Instance Method Details
#link ⇒ Object
39 40 41 |
# File 'lib/geet/github/gist.rb', line 39 def link "https://gist.github.com/#{@id}" end |