class Desertcart::Operation::Update

Private Instance Methods

fail(status) click to toggle source
# File lib/desertcart/operation/update.rb, line 37
def fail(status)
  failure(
    LedgerSync::Error::OperationError.new(
      operation: self,
      response: response,
      message: "Status code: #{status}"
    ),
    resource: @resource
  )
end
operate() click to toggle source
# File lib/desertcart/operation/update.rb, line 18
def operate
  update_in_ledger
    .and_then { success }
end
response() click to toggle source
# File lib/desertcart/operation/update.rb, line 23
def response
  @response ||= client.update(
    body: serializer.serialize(resource: resource),
    path: ledger_resource_path
  )
end
success() click to toggle source
Calls superclass method
# File lib/desertcart/operation/update.rb, line 30
def success
  super(
    resource: deserialized_resource,
    response: response
  )
end
update_in_ledger() click to toggle source
# File lib/desertcart/operation/update.rb, line 12
def update_in_ledger
  return LedgerSync::Result.Success(response) if response.success?

  fail(response.status)
end