module Postmen::CollectionProxy::ClassMethods
This module holds all class-level methods
Attributes
settings[R]
Settings hash. Used in model/key methods.
Public Instance Methods
get(response)
click to toggle source
Wraps raw JSON response into an model
@param response [Hash] parsed JSON response @return model an instance of
# File lib/postmen/collection_proxy.rb, line 36 def get(response) model.new(response[:data]) end
key(key = nil)
click to toggle source
Sets (if argument is provides) or gets the key where the data is being searched in the API response.
@see docs.postmen.com/#data API documentation @return [Symbol] key name
# File lib/postmen/collection_proxy.rb, line 27 def key(key = nil) return settings[:key] unless key settings[:key] = key end
model(model = nil)
click to toggle source
Sets (if argument is provided) or gets the model class name
@return [Class] Model name, eg. `Label`
# File lib/postmen/collection_proxy.rb, line 17 def model(model = nil) return settings[:model] unless model settings[:model] = model end