Module: ChartMogul::API::Actions::Create::ClassMethods
- Defined in:
- lib/chartmogul/api/actions/create.rb
Instance Method Summary collapse
Instance Method Details
#create!(attributes = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/chartmogul/api/actions/create.rb', line 22 def create!(attributes = {}) resource = new(attributes) resp = handling_errors do connection.post(resource_path.apply(attributes)) do |req| req.headers['Content-Type'] = 'application/json' req.body = JSON.dump(resource.serialize_for_write) end end json = ChartMogul::Utils::JSONParser.parse(resp.body) new_from_json(json) end |