Class: Ubalo::PodArchive
- Inherits:
-
Object
- Object
- Ubalo::PodArchive
- Defined in:
- lib/ubalo/pod_archive.rb
Instance Attribute Summary collapse
-
#get_url ⇒ Object
readonly
Returns the value of attribute get_url.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#put_url ⇒ Object
readonly
Returns the value of attribute put_url.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #activate ⇒ Object
- #activate_from(pod_dir) ⇒ Object
- #extract_to(pod_dir) ⇒ Object
-
#initialize(account, label, attributes) ⇒ PodArchive
constructor
A new instance of PodArchive.
- #inspect ⇒ Object
Constructor Details
#initialize(account, label, attributes) ⇒ PodArchive
Returns a new instance of PodArchive.
9 10 11 12 13 |
# File 'lib/ubalo/pod_archive.rb', line 9 def initialize(account, label, attributes) @account = account @label = label update_attributes(attributes) end |
Instance Attribute Details
#get_url ⇒ Object (readonly)
Returns the value of attribute get_url.
7 8 9 |
# File 'lib/ubalo/pod_archive.rb', line 7 def get_url @get_url end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
7 8 9 |
# File 'lib/ubalo/pod_archive.rb', line 7 def label @label end |
#put_url ⇒ Object (readonly)
Returns the value of attribute put_url.
7 8 9 |
# File 'lib/ubalo/pod_archive.rb', line 7 def put_url @put_url end |
Class Method Details
.create_with_json(account, json) ⇒ Object
3 4 5 |
# File 'lib/ubalo/pod_archive.rb', line 3 def self.create_with_json(account, json) new(account, json.fetch('label'), json) end |
Instance Method Details
#==(other) ⇒ Object
40 41 42 |
# File 'lib/ubalo/pod_archive.rb', line 40 def ==(other) label == other.label end |
#activate ⇒ Object
23 24 25 26 27 |
# File 'lib/ubalo/pod_archive.rb', line 23 def activate request(:put, "/activate") rescue RestClient::Conflict raise Ubalo::Error, "Pod is already compiling" end |
#activate_from(pod_dir) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/ubalo/pod_archive.rb', line 15 def activate_from(pod_dir) with_temp_archive do |archive_name| pod_dir.make_archive(archive_name) Util.put_targz(put_url, archive_name) activate end end |
#extract_to(pod_dir) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/ubalo/pod_archive.rb', line 29 def extract_to(pod_dir) with_temp_archive do |archive_name| Util.get_targz(get_url, archive_name) pod_dir.extract_archive(archive_name) end end |
#inspect ⇒ Object
36 37 38 |
# File 'lib/ubalo/pod_archive.rb', line 36 def inspect "#<PodArchive #{label.inspect}>" end |