Class: Ghee::API::Gists::Proxy

Inherits:
ResourceProxy show all
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

Methods included from CUD

#create, #destroy, #patch

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

#publicObject

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

#starObject

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

#starredObject

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

Returns:

  • (Boolean)


40
41
42
# File 'lib/ghee/api/gists.rb', line 40

def starred?
  connection.get("#{path_prefix}/star").status == 204
end

#unstarObject

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