Model: Source - mschnitzer/open-build-service-api GitHub Wiki

The Source model always represents one single source file in a package container.

Class Name: OpenBuildServiceAPI::Source

Instance Attributes:

  • name (String): the name of that source file
  • md5_hash (String): the md5 hash of that source file
  • size (Filesize): the file size of that source file
  • updated_at (Time): the last modified date of that source file

Relations

Instance Method: #to_s

Converts an instance of OpenBuildServiceAPI::Source into a string. The return value is always the name of the source file.

Return Value: String

Example:

project = obs_api.project.find!('home:mschnitzer')
package = project.packages.find!('rubygem-passenger')
puts "Source file name: #{package.sources.find('rubygem-passenger.spec')}"

Instance Method: #content

Fetches the content of the source and returns it.

Return Value: String

Example:

project = obs_api.project.find!('home:mschnitzer')
package = project.packages.find!('rubygem-passenger')
puts package.sources.find('rubygem-passenger.spec').content

Instance Method: #delete!

Deletes the current source file from the remote API server.

Return Value: Boolean (true)

Example:

project = obs_api.project.find!('home:mschnitzer')
package = project.packages.find!('rubygem-passenger')
package.sources.find('rubygem-passenger.spec').delete!