Class: ShotgridApiRuby::ServerInfo
- Inherits:
-
Object
- Object
- ShotgridApiRuby::ServerInfo
- Extended by:
- T::Sig
- Defined in:
- lib/shotgrid_api_ruby/server_info.rb
Instance Attribute Summary collapse
- #connection ⇒ Faraday::Connection readonly
Instance Method Summary collapse
- #get ⇒ OpenStruct
- #initialize(connection) ⇒ void constructor
Constructor Details
#initialize(connection) ⇒ void
9 10 11 |
# File 'lib/shotgrid_api_ruby/server_info.rb', line 9 def initialize(connection) @connection = T.let(connection, Faraday::Connection) end |
Instance Attribute Details
#connection ⇒ Faraday::Connection (readonly)
14 15 16 |
# File 'lib/shotgrid_api_ruby/server_info.rb', line 14 def connection @connection end |
Instance Method Details
#get ⇒ OpenStruct
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/shotgrid_api_ruby/server_info.rb', line 17 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 |