Class: Grocer::Pushpackager::Package

Inherits:
Object
  • Object
show all
Defined in:
lib/grocer/pushpackager/package.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Package

Returns a new instance of Package.



12
13
14
15
16
17
# File 'lib/grocer/pushpackager/package.rb', line 12

def initialize(config = {})
  @icon_set = IconSet.new(config)
  @website = Website.new(config)
  @certificate = config[:certificate]
  @key = config[:key]
end

Instance Attribute Details

#certificateObject

Returns the value of attribute certificate.



10
11
12
# File 'lib/grocer/pushpackager/package.rb', line 10

def certificate
  @certificate
end

#icon_setObject

Returns the value of attribute icon_set.



10
11
12
# File 'lib/grocer/pushpackager/package.rb', line 10

def icon_set
  @icon_set
end

#keyObject

Returns the value of attribute key.



10
11
12
# File 'lib/grocer/pushpackager/package.rb', line 10

def key
  @key
end

#websiteObject

Returns the value of attribute website.



10
11
12
# File 'lib/grocer/pushpackager/package.rb', line 10

def website
  @website
end

Instance Method Details

#authentication_token=(value) ⇒ Object



19
20
21
22
23
24
# File 'lib/grocer/pushpackager/package.rb', line 19

def authentication_token= value
  @website.authentication_token = value
  @signature = nil
  @website_json = nil
  @manifest_json = nil
end

#fileObject



34
35
36
37
38
39
40
# File 'lib/grocer/pushpackager/package.rb', line 34

def file
  raise unless self.valid?
  package = Tempfile.new('package')
  package.write(build_zip.string)
  package.close
  package
end

#valid?Boolean

Returns:

  • (Boolean)

Raises:

  • (ArgumentError)


26
27
28
29
30
31
32
# File 'lib/grocer/pushpackager/package.rb', line 26

def valid?
  @icon_set.valid?
  @website.valid?
  raise ArgumentError, "Missing private key" unless @key
  raise ArgumentError, "Missing certificate" unless @certificate
  true
end