Module: StrawberryAPI::Client::AssetCopyToStrategies

Included in:
StrawberryAPI::Client
Defined in:
lib/strawberry_api/client/asset_copy_to_strategies.rb

Instance Method Summary collapse

Instance Method Details

#asset_copy_to_strategiesArray<StrawberryAPI::AssetCopyToStrategy>

Fetches all asset copy to strategies

Returns:



10
11
12
13
14
# 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:) ⇒ StrawberryAPI::AssetCopyToStrategy

Fetches an asset copy to strategy

Parameters:

  • id (Integer)

    Id of the asset copy to strategy to retrieve

Returns:



22
23
24
25
# 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) ⇒ <type>

Creates an asset copy to strategy

Parameters:

  • name (String)
  • destination (String)
  • format (String)

    'plain'

  • admin_only (Boolean)

    true

  • enabled (Boolean)

    true

Returns:

  • (<type>)

    <description>



37
38
39
40
41
42
43
44
45
46
47
48
# 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:) ⇒ Boolean

Deletes an asset copy to strategy

Parameters:

  • id (Integer)

    Id of the asset copy to strategy to delete

Returns:

  • (Boolean)

    Success



77
78
79
# 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) ⇒ StrawberryAPI::AssetCopyToStrategy

Updates a asset copy to strategy

Parameters:

  • id (Integer)

    Id of the user to update

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • name (String)
  • destination (String)
  • format (String)
  • admin_only (String)
  • enabled (String)
  • includes (String)
  • contents (String)
  • delete_project (String)

Returns:



64
65
66
67
68
69
# 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