Class: Github::Client
- Inherits:
-
Object
- Object
- Github::Client
- Defined in:
- lib/gistdoit/github/client.rb
Instance Method Summary collapse
- #create_gist(gist) ⇒ Object
- #github_username=(username) ⇒ Object
- #has_github_username? ⇒ Boolean
-
#initialize(config = UserConfig.new, network = GistDoIt::NetHTTPAdapter.new) ⇒ Client
constructor
A new instance of Client.
- #response ⇒ Object
- #token ⇒ Object
Constructor Details
#initialize(config = UserConfig.new, network = GistDoIt::NetHTTPAdapter.new) ⇒ Client
Returns a new instance of Client.
8 9 10 11 |
# File 'lib/gistdoit/github/client.rb', line 8 def initialize(config = UserConfig.new, network = GistDoIt::NetHTTPAdapter.new) @config = config @network = network end |
Instance Method Details
#create_gist(gist) ⇒ Object
13 14 15 16 17 |
# File 'lib/gistdoit/github/client.rb', line 13 def create_gist(gist) @data = gist.to_json uri = URI("https://api.github.com/gists") @response = @network.post_with_token(token, uri, @data) end |
#github_username=(username) ⇒ Object
23 24 25 |
# File 'lib/gistdoit/github/client.rb', line 23 def github_username=(username) @config.set_github_username(username) end |
#has_github_username? ⇒ Boolean
19 20 21 |
# File 'lib/gistdoit/github/client.rb', line 19 def has_github_username? @config.has_github_username? end |
#response ⇒ Object
27 28 29 |
# File 'lib/gistdoit/github/client.rb', line 27 def response @response end |
#token ⇒ Object
31 32 33 |
# File 'lib/gistdoit/github/client.rb', line 31 def token @config.token end |