Module: Flexirest::JsonAPIProxy::Request::Params
Overview
Creating and formatting JSON API parameters
Defined Under Namespace
Classes: Parameters
Instance Method Summary collapse
Methods included from Helpers
Instance Method Details
#create(params, object) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/flexirest/json_api_proxy.rb', line 37 def create(params, object) # Create a parameters object with the resource's type value and id parameters = Parameters.new(object.id, type(object)) # Remove id attribute from top-level hash, this will be included # in the resource object params.delete(:id) # Build the JSON API compliant parameters parameters.create_from_hash(params) # Return the parameters as a hash, so it can be used elsewhere parameters.to_hash end |
#translate(params, include_associations) ⇒ Object
52 53 54 55 |
# File 'lib/flexirest/json_api_proxy.rb', line 52 def translate(params, include_associations) # Format the linked resources array, and assign to include key params[:include] = format_include_params(include_associations) if include_associations.present? end |