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.56 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.55 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.54 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.53 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.52 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.51 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.50 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.49 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.48 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.47 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.46 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.45 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.44 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.43 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.42 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.41 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.40 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.39 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.38 lib/zoho_hub/records/adverse_criteria.rb
zoho_hub-0.1.37 lib/zoho_hub/records/adverse_criteria.rb