Sha256: f650c1f6f7f7ad3ccaedc3a19cfe6a6538aabd1bbea255008949357a5d18fd8d
Contents?: true
Size: 1.55 KB
Versions: 4
Compression:
Stored size: 1.55 KB
Contents
module VagrantCloud class Box attr_accessor :account attr_accessor :name attr_accessor :data def initialize(account, name, data = nil) @account = account @name = name @data = data end def description data['description_markdown'] end def description_short data['short_description'] end def versions data['versions'].map { |data| Version.new(self, data['number'], data) } end def data @data ||= account.request('get', "/box/#{account.username}/#{name}") end def update(description) box = {:short_description => description, :description => description} @data = account.request('put', "/box/#{account.username}/#{name}", {:box => box}) end def delete account.request('delete', "/box/#{account.username}/#{name}") end def get_version(number, data = nil) Version.new(self, number, data) end def create_version(name, description = nil) params = {:version => name} params[:description] = description if description data = account.request('post', "/box/#{account.username}/#{self.name}/versions", {:version => params}) get_version(data['number'], data) end def ensure_version(name, description = nil) version = versions.select{ |version| version.version == name }.first unless version version = create_version(name, description) end if description and (description != version.description) version.update(description) end version end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
vagrant_cloud-0.2.2 | lib/vagrant_cloud/box.rb |
vagrant_cloud-0.2.1 | lib/vagrant_cloud/box.rb |
vagrant_cloud-0.2.0 | lib/vagrant_cloud/box.rb |
vagrant_cloud-0.1.0 | lib/vagrant_cloud/box.rb |