class ShotgridApiRuby::Preferences

Attributes

connection[R]

Public Class Methods

new(connection) click to toggle source
# File lib/shotgrid_api_ruby/preferences.rb, line 5
def initialize(connection)
  @connection = connection.dup
  @connection.url_prefix = "#{@connection.url_prefix}/preferences"
end

Public Instance Methods

all() click to toggle source
# File lib/shotgrid_api_ruby/preferences.rb, line 12
def all
  resp = @connection.get
  resp_body = JSON.parse(resp.body)

  if resp.status >= 300
    raise ShotgridCallError.new(
            response: resp,
            message:
              "Error while getting server preferences: #{resp_body['errors']}",
          )
  end

  data = resp_body['data']
  OpenStruct.new(data)
end