Sha256: 1e3a452773d2abe5de1d6d06a5015ad646d4483c637bc11112fc6299d006449f
Contents?: true
Size: 638 Bytes
Versions: 1
Compression:
Stored size: 638 Bytes
Contents
# frozen_string_literal: true module LightspeedRestaurantClient module Operations module Create def create(attributes, configuration = nil) response = LightspeedRestaurantClient.post(resource_path, attributes, {}, configuration) payload = build_payload(attributes, response) return new(payload) if is_a?(Class) self.class.new(payload) end private def build_payload(attributes, response) JSON.parse(response) rescue JSON::ParserError => error raise error if response.to_i.zero? attributes.merge!(id: response.to_i) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lightspeed_restaurant-3.0.0 | lib/lightspeed_restaurant/operations/create.rb |