Module: StrawberryAPI::Client::ProjectCopyToStrategies

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

Instance Method Summary collapse

Instance Method Details

#create_project_copy_to_strategy(name:, destination:, format: 'plain', admin_only: true, includes: 'none', enabled: true, strategy_type: 'native', contents: 'both', delete_project: false) ⇒ StrawberryAPI::ProjectCopyToStrategy

Creates a project copy to strategy

Parameters:

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

    'plain'

  • admin_only (Boolean)

    true

  • includes (String)

    'none'

  • enabled (String)

    true

  • strategy_type (String)

    'native'

  • contents (String)

    'both'

  • delete_project (Boolean)

    false

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/strawberry_api/client/project_copy_to_strategies.rb', line 41

def create_project_copy_to_strategy(name:, destination:, format: 'plain', admin_only: true, includes: 'none', enabled: true, strategy_type: 'native', contents: 'both', delete_project: false)
  body = {
    name: name,
    destination: destination,
    format: format,
    admin_only: admin_only,
    enabled: enabled,
    contents: contents,
    includes: includes,
    delete_project: delete_project
  }.to_json
  
  data = post("/project_copy_to_strategies", body: body).parse['projectcopytostrategy']
  data.nil? ? nil : ProjectCopyToStrategy.new(data)
end

#delete_project_copy_to_strategy(id:) ⇒ Boolean

Deletes a project copy to strategy

Parameters:

  • id (Integer)

    Id of the project copy to strategy to delete

Returns:

  • (Boolean)

    ] Success



82
83
84
# File 'lib/strawberry_api/client/project_copy_to_strategies.rb', line 82

def delete_project_copy_to_strategy(id:)
  delete("/project_copy_to_strategies/#{id}").success?
end

#project_copy_to_strategiesArray<StrawberryAPI::ProjectCopyToStrategy>

Fetches all project copy to strategies

Returns:



10
11
12
13
14
# File 'lib/strawberry_api/client/project_copy_to_strategies.rb', line 10

def project_copy_to_strategies
  get("/project_copy_to_strategies").parse['array']&.map do |project_copy_to_strategy|
    ProjectCopyToStrategy.new(project_copy_to_strategy)
  end
end

#project_copy_to_strategy(id:) ⇒ StrawberryAPI::ProjectCopyToStrategy

Fetches a project copy to strategy

Parameters:

  • id (Integer)

    Id of the project copy to strategy to retrieve

Returns:



22
23
24
25
# File 'lib/strawberry_api/client/project_copy_to_strategies.rb', line 22

def project_copy_to_strategy(id:)
  data = get("/project_copy_to_strategies/#{id}").parse['projectcopytostrategy']
  data.nil? ? nil : ProjectCopyToStrategy.new(data)
end

#update_project_copy_to_strategy(id:, **options) ⇒ StrawberryAPI::ProjectCopyToStrategy

Updates a project copy to trategy

Parameters:

  • id (Integer)

    Id of the user to update

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • :username (String)
  • :firstname (String)
  • :lastname (String)
  • :password (String)
  • :role_id (String)
  • :user_matrix_attributes (String)

Returns:



69
70
71
72
73
74
# File 'lib/strawberry_api/client/project_copy_to_strategies.rb', line 69

def update_project_copy_to_strategy(id:, **options)
  body = args.to_json
  
  data = put("/project_copy_to_strategies/#{id}", body: body).parse['projectcopytostrategy']
  data.nil? ? nil : ProjectCopyToStrategy.new(data)
end