Sha256: bd0688a1b5096650205b975798a3005219b5589c37bd70c877cd5501cc3eb2ef

Contents?: true

Size: 524 Bytes

Versions: 2

Compression:

Stored size: 524 Bytes

Contents

# frozen_string_literal: true

module ShotgunApiRuby
  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 "Error while getting server preferences: #{resp_body['errors']}"
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shotgun_api_ruby-0.1.1 lib/shotgun_api_ruby/preferences.rb
shotgun_api_ruby-0.1.0.1 lib/shotgun_api_ruby/preferences.rb