Sha256: cbd6582b8413f540dbaa534f04cc6612e83c99f8bc5777cc6bb0b87b7766fc82
Contents?: true
Size: 718 Bytes
Versions: 12
Compression:
Stored size: 718 Bytes
Contents
# frozen_string_literal: true module ZohoHub class Vendor < BaseRecord attributes :id, :email, :description, :vendor_name, :website, :owner_id, :phone, :currency attributes :company_reg_no, :created_time, :modified_time, :lender_status attribute_translation( id: :id ) DEFAULTS = { currency: 'GBP' }.freeze def initialize(params) attributes.each do |attr| zoho_key = attr_to_zoho_key(attr) send("#{attr}=", params[zoho_key] || params[attr] || DEFAULTS[attr]) end @owner_id ||= params.dig(:Owner, :id) end def to_params params = super params[:Owner] = { id: @owner_id } if @owner_id params end end end
Version data entries
12 entries across 12 versions & 1 rubygems