Class: Drobot
- Inherits:
-
Object
show all
- Includes:
- Capybara::DSL
- Defined in:
- lib/drobot.rb,
lib/version.rb
Constant Summary
collapse
- BASEDIR =
Optimized for Programmer Happyness
Pathname.new(__dir__).parent
- VERSION =
"0.0.3"
Instance Method Summary
collapse
Constructor Details
#initialize(credential_provider, target = "/tmp/foo") ⇒ Drobot
Returns a new instance of Drobot.
27
28
29
30
|
# File 'lib/drobot.rb', line 27
def initialize(credential_provider, target = "/tmp/foo")
@credential_provider = credential_provider
@target = target
end
|
Instance Method Details
#credential(name) ⇒ Object
47
48
49
|
# File 'lib/drobot.rb', line 47
def credential(name)
@credential_provider.send(name)
end
|
#download(url) ⇒ Object
32
33
34
35
36
|
# File 'lib/drobot.rb', line 32
def download(url)
open("#{@target}/#{title}.pdf", 'wb') do |file|
file << open(url).read
end
end
|
#prefix ⇒ Object
43
44
45
|
# File 'lib/drobot.rb', line 43
def prefix
Date.today.strftime("%Y-%m-")
end
|
#title ⇒ Object
38
39
40
41
|
# File 'lib/drobot.rb', line 38
def title
drobot_name = self.class.name.split("::").pop
prefix + drobot_name.downcase
end
|