Module: Glassfrog::REST::Get
- Defined in:
- lib/glassfrog/rest/get.rb
Overview
Encapsulates all GET requests.
Class Method Summary collapse
-
.get(client, path, options) ⇒ Array<Hash>
Sends a GET request.
-
.irregular_get(client, type, path, options) ⇒ Array<Hash>
Handles GET requests for objects that do not have a native get with ID method on GlassFrog.
Class Method Details
.get(client, path, options) ⇒ Array<Hash>
Sends a GET request.
16 17 18 19 |
# File 'lib/glassfrog/rest/get.rb', line 16 def self.get(client, path, ) path = [:id] ? path + '/' + .delete(:id).to_s : path Glassfrog::REST::Request.new(client, :get, path, ).perform end |
.irregular_get(client, type, path, options) ⇒ Array<Hash>
Handles GET requests for objects that do not have a native get with ID method on GlassFrog.
29 30 31 32 33 34 35 36 37 |
# File 'lib/glassfrog/rest/get.rb', line 29 def self.irregular_get(client, type, path, ) if .is_a?(Hash) && [:id] response = get(client, path, {}) if response[type] then response[type].select! { |object| object[:id] == [:id] } end else response = get(client, path, ) end response end |