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.



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

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



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

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



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

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

#respond_to_missing?(name, *args) ⇒ Boolean

Returns:

  • (Boolean)


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

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