shotgun_api_ruby 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2163b85f62993d2674a47792d3370ebcbf1a6c283e915c781bc27801868a172
4
- data.tar.gz: e26ff2d7d7beae08aaa041f893bbb0f46eb44bd305313d576c2407a99a5e4123
3
+ metadata.gz: 010e99c46e52c21872edf3bb9c2a431a5382dc3129f087b2d362dac09bc9e644
4
+ data.tar.gz: fe83680e545108fb0e2687880801fc3b72316d6388d9af84e5015aa21abc9fdf
5
5
  SHA512:
6
- metadata.gz: 5956601d851995c92204f03541b5c5e7e07a428df8170884d976b01388b1acfe4022d5781cea92510d6ef83e99ef25c5caa983b02a7d602267970afa3caf889f
7
- data.tar.gz: 33c191b51f8ea193eedb15f5655b51d453173c41e86c0da1f8540e5d08c396e04522aa89fd8f66ea286ccf3d6df6bf3a28df4ddff6e5f77264cb1038bc6f1278
6
+ metadata.gz: 8c1f113a1fb94eed3b99bbfec633986f3e10208ae832b7756f825b2c3fce2163a255ab6747be704b8d2002dc980794028350c7d5176e34a30690be5d0f6596ef
7
+ data.tar.gz: 4cd377272e301f26ed52179bf6240ecdf74437d43c2461681053e67ee1f34899793ceef16adf029f2d4baad8490e4ef8ace9fcac8f379a4359fd29232bc7c560
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shotgun_api_ruby (0.0.1)
4
+ shotgun_api_ruby (0.0.2)
5
5
  activesupport
6
6
  faraday (~> 0.17)
7
7
  zeitwerk (~> 2.2)
data/README.md CHANGED
@@ -67,6 +67,48 @@ client = ShotgunApiRuby.new(shotgun_site: 'xxx', auth: {session_token: 'session_
67
67
  client = ShotgunApiRuby.new(shotgun_site: 'xxx', auth: {refresh_token: 'refresh_token'})
68
68
  ```
69
69
 
70
+ ### Server Infos
71
+
72
+ Get general server infos:
73
+
74
+ ```ruby
75
+ client.server_info.get
76
+
77
+ # #<OpenStruct
78
+ shotgun_version="v8.6.0.0-dev (build 12864de)",
79
+ api_version="v1",
80
+ shotgun_version_number="8.6.0.0-dev",
81
+ shotgun_build_number="12864de",
82
+ portfolio_version="UNKNOWN",
83
+ unified_login_flow_enabled=true,
84
+ user_authentication_method="default">
85
+ ```
86
+
87
+ ### Preferences
88
+
89
+ Get some preferences infos:
90
+
91
+ ```ruby
92
+ prefs = client.preferences.get
93
+ prefs.to_h.keys
94
+
95
+ # [:format_date_fields,
96
+ # :date_component_order,
97
+ # :format_time_hour_fields,
98
+ # :format_currency_fields_display_dollar_sign,
99
+ # :format_currency_fields_decimal_options,
100
+ # :format_currency_fields_negative_options,
101
+ # :format_number_fields,
102
+ # :format_float_fields,
103
+ # :format_float_fields_rounding,
104
+ # :format_footage_fields,
105
+ # :support_local_storage,
106
+ # :view_master_settings,
107
+ # :duration_units,
108
+ # :hours_per_day,
109
+ # :last_day_work_week]
110
+ ```
111
+
70
112
  ### Entities
71
113
 
72
114
  Querying entities is done by accessing the named method
@@ -16,6 +16,14 @@ module ShotgunApiRuby
16
16
  end
17
17
  end
18
18
 
19
+ def preferences
20
+ @preferences = Preferences.new(connection)
21
+ end
22
+
23
+ def server_info
24
+ @server_info || ServerInfo.new(connection)
25
+ end
26
+
19
27
  def entities(type)
20
28
  public_send(type)
21
29
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ShotgunApiRuby
4
+ class Preferences
5
+ def initialize(connection)
6
+ @connection = connection.dup
7
+ @connection.url_prefix = "#{@connection.url_prefix}/preferences"
8
+ end
9
+
10
+ attr_reader :connection
11
+
12
+ def all
13
+ resp = @connection.get
14
+ resp_body = JSON.parse(resp.body)
15
+
16
+ if resp.status >= 300
17
+ raise "Error while getting server preferences: #{resp_body['errors']}"
18
+ end
19
+
20
+ data = resp_body["data"]
21
+ OpenStruct.new(data)
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ShotgunApiRuby
4
+ class ServerInfo
5
+ def initialize(connection)
6
+ @connection = connection
7
+ end
8
+
9
+ attr_reader :connection
10
+
11
+ def get
12
+ resp = @connection.get
13
+ resp_body = JSON.parse(resp.body)
14
+
15
+ if resp.status >= 300
16
+ raise "Error while getting server infos: #{resp_body['errors']}"
17
+ end
18
+
19
+ data = resp_body["data"]
20
+ OpenStruct.new(data)
21
+ end
22
+ end
23
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ShotgunApiRuby
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shotgun_api_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis <Zaratan> Pasin
@@ -191,6 +191,8 @@ files:
191
191
  - lib/shotgun_api_ruby/client.rb
192
192
  - lib/shotgun_api_ruby/entities.rb
193
193
  - lib/shotgun_api_ruby/entity.rb
194
+ - lib/shotgun_api_ruby/preferences.rb
195
+ - lib/shotgun_api_ruby/server_info.rb
194
196
  - lib/shotgun_api_ruby/version.rb
195
197
  - shotgun_api_ruby.gemspec
196
198
  homepage: https://github.com/shotgunsoftware/shotgun_api_ruby