Class: Squeegee::Base
- Inherits:
-
Object
- Object
- Squeegee::Base
- Defined in:
- lib/squeegee/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#agent ⇒ Object
writeonly
Sets the attribute agent.
-
#amount ⇒ Object
writeonly
Sets the attribute amount.
-
#due_at ⇒ Object
writeonly
Sets the attribute due_at.
-
#keys ⇒ Object
writeonly
Sets the attribute keys.
-
#paid ⇒ Object
writeonly
Sets the attribute paid.
Instance Method Summary collapse
Instance Attribute Details
#agent=(value) ⇒ Object (writeonly)
Sets the attribute agent
3 4 5 |
# File 'lib/squeegee/base.rb', line 3 def agent=(value) @agent = value end |
#amount=(value) ⇒ Object (writeonly)
Sets the attribute amount
3 4 5 |
# File 'lib/squeegee/base.rb', line 3 def amount=(value) @amount = value end |
#due_at=(value) ⇒ Object (writeonly)
Sets the attribute due_at
3 4 5 |
# File 'lib/squeegee/base.rb', line 3 def due_at=(value) @due_at = value end |
#keys=(value) ⇒ Object (writeonly)
Sets the attribute keys
3 4 5 |
# File 'lib/squeegee/base.rb', line 3 def keys=(value) @keys = value end |
#paid=(value) ⇒ Object (writeonly)
Sets the attribute paid
3 4 5 |
# File 'lib/squeegee/base.rb', line 3 def paid=(value) @paid = value end |
Instance Method Details
#get(url) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/squeegee/base.rb', line 16 def get(url) @agent ||= Mechanize.new @agent.log = Logger.new 'squeegee.log' @agent.user_agent = "Mozilla/5.0 (Squeegee)" @agent.default_encoding = "utf8" @agent.agent.http.ssl_version = :SSLv3 @agent.get(url) end |
#params(args) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/squeegee/base.rb', line 4 def params(args) missing_keys = [] return unless defined? @keys @keys.each do |key| missing_keys << key unless args.has_key?(key.to_sym) end if missing_keys.any? raise Error::InvalidParams, "missing parameters #{missing_keys.map {|key| "`#{key}` "}.join}" end end |