Class: ShotgunApiRuby::ServerInfo
- Inherits:
-
Object
- Object
- ShotgunApiRuby::ServerInfo
- Defined in:
- lib/shotgun_api_ruby/server_info.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(connection) ⇒ ServerInfo
constructor
A new instance of ServerInfo.
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
#connection ⇒ Object (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
#get ⇒ Object
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 |