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
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(space_id, api) ⇒ Guest

Returns a new instance of Guest.



31
32
33
34
# File 'lib/kintone/api/guest.rb', line 31

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/kintone/api/guest.rb', line 40

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



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

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

#respond_to_missing?(name, *args) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/kintone/api/guest.rb', line 48

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