Class: ShotgunApiRuby::ServerInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/shotgun_api_ruby/server_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ ServerInfo

Returns a new instance of ServerInfo.



5
6
7
# File 'lib/shotgun_api_ruby/server_info.rb', line 5

def initialize(connection)
  @connection = connection
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



9
10
11
# File 'lib/shotgun_api_ruby/server_info.rb', line 9

def connection
  @connection
end

Instance Method Details

#getObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/shotgun_api_ruby/server_info.rb', line 11

def get
  resp = @connection.get
  resp_body = JSON.parse(resp.body)

  if resp.status >= 300
    raise "Error while getting server infos: #{resp_body['errors']}"
  end

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