module StrawberryAPI::Client::AssetCopyToStrategies

Public Instance Methods

asset_copy_to_strategies() click to toggle source

Fetches all asset copy to strategies

@return [Array<StrawberryAPI::AssetCopyToStrategy>] A list of asset copy to strategies

# File lib/strawberry_api/client/asset_copy_to_strategies.rb, line 10
def asset_copy_to_strategies
  get("/asset_copy_to_strategies").parse['array']&.map do |asset_copy_to_strategy|
    AssetCopyToStrategy.new(asset_copy_to_strategy)
  end
end
asset_copy_to_strategy(id:) click to toggle source

Fetches an asset copy to strategy

@param [Integer] id Id of the asset copy to strategy to retrieve

@return [StrawberryAPI::AssetCopyToStrategy] The fetched asset copy to strategy

# File lib/strawberry_api/client/asset_copy_to_strategies.rb, line 22
def asset_copy_to_strategy(id:)
  data = get("/asset_copy_to_strategies/#{id}").parse['assetcopytostrategy']
  data.nil? ? nil : AssetCopyToStrategy.new(data)
end
create_asset_copy_to_strategy(name:, destination:, format: 'plain', admin_only: true, enabled: true) click to toggle source

Creates an asset copy to strategy

@param [String] name @param [String] destination @param [String] format 'plain' @param [Boolean] admin_only true @param [Boolean] enabled true

@return [<type>] <description>

# File lib/strawberry_api/client/asset_copy_to_strategies.rb, line 37
def create_asset_copy_to_strategy(name:, destination:, format: 'plain', admin_only: true, enabled: true)
  body = {
    name: name,
    destination: destination,
    format: format,
    admin_only: admin_only,
    enabled: enabled
  }.to_json
  
  data = post("/asset_copy_to_strategies", body: body).parse['assetcopytostrategy']
  data.nil? ? nil : AssetCopyToStrategy.new(data)
end
delete_asset_copy_to_strategy(id:) click to toggle source

Deletes an asset copy to strategy

@param [Integer] id Id of the asset copy to strategy to delete

@return [Boolean] Success

# File lib/strawberry_api/client/asset_copy_to_strategies.rb, line 77
def delete_asset_copy_to_strategy(id:)
  delete("/asset_copy_to_strategies/#{id}").success?
end
update_asset_copy_to_strategy(id:, **options) click to toggle source

Updates a asset copy to 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] contents @option options [String] delete_project

@return [StrawberryAPI::AssetCopyToStrategy] The updated asset copy to strategy

# File lib/strawberry_api/client/asset_copy_to_strategies.rb, line 64
def update_asset_copy_to_strategy(id:, **options)
  body = args.to_json
  
  data = put("/asset_copy_to_strategies/#{id}", body: body).parse['assetcopytostrategy']
  data.nil? ? nil : AssetCopyToStrategy.new(data)
end