Class: Kitchen::Driver::VmpoolStores::GitlabSnippetStore

Inherits:
BaseStore
  • Object
show all
Defined in:
lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb

Instance Attribute Summary collapse

Attributes inherited from BaseStore

#pool_data

Instance Method Summary collapse

Methods inherited from BaseStore

#read, #reread

Constructor Details

#initialize(options = nil) ⇒ GitlabSnippetStore

Returns a new instance of GitlabSnippetStore.

Parameters:

  • project_id (Hash)

    a customizable set of options

  • snippet_id (Hash)

    a customizable set of options

  • pool_file (Hash)

    a customizable set of options

Raises:

  • (ArgumentError)


15
16
17
18
19
20
21
# File 'lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb', line 15

def initialize(options = nil)
  options ||= { project_id: nil, snippet_id: nil, pool_file: 'vmpool'}
  raise ArgumentError.new("You must pass the project_id option") unless options['project_id'].to_i > 0
  @snippet_id = options['snippet_id']  #ie. 630
  @project_id = options['project_id']  #ie. 89
  @pool_file = options['pool_file']
end

Instance Attribute Details

#pool_fileObject (readonly)

Returns the value of attribute pool_file.



10
11
12
# File 'lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb', line 10

def pool_file
  @pool_file
end

#project_idObject

Returns the value of attribute project_id.



9
10
11
# File 'lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb', line 9

def project_id
  @project_id
end

#snippet_idObject

Returns the value of attribute snippet_id.



9
10
11
# File 'lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb', line 9

def snippet_id
  @snippet_id
end

Instance Method Details

#createObject



29
30
31
32
33
34
# File 'lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb', line 29

def create
  #info("Creating new vmpool data snippet")
  snippet = create_snippet
  @snippet_id = snippet.id
  read
end

#saveObject



36
37
38
39
40
# File 'lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb', line 36

def save
  #info("Saving vmpool data")
  update_snippet
  read
end

#update(content = nil) ⇒ Object



23
24
25
26
27
# File 'lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb', line 23

def update(content = nil)
  #info("Updating vmpool data")
  update_snippet
  read
end