Class: ShotgunApiRuby::Preferences
- Inherits:
-
Object
- Object
- ShotgunApiRuby::Preferences
- Defined in:
- lib/shotgun_api_ruby/preferences.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #all ⇒ Object
-
#initialize(connection) ⇒ Preferences
constructor
A new instance of Preferences.
Constructor Details
#initialize(connection) ⇒ Preferences
Returns a new instance of Preferences.
5 6 7 8 |
# File 'lib/shotgun_api_ruby/preferences.rb', line 5 def initialize(connection) @connection = connection.dup @connection.url_prefix = "#{@connection.url_prefix}/preferences" end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
10 11 12 |
# File 'lib/shotgun_api_ruby/preferences.rb', line 10 def connection @connection end |
Instance Method Details
#all ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/shotgun_api_ruby/preferences.rb', line 12 def all resp = @connection.get resp_body = JSON.parse(resp.body) if resp.status >= 300 raise "Error while getting server preferences: #{resp_body['errors']}" end data = resp_body['data'] OpenStruct.new(data) end |