Sha256: 5aefc55253487ec76f83a253e5c84398361ebc35f4adab32004fd57c06b10367

Contents?: true

Size: 751 Bytes

Versions: 4

Compression:

Stored size: 751 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module ShotgridApiRuby
  class ServerInfo
    extend T::Sig

    sig { params(connection: Faraday::Connection).void }
    def initialize(connection)
      @connection = T.let(connection, Faraday::Connection)
    end

    sig { returns(Faraday::Connection) }
    attr_reader :connection

    sig { returns(OpenStruct) }
    def get
      resp = @connection.get
      resp_body = JSON.parse(resp.body)

      if resp.status >= 300
        raise ShotgridCallError.new(
                response: resp,
                message:
                  "Error while getting server infos: #{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.2.0.6 lib/shotgrid_api_ruby/server_info.rb
shotgrid_api_ruby-0.2.0.5 lib/shotgrid_api_ruby/server_info.rb
shotgrid_api_ruby-0.2.0.4 lib/shotgrid_api_ruby/server_info.rb
shotgrid_api_ruby-0.2.0.1 lib/shotgrid_api_ruby/server_info.rb