Class: HungSecondGem::Hola
- Inherits:
-
Object
- Object
- HungSecondGem::Hola
- Includes:
- HTTParty
- Defined in:
- lib/hung_secondGem/version.rb
Instance Attribute Summary collapse
-
#last_res ⇒ Object
Returns the value of attribute last_res.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#resquest ⇒ Object
readonly
Returns the value of attribute resquest.
Instance Method Summary collapse
- #hello ⇒ Object
-
#initialize(opts = {}) ⇒ Hola
constructor
A new instance of Hola.
- #mergeOpt(opts = {}) ⇒ Object
-
#perform_request(http_method, path, options = {}, &block) ⇒ Object
:nodoc:.
-
#process_cookies(options) ⇒ Object
:nodoc:.
- #process_headers(options) ⇒ Object
- #setDebug ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Hola
Returns a new instance of Hola.
17 18 |
# File 'lib/hung_secondGem/version.rb', line 17 def initialize() end |
Instance Attribute Details
#last_res ⇒ Object
Returns the value of attribute last_res.
13 14 15 |
# File 'lib/hung_secondGem/version.rb', line 13 def last_res @last_res end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
14 15 16 |
# File 'lib/hung_secondGem/version.rb', line 14 def response @response end |
#resquest ⇒ Object (readonly)
Returns the value of attribute resquest.
15 16 17 |
# File 'lib/hung_secondGem/version.rb', line 15 def resquest @resquest end |
Instance Method Details
#hello ⇒ Object
65 66 67 |
# File 'lib/hung_secondGem/version.rb', line 65 def hello puts "Hello Hung" end |
#mergeOpt(opts = {}) ⇒ Object
24 25 26 27 |
# File 'lib/hung_secondGem/version.rb', line 24 def mergeOpt(opts={}) self.class..merge(opts) puts self.class. end |
#perform_request(http_method, path, options = {}, &block) ⇒ Object
:nodoc:
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/hung_secondGem/version.rb', line 34 def perform_request(http_method, path, ={}, &block) #:nodoc: method = eval("Net::HTTP::#{http_method.to_s.capitalize}") = ModuleInheritableAttributes.hash_deep_dup(self.class.).merge() process_headers() () puts begin @response = HTTParty::Request.new(method, path, ).perform(&block) setDebug rescue => e puts "Rescued #{e.inspect}" setDebug end @response end |
#process_cookies(options) ⇒ Object
:nodoc:
59 60 61 62 63 |
# File 'lib/hung_secondGem/version.rb', line 59 def () #:nodoc: return unless [:cookies] || self.class..any? [:headers] ||= headers.dup [:headers]['cookie'] = .merge(.delete(:cookies) || {}). end |
#process_headers(options) ⇒ Object
53 54 55 56 57 |
# File 'lib/hung_secondGem/version.rb', line 53 def process_headers() if [:headers] && headers.any? [:headers] = headers.merge([:headers]) end end |
#setDebug ⇒ Object
29 30 31 32 |
# File 'lib/hung_secondGem/version.rb', line 29 def setDebug self.class.debug_output $stdout self.class.debug_output $stderr end |