Sha256: 7b1c48af309a5c736678656d6f47cbb919870e41f4bca0eb09449b684dbddbf0

Contents?: true

Size: 1 KB

Versions: 30

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require 'zoho_hub/records/base_record'

module ZohoHub
  class AdverseCriteria < BaseRecord
    request_path 'Adverse_Criteria'

    attributes :id, :account_id, :date_decided, :date_paid
    attributes :status, :amount, :currency, :court
    attributes :case_reference, :entity_details, :data_source

    attribute_translation(
      id: :id,
      case_reference: :Name,
      status: :CCJ_Status,
      amount: :CCJ_Amount,
      data_source: :CCJ_Data_Source,
      date_paid: :Date_paid,
      date_decided: :Date_decided,
      entity_details: :Entity_details
    )

    def initialize(params)
      attributes.each do |attr|
        zoho_key = attr_to_zoho_key(attr)

        send("#{attr}=", params[zoho_key] || params[attr])
      end

      # Setup values as they come from the Zoho API if needed
      @account_id ||= params.dig(:Account, :id)
    end

    def to_params
      params = super

      params[:Account] = { id: @account_id } if @account_id

      params
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
zoho_hub-0.1.36 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.35 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.34 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.33 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.32 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.30 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.29 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.28 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.27 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.26 lib/zoho_hub/records/adverse_criteria.rb