Sha256: 1ef8299e85b08ff80f6c7c2e0017762f31c6c85df58d7c774b5b3b2b39313ddb
Contents?: true
Size: 941 Bytes
Versions: 1
Compression:
Stored size: 941 Bytes
Contents
require 'multi_json' module Sellsy class CustomField attr_accessor :id, :value def initialize(id, value) @id = id @value = value end def self.set_values(entity, *custom_fields) command = { 'method' => 'CustomFields.recordValues', 'params' => { 'linkedtype' => linked_type(entity), 'linkedid' => entity.id, 'values' => custom_fields.select {|cf| !cf.value.blank?}.map {|cf| {'cfid' => cf.id, 'value' => cf.value}} } } response = MultiJson.load(Sellsy::Api.request command) response['status'] == 'success' end def self.linked_type(entity) case entity when Customer 'client' when Prospect 'prospect' when Opportunity 'opportunity' when Contact 'people' when Document 'document' else nil end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sellsy-client-0.2.0 | lib/sellsy/custom_field.rb |