Files

47 lines
1.2 KiB
Ruby

# frozen_string_literal: true
module Fiken
module Resources
# /companies/{slug}/contacts and nested contact persons.
class Contacts < Resource::Base
include Resource::Listable
include Resource::Findable
include Resource::Creatable
include Resource::Updatable # PUT
include Resource::Deletable
include Resource::Attachable
def resource_path
"contacts"
end
# Contacts only support uploading attachments, not listing them.
def attachments_listable?
false
end
def contact_persons(contact_id)
ContactPersons.new(client, company_slug, "#{base_path}/#{contact_id}")
end
end
# /companies/{slug}/contacts/{id}/contactPerson
class ContactPersons < Resource::Base
include Resource::Listable
include Resource::Findable
include Resource::Creatable
include Resource::Updatable # PUT
include Resource::Deletable
def initialize(client, company_slug, parent_path)
super(client, company_slug)
@parent_path = parent_path
end
def base_path
"#{@parent_path}/contactPerson"
end
end
end
end