Class: SFRest::Codebase

Inherits:
Object
  • Object
show all
Defined in:
lib/sfrest/codebase.rb

Overview

List codebases on the factory.

Instance Method Summary collapse

Constructor Details

#initialize(conn) ⇒ Codebase

Returns a new instance of Codebase.

Parameters:



7
8
9
# File 'lib/sfrest/codebase.rb', line 7

def initialize(conn)
  @conn = conn
end

Instance Method Details

#edit_stacks(stack_id, name, description, tangle_alias) ⇒ Array

Edits stack name and description.

Parameters:

  • stack_id. (Integer)
  • name. (String)
  • description. (String)
  • tangle_alias. (String)

Returns:

  • (Array)

    an array containing the message given by the server.



25
26
27
28
29
30
31
32
# File 'lib/sfrest/codebase.rb', line 25

def edit_stacks(stack_id, name, description, tangle_alias)
  payload = {
    'name' => name,
    'description' => description,
    'tangle_alias' => tangle_alias
  }
  @conn.put("/api/v1/stacks/#{stack_id}", payload.to_json)
end

#listHash

Lists the codebases { “stacks” => { 1 => “abcde”, 2 => ‘fghij’ } }

Returns:

  • (Hash)

    A hash of codebases configured for the factory.



14
15
16
# File 'lib/sfrest/codebase.rb', line 14

def list
  @conn.get('/api/v1/stacks')
end

#stacks_with_detailsHash

Lists the codebases with details. {“id”: 1, “name”: “name”, “description”: “description”, “tangle_alias”: “tangle1” }

Returns:

  • (Hash)

    A hash of codebases with details configured for the factory.



37
38
39
# File 'lib/sfrest/codebase.rb', line 37

def stacks_with_details
  @conn.get('/api/v1/stacks/details')
end