Sha256: 73a0894aca5c618f0bd2e53f92d057fc30258a5c2eca788512135e2de7109655
Contents?: true
Size: 585 Bytes
Versions: 1
Compression:
Stored size: 585 Bytes
Contents
require 'rest-client' module Github class Client DEFAULT_OPTIONS = { access_token: nil, } attr_accessor :options def initialize(options={}) store_options options check_token end def access_token @options[:access_token] end def user RestClient.get("https://api.github.com/user", {params: {:access_token => self.access_token}}) end private def store_options(options) @options ||= DEFAULT_OPTIONS.dup @options.merge!(options) end def check_token raise ArgumentError, "No access token provided" if !access_token end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
git-layer-0.1.0 | lib/github/client.rb |