Sha256: b0377e9a648a2117e8aa7adf181619d472692555de41a8f65162498f571e48dd
Contents?: true
Size: 1.27 KB
Versions: 7
Compression:
Stored size: 1.27 KB
Contents
# encoding: utf-8 module Github # When you create a new GitHub repository via the API, you can specify a # .gitignore template to apply to the repository upon creation. class Gitignore < API # List all templates available to pass as an option when creating a repository. # # = Examples # github = Github.new # github.gitignore.list # github.gitignore.list { |template| ... } # def list(*args) arguments(args) response = get_request("/gitignore/templates", arguments.params) return response unless block_given? response.each { |el| yield el } end alias :all :list # Get a single template # # = Examples # github = Github.new # github.gitignore.get "template-name" # # Use the raw media type to get the raw contents. # # = Examples # github = Github.new # github.gitignore.get "template-name", mime: 'applicatin/vnd.github.raw' # def get(*args) params = arguments(args, :required => [:name]).params if (mime_type = params.delete('mime')) options = { :raw => true, :headers => {'Accept' => mime_type} } end get_request("/gitignore/templates/#{name}", params, options || {}) end alias :find :get end # Gitignore end # Github
Version data entries
7 entries across 7 versions & 1 rubygems