Class: IabBaseController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- IabBaseController
- Includes:
- PaypalHelper
- Defined in:
- lib/hooks/controllers/iabbase_controller.rb
Constant Summary
Constants included from PaypalHelper
PaypalHelper::PAYMENT_AMOUNT_SESSION_KEY
Instance Method Summary collapse
-
#initialize ⇒ IabBaseController
constructor
A new instance of IabBaseController.
- #massage(results) ⇒ Object
-
#render_for_file(template_path, status = nil, layout = nil, locals = {}) ⇒ Object
:nodoc:.
-
#render_for_text(text = nil, status = nil, append_response = false) ⇒ Object
:nodoc:.
- #sectionPremium ⇒ Object
Methods included from PaypalHelper
#checkout, #completedpayment, #confirmpayment, #payment_amount
Constructor Details
#initialize ⇒ IabBaseController
Returns a new instance of IabBaseController.
20 21 22 23 |
# File 'lib/hooks/controllers/iabbase_controller.rb', line 20 def initialize() @widgets = Hash.new @assets = Hash.new end |
Instance Method Details
#massage(results) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/hooks/controllers/iabbase_controller.rb', line 56 def massage(results) #the search result will be an Array #the normal response will be a hash of values to be displayed #a hash entry maybe an array - this will be so when multiple occurrences of a relation is returned #a url will be returned where's there is a redirection usually for paypal if (results.is_a?(String) and results.include?("http")) return results elsif (results.is_a?(Hash)) results.each do |k,v| if (v.is_a?(HashWithIndifferentAccess)) eval("@#{k} = #{k}.public_instantiate(v)") elsif (v.is_a?(Array)) eval("@#{k} = Array.new") #typically RAILS view code would interate over the instances for display purposes v.each do |inst| eval("@#{k}.push(#{k}.public_instantiate(inst))") end end end end #nil implies there is no redirected URL return nil end |
#render_for_file(template_path, status = nil, layout = nil, locals = {}) ⇒ Object
:nodoc:
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/hooks/controllers/iabbase_controller.rb', line 25 def render_for_file(template_path, status = nil, layout = nil, locals = {}) #:nodoc: add_variables_to_assigns assert_existence_of_template_file(template_path) if use_full_path logger.info("Rendering #{template_path}" + (status ? " (#{status})" : '')) if logger p = Hash.new p[:product] = session[:product] @template.setParmsForViewUse(p) @template.setParmsForViewUse(@processMap) text = @template.render(:file => template_path, :locals => locals, :layout => layout) render_for_text text, status, true end |
#render_for_text(text = nil, status = nil, append_response = false) ⇒ Object
:nodoc:
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/hooks/controllers/iabbase_controller.rb', line 37 def render_for_text(text = nil, status = nil, append_response = false) #:nodoc: @performed_render = true response.content_type = "text/html" #added this line over the standard rails method response.headers['Status'] = interpret_status(status || DEFAULT_RENDER_STATUS_CODE) if append_response response.body ||= '' response.body << text.to_s else response.body = case text when Proc then text when nil then " " # Safari doesn't pass the headers of the return if the response is zero length else text.to_s end end end |
#sectionPremium ⇒ Object
80 81 82 83 84 85 86 |
# File 'lib/hooks/controllers/iabbase_controller.rb', line 80 def sectionPremium premium = Communicator.instance.handle(session,"SectionRating",params) respond_to do |format| format.js {render :text => "#{premium}" } end end |