Sha256: 4f2fe4a0f2576ca2965e3b1caddd7bff4f4b38a6a739ac9076e5ba327608c1a2

Contents?: true

Size: 640 Bytes

Versions: 4

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

module ShotgridApiRuby
  class Preferences
    def initialize(connection)
      @connection = connection.dup
      @connection.url_prefix = "#{@connection.url_prefix}/preferences"
    end

    attr_reader :connection

    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
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shotgrid_api_ruby-0.1.3.3 lib/shotgrid_api_ruby/preferences.rb
shotgrid_api_ruby-0.1.3.2 lib/shotgrid_api_ruby/preferences.rb
shotgrid_api_ruby-0.1.3.1 lib/shotgrid_api_ruby/preferences.rb
shotgrid_api_ruby-0.1.3 lib/shotgrid_api_ruby/preferences.rb