Class: Ghee::API::Gists::Proxy
- Inherits:
-
ResourceProxy
- Object
- ResourceProxy
- Ghee::API::Gists::Proxy
- Includes:
- CUD
- Defined in:
- lib/ghee/api/gists.rb
Overview
Gists::Proxy inherits from Ghee::Proxy and enables defining methods on the proxy object
Instance Attribute Summary
Attributes inherited from ResourceProxy
#connection, #current_page, #pagination, #params, #path_prefix, #total
Instance Method Summary collapse
-
#public ⇒ Object
Get public gists.
-
#star ⇒ Object
Star a gist.
-
#starred ⇒ Object
Get starred gists.
-
#starred? ⇒ Boolean
Returns whether gist is starred.
-
#unstar ⇒ Object
Unstar a gist.
Methods included from CUD
Methods inherited from ResourceProxy
#all, #initialize, #method_missing, #paginate, #subject
Constructor Details
This class inherits a constructor from Ghee::ResourceProxy
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Ghee::ResourceProxy
Instance Method Details
#public ⇒ Object
Get public gists
Returns json
48 49 50 |
# File 'lib/ghee/api/gists.rb', line 48 def public connection.get("#{path_prefix}/public").body end |
#star ⇒ Object
Star a gist
Returns true/false
24 25 26 |
# File 'lib/ghee/api/gists.rb', line 24 def star connection.put("#{path_prefix}/star").status == 204 end |
#starred ⇒ Object
Get starred gists
Returns json
56 57 58 |
# File 'lib/ghee/api/gists.rb', line 56 def starred connection.get("#{path_prefix}/starred").body end |
#starred? ⇒ Boolean
Returns whether gist is starred
Returns true/false
40 41 42 |
# File 'lib/ghee/api/gists.rb', line 40 def starred? connection.get("#{path_prefix}/star").status == 204 end |
#unstar ⇒ Object
Unstar a gist
Returns true/false
32 33 34 |
# File 'lib/ghee/api/gists.rb', line 32 def unstar connection.delete("#{path_prefix}/star").status == 204 end |