Class: AppleEpf::Main
- Inherits:
-
Object
- Object
- AppleEpf::Main
- Defined in:
- lib/apple_epf/main.rb
Direct Known Subclasses
Defined Under Namespace
Modules: BaseActions
Instance Attribute Summary collapse
-
#downloader ⇒ Object
readonly
Returns the value of attribute downloader.
-
#filedate ⇒ Object
readonly
Returns the value of attribute filedate.
-
#files_matrix ⇒ Object
readonly
Returns the value of attribute files_matrix.
-
#keep_tbz_after_extract ⇒ Object
Returns the value of attribute keep_tbz_after_extract.
-
#store_dir ⇒ Object
Returns the value of attribute store_dir.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(filedate, files_matrix = nil, store_dir = nil, keep_tbz_after_extract = nil) ⇒ Main
constructor
A new instance of Main.
Constructor Details
#initialize(filedate, files_matrix = nil, store_dir = nil, keep_tbz_after_extract = nil) ⇒ Main
Returns a new instance of Main.
8 9 10 11 12 13 |
# File 'lib/apple_epf/main.rb', line 8 def initialize(filedate, files_matrix = nil, store_dir = nil, keep_tbz_after_extract = nil) @filedate = filedate @files_matrix = files_matrix || AppleEpf.files_matrix @store_dir = store_dir @keep_tbz_after_extract = !!keep_tbz_after_extract || AppleEpf.keep_tbz_after_extract end |
Instance Attribute Details
#downloader ⇒ Object (readonly)
Returns the value of attribute downloader.
5 6 7 |
# File 'lib/apple_epf/main.rb', line 5 def downloader @downloader end |
#filedate ⇒ Object (readonly)
Returns the value of attribute filedate.
5 6 7 |
# File 'lib/apple_epf/main.rb', line 5 def filedate @filedate end |
#files_matrix ⇒ Object (readonly)
Returns the value of attribute files_matrix.
5 6 7 |
# File 'lib/apple_epf/main.rb', line 5 def files_matrix @files_matrix end |
#keep_tbz_after_extract ⇒ Object
Returns the value of attribute keep_tbz_after_extract.
6 7 8 |
# File 'lib/apple_epf/main.rb', line 6 def keep_tbz_after_extract @keep_tbz_after_extract end |
#store_dir ⇒ Object
Returns the value of attribute store_dir.
6 7 8 |
# File 'lib/apple_epf/main.rb', line 6 def store_dir @store_dir end |
Class Method Details
.get_current_list ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/apple_epf/main.rb', line 15 def self.get_current_list curl = Curl::Easy.new(self.current_url) curl.http_auth_types = :basic curl.username = AppleEpf.apple_id curl.password = AppleEpf.apple_password curl.follow_location = true curl.max_redirects = 5 curl.perform body = curl.body_str files = Nokogiri::HTML(body).xpath("//td/a").map(&:text).select{|s| s=~/.*tbz$/} files.inject({}) do |all, e| e.match(/([a-z]*)(\d*.tbz)/) all[$1] = {} all[$1][:base] = $2.chomp(".tbz") all[$1][:full_url] = self.current_url + "/#{$1}#{$2}" all end end |