strawberry_api 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rubocop.yml +4 -0
  4. data/CODE_OF_CONDUCT.md +74 -0
  5. data/Gemfile +3 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +135 -0
  8. data/Rakefile +2 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/doc/HTTParty/Response.html +148 -0
  12. data/doc/StrawberryAPI/AccessRight.html +431 -0
  13. data/doc/StrawberryAPI/ApiKey.html +637 -0
  14. data/doc/StrawberryAPI/ArchiveStrategy.html +365 -0
  15. data/doc/StrawberryAPI/ArchiveStrategyState.html +1057 -0
  16. data/doc/StrawberryAPI/Asset.html +1791 -0
  17. data/doc/StrawberryAPI/AssetCopyToStrategy.html +145 -0
  18. data/doc/StrawberryAPI/AssetFeedback.html +370 -0
  19. data/doc/StrawberryAPI/Client/ApiKeys.html +904 -0
  20. data/doc/StrawberryAPI/Client/ArchiveStrategies.html +784 -0
  21. data/doc/StrawberryAPI/Client/AssetCopyToStrategies.html +805 -0
  22. data/doc/StrawberryAPI/Client/AssetFeedbacks.html +232 -0
  23. data/doc/StrawberryAPI/Client/Assets.html +888 -0
  24. data/doc/StrawberryAPI/Client/Collections.html +319 -0
  25. data/doc/StrawberryAPI/Client/CopyToFeedbacks.html +232 -0
  26. data/doc/StrawberryAPI/Client/CustomMetadata.html +210 -0
  27. data/doc/StrawberryAPI/Client/CustomMetadataFields.html +214 -0
  28. data/doc/StrawberryAPI/Client/CustomMetadataOptions.html +214 -0
  29. data/doc/StrawberryAPI/Client/CustomMetadataSets.html +214 -0
  30. data/doc/StrawberryAPI/Client/Edits.html +485 -0
  31. data/doc/StrawberryAPI/Client/Features.html +319 -0
  32. data/doc/StrawberryAPI/Client/Libraries.html +321 -0
  33. data/doc/StrawberryAPI/Client/Markers.html +234 -0
  34. data/doc/StrawberryAPI/Client/ProjectCopyToStrategies.html +857 -0
  35. data/doc/StrawberryAPI/Client/ProjectFeedbacks.html +232 -0
  36. data/doc/StrawberryAPI/Client/Projects.html +2764 -0
  37. data/doc/StrawberryAPI/Client/Roles.html +214 -0
  38. data/doc/StrawberryAPI/Client/Schedules.html +319 -0
  39. data/doc/StrawberryAPI/Client/Searches.html +293 -0
  40. data/doc/StrawberryAPI/Client/Sessions.html +376 -0
  41. data/doc/StrawberryAPI/Client/Settings.html +210 -0
  42. data/doc/StrawberryAPI/Client/StatusFlags.html +315 -0
  43. data/doc/StrawberryAPI/Client/Teams.html +1067 -0
  44. data/doc/StrawberryAPI/Client/Templates.html +319 -0
  45. data/doc/StrawberryAPI/Client/Users.html +1255 -0
  46. data/doc/StrawberryAPI/Client.html +487 -0
  47. data/doc/StrawberryAPI/Collection.html +427 -0
  48. data/doc/StrawberryAPI/Configuration.html +481 -0
  49. data/doc/StrawberryAPI/CopyToFeedback.html +220 -0
  50. data/doc/StrawberryAPI/CustomMetadataField.html +999 -0
  51. data/doc/StrawberryAPI/CustomMetadataOption.html +567 -0
  52. data/doc/StrawberryAPI/CustomMetadataSet.html +649 -0
  53. data/doc/StrawberryAPI/CustomMetadatum.html +718 -0
  54. data/doc/StrawberryAPI/Edit.html +637 -0
  55. data/doc/StrawberryAPI/Feature.html +567 -0
  56. data/doc/StrawberryAPI/Feedback.html +641 -0
  57. data/doc/StrawberryAPI/HttpClient.html +971 -0
  58. data/doc/StrawberryAPI/Library.html +637 -0
  59. data/doc/StrawberryAPI/Marker.html +847 -0
  60. data/doc/StrawberryAPI/Project.html +2395 -0
  61. data/doc/StrawberryAPI/ProjectCopyToStrategy.html +365 -0
  62. data/doc/StrawberryAPI/ProjectFeedback.html +370 -0
  63. data/doc/StrawberryAPI/Proxy.html +1267 -0
  64. data/doc/StrawberryAPI/Role.html +567 -0
  65. data/doc/StrawberryAPI/Schedule.html +2387 -0
  66. data/doc/StrawberryAPI/Session.html +121 -0
  67. data/doc/StrawberryAPI/Setting.html +207 -0
  68. data/doc/StrawberryAPI/StatusFlag.html +207 -0
  69. data/doc/StrawberryAPI/Strategy.html +641 -0
  70. data/doc/StrawberryAPI/Team.html +789 -0
  71. data/doc/StrawberryAPI/Template.html +707 -0
  72. data/doc/StrawberryAPI/User.html +999 -0
  73. data/doc/StrawberryAPI.html +483 -0
  74. data/doc/_index.html +632 -0
  75. data/doc/class_list.html +51 -0
  76. data/doc/css/common.css +1 -0
  77. data/doc/css/full_list.css +58 -0
  78. data/doc/css/style.css +496 -0
  79. data/doc/file.README.html +222 -0
  80. data/doc/file_list.html +56 -0
  81. data/doc/frames.html +17 -0
  82. data/doc/index.html +222 -0
  83. data/doc/js/app.js +292 -0
  84. data/doc/js/full_list.js +216 -0
  85. data/doc/js/jquery.js +4 -0
  86. data/doc/method_list.html +3059 -0
  87. data/doc/top-level-namespace.html +110 -0
  88. data/lib/strawberry_api/access_right.rb +18 -0
  89. data/lib/strawberry_api/api_key.rb +19 -0
  90. data/lib/strawberry_api/asset.rb +51 -0
  91. data/lib/strawberry_api/client/api_keys.rb +49 -0
  92. data/lib/strawberry_api/client/archive_strategies.rb +87 -0
  93. data/lib/strawberry_api/client/asset_copy_to_strategies.rb +83 -0
  94. data/lib/strawberry_api/client/asset_feedbacks.rb +18 -0
  95. data/lib/strawberry_api/client/assets.rb +92 -0
  96. data/lib/strawberry_api/client/collections.rb +29 -0
  97. data/lib/strawberry_api/client/copy_to_feedbacks.rb +18 -0
  98. data/lib/strawberry_api/client/custom_metadata.rb +16 -0
  99. data/lib/strawberry_api/client/custom_metadata_fields.rb +18 -0
  100. data/lib/strawberry_api/client/custom_metadata_options.rb +18 -0
  101. data/lib/strawberry_api/client/custom_metadata_sets.rb +18 -0
  102. data/lib/strawberry_api/client/edits.rb +47 -0
  103. data/lib/strawberry_api/client/features.rb +29 -0
  104. data/lib/strawberry_api/client/libraries.rb +30 -0
  105. data/lib/strawberry_api/client/markers.rb +19 -0
  106. data/lib/strawberry_api/client/project_copy_to_strategies.rb +88 -0
  107. data/lib/strawberry_api/client/project_feedbacks.rb +18 -0
  108. data/lib/strawberry_api/client/projects.rb +305 -0
  109. data/lib/strawberry_api/client/roles.rb +18 -0
  110. data/lib/strawberry_api/client/schedules.rb +29 -0
  111. data/lib/strawberry_api/client/searches.rb +25 -0
  112. data/lib/strawberry_api/client/sessions.rb +33 -0
  113. data/lib/strawberry_api/client/settings.rb +16 -0
  114. data/lib/strawberry_api/client/status_flags.rb +27 -0
  115. data/lib/strawberry_api/client/teams.rb +107 -0
  116. data/lib/strawberry_api/client/templates.rb +29 -0
  117. data/lib/strawberry_api/client/users.rb +125 -0
  118. data/lib/strawberry_api/client.rb +95 -0
  119. data/lib/strawberry_api/collection.rb +16 -0
  120. data/lib/strawberry_api/configuration.rb +19 -0
  121. data/lib/strawberry_api/custom_metadata/custom_metadata_field.rb +30 -0
  122. data/lib/strawberry_api/custom_metadata/custom_metadata_option.rb +18 -0
  123. data/lib/strawberry_api/custom_metadata/custom_metadata_set.rb +25 -0
  124. data/lib/strawberry_api/custom_metadatum.rb +30 -0
  125. data/lib/strawberry_api/edit.rb +19 -0
  126. data/lib/strawberry_api/feature.rb +18 -0
  127. data/lib/strawberry_api/feedback/asset_feedback.rb +15 -0
  128. data/lib/strawberry_api/feedback/copy_to_feedback.rb +12 -0
  129. data/lib/strawberry_api/feedback/project_feedback.rb +15 -0
  130. data/lib/strawberry_api/feedback.rb +19 -0
  131. data/lib/strawberry_api/http_client.rb +135 -0
  132. data/lib/strawberry_api/library.rb +19 -0
  133. data/lib/strawberry_api/marker.rb +22 -0
  134. data/lib/strawberry_api/project.rb +48 -0
  135. data/lib/strawberry_api/proxy.rb +28 -0
  136. data/lib/strawberry_api/role.rb +18 -0
  137. data/lib/strawberry_api/schedule.rb +44 -0
  138. data/lib/strawberry_api/session.rb +7 -0
  139. data/lib/strawberry_api/setting.rb +12 -0
  140. data/lib/strawberry_api/status_flag.rb +12 -0
  141. data/lib/strawberry_api/strategy/archive_strategy.rb +10 -0
  142. data/lib/strawberry_api/strategy/archive_strategy_state.rb +25 -0
  143. data/lib/strawberry_api/strategy/asset_copy_to_strategy.rb +6 -0
  144. data/lib/strawberry_api/strategy/project_copy_to_strategy.rb +9 -0
  145. data/lib/strawberry_api/strategy.rb +19 -0
  146. data/lib/strawberry_api/team.rb +27 -0
  147. data/lib/strawberry_api/template.rb +20 -0
  148. data/lib/strawberry_api/user.rb +30 -0
  149. data/lib/strawberry_api/version.rb +3 -0
  150. data/lib/strawberry_api.rb +36 -0
  151. data/samples/README.md +14 -0
  152. data/samples/list_assets_links.rb +15 -0
  153. data/samples/list_projects.rb +14 -0
  154. data/samples/login.rb +18 -0
  155. data/samples/test.rb +12 -0
  156. data/strawberry_api.gemspec +40 -0
  157. metadata +242 -0
@@ -0,0 +1,110 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Top Level Namespace
8
+
9
+ &mdash; Documentation by YARD 0.9.16
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index</a> &raquo;
40
+
41
+
42
+ <span class="title">Top Level Namespace</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Top Level Namespace
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ </div>
80
+
81
+ <h2>Defined Under Namespace</h2>
82
+ <p class="children">
83
+
84
+
85
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="StrawberryAPI.html" title="StrawberryAPI (module)">StrawberryAPI</a></span>
86
+
87
+
88
+
89
+
90
+ </p>
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+ </div>
101
+
102
+ <div id="footer">
103
+ Generated on Thu Aug 30 12:51:39 2018 by
104
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
+ 0.9.16 (ruby-2.5.0).
106
+ </div>
107
+
108
+ </div>
109
+ </body>
110
+ </html>
@@ -0,0 +1,18 @@
1
+ module StrawberryAPI
2
+
3
+ class AccessRight
4
+
5
+ attr_accessor :team_id
6
+ attr_accessor :read
7
+ attr_accessor :write
8
+
9
+ def initialize(params = {})
10
+ self.user_id = params.first
11
+
12
+ params.last.each do |k, v|
13
+ instance_variable_set("@#{k}", v) unless v.nil?
14
+ end
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ module StrawberryAPI
2
+
3
+ class ApiKey
4
+
5
+ attr_accessor :id
6
+ attr_accessor :user_id
7
+ attr_accessor :name
8
+ attr_accessor :key
9
+ attr_accessor :created_at
10
+ attr_accessor :updated_at
11
+
12
+ def initialize(params = {})
13
+ params.each do |k, v|
14
+ instance_variable_set("@#{k}", v) unless v.nil?
15
+ end
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,51 @@
1
+ module StrawberryAPI
2
+
3
+ class Asset
4
+
5
+ attr_accessor :id
6
+ attr_accessor :project_id
7
+ attr_accessor :archive_strategy_id
8
+ attr_accessor :name
9
+ attr_accessor :project_name
10
+ attr_accessor :created_at
11
+ attr_accessor :updated_at
12
+ attr_accessor :size
13
+ attr_accessor :audio
14
+ attr_accessor :image
15
+ attr_accessor :video
16
+ attr_accessor :avid
17
+ attr_accessor :file_names
18
+ attr_accessor :type
19
+ attr_accessor :duration
20
+ attr_accessor :descriptions
21
+ attr_accessor :metadata
22
+ attr_accessor :clip_names
23
+ attr_accessor :proxy
24
+
25
+ def initialize(params = {})
26
+ params.each do |k, v|
27
+ if k == 'proxy'
28
+ v = Proxy.new(v)
29
+ elsif k == 'metadata'
30
+ v&.map! do |metadatum|
31
+ metadatum.transform_keys(&:to_sym)
32
+ end
33
+ end
34
+
35
+ instance_variable_set("@#{k.gsub(/[!@#$%^&*?']/, '')}", v) unless v.nil?
36
+ end
37
+ end
38
+
39
+ def audio?
40
+ audio
41
+ end
42
+
43
+ def image?
44
+ image
45
+ end
46
+
47
+ def video?
48
+ video
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,49 @@
1
+ module StrawberryAPI
2
+ class Client < StrawberryAPI::HttpClient
3
+ module ApiKeys
4
+
5
+ attr_accessor :id
6
+ attr_accessor :user_id
7
+ attr_accessor :name
8
+ attr_accessor :key
9
+ attr_accessor :created_at
10
+ attr_accessor :updated_at
11
+
12
+ # Fetches user API keys
13
+ #
14
+ # @param [Integer] user_id Strawberry user id
15
+ #
16
+ # @return [Array<StrawberryAPI::ApiKey>] The fetched user API keys
17
+ #
18
+ def api_key(user_id:)
19
+ get("/users/#{user_id}/api_keys").parse['api_keys']&.map do |api_key|
20
+ ApiKey.new(api_key)
21
+ end
22
+ end
23
+
24
+ # Creates user API key
25
+ #
26
+ # @param [Integer] user_id Strawberry user id
27
+ # @param [String] name Name of the API key to create
28
+ #
29
+ # @return [ApiKey] The created user API key
30
+ #
31
+ def create_api_key(user_id:, name:)
32
+ data = post("/users/#{user_id}/api_keys", body: {name: name}.to_json).parse['api_key']
33
+ data.nil? ? nil : ApiKey.new(data)
34
+ end
35
+
36
+ # Deletes user API key
37
+ #
38
+ # @param [Integer] user_id Strawberry user id
39
+ # @param [Integer] api_key_id Id of the API key to delete
40
+ #
41
+ # @return [Boolean] Success
42
+ #
43
+ def destroy_api_key(user_id:, api_key_id:)
44
+ delete("/users/#{user_id}/api_keys/#{api_key_id}").success?
45
+ end
46
+
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,87 @@
1
+ module StrawberryAPI
2
+ class Client < StrawberryAPI::HttpClient
3
+ module ArchiveStrategies
4
+
5
+ # Fetches all archive strategies
6
+ #
7
+ #
8
+ # @return [Array<StrawberryAPI::ArchiveStrategy>] A list of archive strategies
9
+ #
10
+ def archive_strategies
11
+ get("/archive_strategies").parse['array']&.map do |archive_strategy|
12
+ ArchiveStrategy.new(archive_strategy)
13
+ end
14
+ end
15
+
16
+ # Fetches an archive strategy
17
+ #
18
+ # @param [Integer] id Id of the archive strategy to retrieve
19
+ #
20
+ # @return [StrawberryAPI::ArchiveStrategy] The fetched archive strategy
21
+ #
22
+ def archive_strategy(id:)
23
+ data = get("/archive_strategies/#{id}").parse['archivestrategy']
24
+ data.nil? ? nil : ArchiveStrategy.new(data)
25
+ end
26
+
27
+ # Creates an archive strategy
28
+ #
29
+ # @param [String] name
30
+ # @param [String] destination
31
+ # @option [String] format 'plain'
32
+ # @option [Boolean] admin_only true
33
+ # @option [String] includes 'none'
34
+ # @option [String] transmission_check 'fingerprint'
35
+ # @option [Boolean] enabled true
36
+ # @option [String] strategy_type 'native'
37
+ #
38
+ # @return [StrawberryAPI::ArchiveStrategy] The created archive strategy
39
+ #
40
+ def create_archive_strategy(name:, destination:, format: 'plain', admin_only: true, includes: 'none', transmission_check: 'fingerprint', enabled: true, strategy_type: 'native')
41
+ body = {
42
+ name: name,
43
+ destination: destination,
44
+ format: format,
45
+ admin_only: admin_only,
46
+ includes: includes,
47
+ transmission_check: transmission_check,
48
+ enabled: enabled,
49
+ strategy_type: strategy_type
50
+ }.to_json
51
+
52
+ data = post("/archive_strategies", body: body).parse['archivestrategy']
53
+ data.nil? ? nil : ArchiveStrategy.new(data)
54
+ end
55
+
56
+ # Updates an archive strategy
57
+ #
58
+ # @param [Integer] id Id of the user to update
59
+ # @option options [String] name
60
+ # @option options [String] destination
61
+ # @option options [String] format
62
+ # @option options [String] admin_only
63
+ # @option options [String] enabled
64
+ # @option options [String] includes
65
+ # @option options [String] transmission_check
66
+ #
67
+ # @return [StrawberryAPI::ArchiveStrategy] The updated archive strategy
68
+ #
69
+ def update_archive_strategy(id:, **options)
70
+ body = args.to_json
71
+
72
+ data = put("/archive_strategies/#{id}", body: body).parse['archivestrategy']
73
+ data.nil? ? nil : ArchiveStrategy.new(data)
74
+ end
75
+
76
+ # Featches archive strategies configuration
77
+ #
78
+ #
79
+ # @return [Hash] The fetched archive strategies configuration
80
+ #
81
+ def archive_strategies_configuration
82
+ get("/archive_strategies/configuration").parse['hash']
83
+ end
84
+
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,83 @@
1
+ module StrawberryAPI
2
+ class Client < StrawberryAPI::HttpClient
3
+ module AssetCopyToStrategies
4
+
5
+ # Fetches all asset copy to strategies
6
+ #
7
+ #
8
+ # @return [Array<StrawberryAPI::AssetCopyToStrategy>] A list of asset copy to strategies
9
+ #
10
+ def asset_copy_to_strategies
11
+ get("/asset_copy_to_strategies").parse['array']&.map do |asset_copy_to_strategy|
12
+ AssetCopyToStrategy.new(asset_copy_to_strategy)
13
+ end
14
+ end
15
+
16
+ # Fetches an asset copy to strategy
17
+ #
18
+ # @param [Integer] id Id of the asset copy to strategy to retrieve
19
+ #
20
+ # @return [StrawberryAPI::AssetCopyToStrategy] The fetched asset copy to strategy
21
+ #
22
+ def asset_copy_to_strategy(id:)
23
+ data = get("/asset_copy_to_strategies/#{id}").parse['assetcopytostrategy']
24
+ data.nil? ? nil : AssetCopyToStrategy.new(data)
25
+ end
26
+
27
+ # Creates an asset copy to strategy
28
+ #
29
+ # @param [String] name
30
+ # @param [String] destination
31
+ # @param [String] format 'plain'
32
+ # @param [Boolean] admin_only true
33
+ # @param [Boolean] enabled true
34
+ #
35
+ # @return [<type>] <description>
36
+ #
37
+ def create_asset_copy_to_strategy(name:, destination:, format: 'plain', admin_only: true, enabled: true)
38
+ body = {
39
+ name: name,
40
+ destination: destination,
41
+ format: format,
42
+ admin_only: admin_only,
43
+ enabled: enabled
44
+ }.to_json
45
+
46
+ data = post("/asset_copy_to_strategies", body: body).parse['assetcopytostrategy']
47
+ data.nil? ? nil : AssetCopyToStrategy.new(data)
48
+ end
49
+
50
+ # Updates a asset copy to strategy
51
+ #
52
+ # @param [Integer] id Id of the user to update
53
+ # @option options [String] name
54
+ # @option options [String] destination
55
+ # @option options [String] format
56
+ # @option options [String] admin_only
57
+ # @option options [String] enabled
58
+ # @option options [String] includes
59
+ # @option options [String] contents
60
+ # @option options [String] delete_project
61
+ #
62
+ # @return [StrawberryAPI::AssetCopyToStrategy] The updated asset copy to strategy
63
+ #
64
+ def update_asset_copy_to_strategy(id:, **options)
65
+ body = args.to_json
66
+
67
+ data = put("/asset_copy_to_strategies/#{id}", body: body).parse['assetcopytostrategy']
68
+ data.nil? ? nil : AssetCopyToStrategy.new(data)
69
+ end
70
+
71
+ # Deletes an asset copy to strategy
72
+ #
73
+ # @param [Integer] id Id of the asset copy to strategy to delete
74
+ #
75
+ # @return [Boolean] Success
76
+ #
77
+ def destroy_asset_copy_to_strategy(id:)
78
+ delete("/asset_copy_to_strategies/#{id}").success?
79
+ end
80
+
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,18 @@
1
+ module StrawberryAPI
2
+ class Client < StrawberryAPI::HttpClient
3
+ module AssetFeedbacks
4
+
5
+ # Fetches a asset feedback
6
+ #
7
+ # @param [Integer] id Id of the asset feedback to retrieve
8
+ #
9
+ # @return [StrawberryAPI::AssetFeedback] The fetched asset feedback
10
+ #
11
+ def asset_feedback(id:)
12
+ data = get("/asset_status/#{id}").parse['job']
13
+ data.nil? ? nil : AssetFeedback.new(data)
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,92 @@
1
+ module StrawberryAPI
2
+ class Client < StrawberryAPI::HttpClient
3
+ module Assets
4
+
5
+ # Fetches all assets
6
+ #
7
+ #
8
+ # @return [Array<StrawberryAPI::Asset>] A list of assets
9
+ #
10
+ def assets
11
+ get("/assets").parse['assets']&.map do |asset|
12
+ Asset.new(asset)
13
+ end
14
+ end
15
+
16
+ # Fetches an asset
17
+ #
18
+ # @param [Integer] id Id of the asset to retrieve
19
+ #
20
+ # @return [StrawberryAPI::Asset] The fetched asset
21
+ #
22
+ def asset(id:, path: nil)
23
+ if path.nil?
24
+ data = get("/assets/#{id}").parse['asset']
25
+ else
26
+ data = get("/assets/by_path", body: path.to_json).parse['asset']
27
+ end
28
+
29
+ data.nil? ? nil : Asset.new(data)
30
+ end
31
+
32
+ # Fetches an asset links
33
+ #
34
+ # @param [Integer] ids Ids of the asset to retrieve links from
35
+ #
36
+ # @return [Array<Hash>] The retrieved asset links
37
+ #
38
+ def asset_links(ids:)
39
+ get("/assets/links", body: {asset_ids: ids}.to_json).parse['links']&.map do |link|
40
+ link
41
+ end
42
+ end
43
+
44
+ # Fetches an asset marker descriptions
45
+ #
46
+ # @param [Integer] id Id of the asset to retrieve marker descriptions from
47
+ #
48
+ # @return [Array<StrawberryAPI::Marker>] The retrieved asset marker descriptions
49
+ #
50
+ def asset_marker_descriptions(id:)
51
+ data = get("/assets/#{id}/marker_descriptions").parse['array']
52
+ data.map do |marker|
53
+ marker.nil? ? nil : Marker.new(marker)
54
+ end
55
+ end
56
+
57
+ # Deletes a project assets
58
+ #
59
+ # @param [Integer] project_id Id of the project to delete assets from
60
+ # @param [Array<Integer>] asset_ids Ids of the assets to delete
61
+ #
62
+ # @return [Boolean] Success
63
+ #
64
+ def destroy_assets(project_id:, asset_ids:)
65
+ delete("/assets/destroy", body: {data: {project_id => {asset_ids: asset_ids}}}).success?
66
+ end
67
+
68
+ # Fetches an asset custom metadata
69
+ #
70
+ # @param [Integer] id Id of the asset to retrieve metadata from
71
+ #
72
+ # @return [Array<Hash>] The fetched asset custom metadata
73
+ #
74
+ def asset_custom_metadata(id:)
75
+ data = get("/assets/#{id}/custom_metadata").parse['array']
76
+ end
77
+
78
+ # Updates an asset custom metadata
79
+ #
80
+ # @param [Integer] id Id of the asset which to update custom metadata
81
+ # @param [Hash] custom_metadata Custom metadata to update the asset with
82
+ #
83
+ # @return [Boolean] Success
84
+ #
85
+ def update_asset_custom_metadata(id:, custom_metadata:)
86
+ filthy_hash = StrawberryAPI::CustomMetadata.filthify(custom_metadata: custom_metadata)
87
+ put("/assets/#{id}/update_metadata", query: filthy_hash).success?
88
+ end
89
+
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,29 @@
1
+ module StrawberryAPI
2
+ class Client < StrawberryAPI::HttpClient
3
+ module Collections
4
+
5
+ # Fetches all collections
6
+ #
7
+ #
8
+ # @return [Array<StrawberryAPI::Collection>] A list of collections
9
+ #
10
+ def collections
11
+ get("/collections").parse['array']&.map do |collection|
12
+ Collection.new(collection)
13
+ end
14
+ end
15
+
16
+ # Fetches a collection
17
+ #
18
+ # @param [Integer] id Id of the collection to retrieve
19
+ #
20
+ # @return [StrawberryAPI::Collection] The fetched collection
21
+ #
22
+ def collection(id:)
23
+ data = get("/collections/#{id}").parse['collection']
24
+ data.nil? ? nil : Collection.new(data)
25
+ end
26
+
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,18 @@
1
+ module StrawberryAPI
2
+ class Client < StrawberryAPI::HttpClient
3
+ module CopyToFeedbacks
4
+
5
+ # Fetches a copy to feedback
6
+ #
7
+ # @param [Integer] id Id of the copy to feedback to retrieve
8
+ #
9
+ # @return [StrawberryAPI::CopyToFeedback] The fetched copy to feedback
10
+ #
11
+ def copy_to_feedback(id:)
12
+ data = get("/copy_to_status/#{id}").parse['job']
13
+ data.nil? ? nil : CopyToFeedback.new(data)
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ module StrawberryAPI
2
+ class Client < StrawberryAPI::HttpClient
3
+ module CustomMetadata
4
+
5
+ # Fetches all custom metadata
6
+ #
7
+ #
8
+ # @return [Hash] The fetched custom metadata
9
+ #
10
+ def custom_metadata
11
+ get("/custom_metadata")
12
+ end
13
+
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ module StrawberryAPI
2
+ class Client < StrawberryAPI::HttpClient
3
+ module CustomMetadataFields
4
+
5
+ # Fetches all custom metadata fields
6
+ #
7
+ #
8
+ # @return [Array<StrawberryAPI::CustomMetadataField>] A list of custom metadata fields
9
+ #
10
+ def custom_metadata_fields
11
+ get("/custom_metadata_fields").parse['array']&.map do |field|
12
+ CustomMetadataField.new(field)
13
+ end
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module StrawberryAPI
2
+ class Client < StrawberryAPI::HttpClient
3
+ module CustomMetadataOptions
4
+
5
+ # Fetches all custom metadata options
6
+ #
7
+ #
8
+ # @return [Array<StrawberryAPI::CustomMetadataOption>] A list of custom metadata options
9
+ #
10
+ def custom_metadata_options
11
+ get("/select_field_options").parse['selectfieldoption::activerecord_relation']&.map do |option|
12
+ CustomMetadataOption.new(option)
13
+ end
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module StrawberryAPI
2
+ class Client < StrawberryAPI::HttpClient
3
+ module CustomMetadataSets
4
+
5
+ # Fetches all custom metadata sets
6
+ #
7
+ #
8
+ # @return [Array<StrawberryAPI::CustomMetadataSet>] A list of custom metadata sets
9
+ #
10
+ def custom_metadata_sets
11
+ get("/custom_metadata_sets").parse['array']&.map do |set|
12
+ CustomMetadataSet.new(set)
13
+ end
14
+ end
15
+
16
+ end
17
+ end
18
+ end