module StrawberryAPI::Client::ArchiveStrategies
Public Instance Methods
Fetches all archive strategies
@return [Array<StrawberryAPI::ArchiveStrategy>] A list of archive strategies
# File lib/strawberry_api/client/archive_strategies.rb, line 10 def archive_strategies get("/archive_strategies").parse['array']&.map do |archive_strategy| ArchiveStrategy.new(archive_strategy) end end
Featches archive strategies configuration
@return [Hash] The fetched archive strategies configuration
# File lib/strawberry_api/client/archive_strategies.rb, line 81 def archive_strategies_configuration get("/archive_strategies/configuration").parse['hash'] end
Fetches an archive strategy
@param [Integer] id Id of the archive strategy to retrieve
@return [StrawberryAPI::ArchiveStrategy] The fetched archive strategy
# File lib/strawberry_api/client/archive_strategies.rb, line 22 def archive_strategy(id:) data = get("/archive_strategies/#{id}").parse['archivestrategy'] data.nil? ? nil : ArchiveStrategy.new(data) end
Creates an archive strategy
@param [String] name @param [String] destination @option [String] format 'plain' @option [Boolean] admin_only true @option [String] includes 'none' @option [String] transmission_check 'fingerprint' @option [Boolean] enabled true @option [String] strategy_type 'native'
@return [StrawberryAPI::ArchiveStrategy] The created archive strategy
# File lib/strawberry_api/client/archive_strategies.rb, line 40 def create_archive_strategy(name:, destination:, format: 'plain', admin_only: true, includes: 'none', transmission_check: 'fingerprint', enabled: true, strategy_type: 'native') body = { name: name, destination: destination, format: format, admin_only: admin_only, includes: includes, transmission_check: transmission_check, enabled: enabled, strategy_type: strategy_type }.to_json data = post("/archive_strategies", body: body).parse['archivestrategy'] data.nil? ? nil : ArchiveStrategy.new(data) end
Updates an archive strategy
@param [Integer] id Id of the user to update @option options [String] name @option options [String] destination @option options [String] format @option options [String] admin_only @option options [String] enabled @option options [String] includes @option options [String] transmission_check
@return [StrawberryAPI::ArchiveStrategy] The updated archive strategy
# File lib/strawberry_api/client/archive_strategies.rb, line 69 def update_archive_strategy(id:, **options) body = args.to_json data = put("/archive_strategies/#{id}", body: body).parse['archivestrategy'] data.nil? ? nil : ArchiveStrategy.new(data) end