class Google::Directory::Schema

Constants

Field

Public Instance Methods

get(key) click to toggle source
# File lib/google/directory/schema.rb, line 27
def get(key)
  client.execute!(api_method: schema_api.get,
                  parameters: default_query.merge(schemaKey: key)).data
end
insert(key, fields) click to toggle source
# File lib/google/directory/schema.rb, line 7
def insert(key, fields)
  body = schema_api.insert.request_schema.new
  body.fields = fields.map(&:to_google_field)
  body.schema_name = key

  client.execute!(api_method: schema_api.insert,
                  body_object: body,
                  parameters: default_query)
end
update(key, fields) click to toggle source
# File lib/google/directory/schema.rb, line 17
def update(key, fields)
  body = schema_api.update.request_schema.new
  body.fields = fields.map(&:to_google_field)
  body.schema_name = key

  client.execute!(api_method: schema_api.update,
                  body_object: body,
                  parameters: default_query.merge(schemaKey: key))
end

Private Instance Methods

schema_api() click to toggle source
# File lib/google/directory/schema.rb, line 34
def schema_api
  @schema ||= directory_api.discovered_resources.find { |resource| resource.name == "schemas" }
end