Method: VagrantCloud::Box#initialize

Defined in:
lib/vagrant_cloud/box.rb

#initialize(organization:, **opts) ⇒ Box

Create a new instance



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vagrant_cloud/box.rb', line 17

def initialize(organization:, **opts)
  @organization = organization
  @versions_loaded = false
  opts[:username] = organization.username
  super(**opts)
  if opts[:versions] && !opts[:versions].empty?
    self.versions= Array(opts[:versions]).map do |version|
      Box::Version.load(box: self, **version)
    end
  end
  if opts[:current_version]
    clean(data: {current_version: Box::Version.
      load(box: self, **opts[:current_version])})
  end
  clean!
end