Sha256: 0783114bc06041bd6db3a7bbbdedbc8cc0b6f0eec100b504d1417821490688f8

Contents?: true

Size: 700 Bytes

Versions: 1

Compression:

Stored size: 700 Bytes

Contents

require 'json'
require 'yaml'
require_relative '../net_http_adapter'
require_relative './user_config'

module Github
  class Client
    def initialize(config = UserConfig.new, network = GistDoIt::NetHTTPAdapter.new)
      @config = config
      @network = network
    end

    def create_gist(gist)
      @data = gist.to_json
      uri = URI("https://api.github.com/gists")
      @response = @network.post_with_token(token, uri, @data)
    end

    def has_github_username?
      @config.has_github_username?
    end

    def github_username=(username)
      @config.set_github_username(username)
    end

    def response
      @response
    end

    def token
      @config.token
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gistdoit-0.0.1 lib/gistdoit/github/client.rb