Method: ApiResource::Resource#submit!

Defined in:
lib/api-resource/resource.rb

#submit!(options = {}) ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/api-resource/resource.rb', line 111

def submit!(options={})
  path = options.fetch(:path, resource_path)
  type = options[:type]
  json = submit_resource(path, false, options[:id_attr])
  meta = json && json['meta']
  type ||= meta && meta['type']
  if type
    returned_type = self.class.load_class(type)
    returned_type.new(json['data'] || json, raw_result)
  else
    self
  end
end