Sha256: 2e106490118e0f212f8db1b917da10cf94186f49b6c4852133c650323eeed616
Contents?: true
Size: 1.01 KB
Versions: 31
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true require_relative 'abstract_issue' require_relative '../github/gist' module Geet module Github class Gist 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 def initialize(id) @id = id end def link "https://gist.github.com/#{@id}" end class << self private def prepare_request_data(filename, content, description, publik) request_data = { 'public' => publik, 'files' => { filename => { 'content' => content } } } request_data['description'] = description if description request_data end end end end end
Version data entries
31 entries across 31 versions & 1 rubygems