Class: Proxy::Omaha::MetadataProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_proxy_omaha/metadata_provider.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ MetadataProvider

Returns a new instance of MetadataProvider.



5
6
7
# File 'lib/smart_proxy_omaha/metadata_provider.rb', line 5

def initialize(options)
  @contentpath = options.fetch(:contentpath)
end

Instance Attribute Details

#contentpathObject

Returns the value of attribute contentpath.



3
4
5
# File 'lib/smart_proxy_omaha/metadata_provider.rb', line 3

def contentpath
  @contentpath
end

Instance Method Details

#get(track, release, architecture) ⇒ Object



9
10
11
# File 'lib/smart_proxy_omaha/metadata_provider.rb', line 9

def get(track, release, architecture)
  Metadata.new(JSON.parse(File.read((track, release, architecture))))
end

#store(metadata) ⇒ Object



13
14
15
16
17
18
# File 'lib/smart_proxy_omaha/metadata_provider.rb', line 13

def store()
  File.open((.track, .release, .architecture), 'w') do |file|
    file.write(.to_json)
  end
  true
end