Class: ShotgridApiRuby::Preferences
- Inherits:
-
Object
- Object
- ShotgridApiRuby::Preferences
- Extended by:
- T::Sig
- Defined in:
- lib/shotgrid_api_ruby/preferences.rb
Instance Attribute Summary collapse
- #connection ⇒ Faraday::Connection readonly
Instance Method Summary collapse
- #all ⇒ OpenStruct
- #initialize(connection) ⇒ void constructor
Constructor Details
#initialize(connection) ⇒ void
9 10 11 12 |
# File 'lib/shotgrid_api_ruby/preferences.rb', line 9 def initialize(connection) @connection = T.let(connection.dup, Faraday::Connection) @connection.url_prefix = "#{@connection.url_prefix}/preferences" end |
Instance Attribute Details
#connection ⇒ Faraday::Connection (readonly)
15 16 17 |
# File 'lib/shotgrid_api_ruby/preferences.rb', line 15 def connection @connection end |
Instance Method Details
#all ⇒ OpenStruct
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/shotgrid_api_ruby/preferences.rb', line 18 def all resp = @connection.get resp_body = JSON.parse(resp.body) if resp.status >= 300 raise ShotgridCallError.new( response: resp, message: "Error while getting server preferences: #{resp_body['errors']}", ) end data = resp_body['data'] OpenStruct.new(data) end |