Add resource definitions for all 22 API tags, wire client accessors and require tree
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user