Class: Kintone::Api::Guest

Inherits:
Object show all
Extended by:
Forwardable
Defined in:
lib/kintone/api/guest.rb

Defined Under Namespace

Classes: CommandAccessor

Constant Summary collapse

GUEST_PATH =
'/k/guest/%s/v1/'.freeze
ACCESSIBLE_COMMAND =
[
  :record, :records, :form, :app_acl, :record_acl,
  :field_acl, :space, :space_body, :space_thread, :space_members,
  :space_guests, :app, :apps, :bulk_request, :bulk,
  :file, :preview_form
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(space_id, api) ⇒ Guest

Returns a new instance of Guest.



18
19
20
21
# File 'lib/kintone/api/guest.rb', line 18

def initialize(space_id, api)
  @api = api
  @guest_path = GUEST_PATH % space_id.to_i
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/kintone/api/guest.rb', line 27

def method_missing(name, *args)
  if ACCESSIBLE_COMMAND.include?(name)
    CommandAccessor.send(name, self)
  else
    super
  end
end

Instance Method Details

#get_url(command) ⇒ Object



23
24
25
# File 'lib/kintone/api/guest.rb', line 23

def get_url(command)
  @guest_path + (COMMAND % command)
end

#respond_to_missing?(name, *args) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/kintone/api/guest.rb', line 35

def respond_to_missing?(name, *args)
  ACCESSIBLE_COMMAND.include?(name) || super
end