Class: Tinypass::PurchaseRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/tinypass/ui/purchase_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(offer, options = {}) ⇒ PurchaseRequest

Returns a new instance of PurchaseRequest.



5
6
7
# File 'lib/tinypass/ui/purchase_request.rb', line 5

def initialize(offer, options = {})
  @primary_offer, @options = offer, options
end

Instance Attribute Details

#callbackObject

Returns the value of attribute callback.



3
4
5
# File 'lib/tinypass/ui/purchase_request.rb', line 3

def callback
  @callback
end

#client_ipObject

Returns the value of attribute client_ip.



3
4
5
# File 'lib/tinypass/ui/purchase_request.rb', line 3

def client_ip
  @client_ip
end

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/tinypass/ui/purchase_request.rb', line 3

def options
  @options
end

#primary_offerObject

Returns the value of attribute primary_offer.



3
4
5
# File 'lib/tinypass/ui/purchase_request.rb', line 3

def primary_offer
  @primary_offer
end

#secondary_offerObject

Returns the value of attribute secondary_offer.



3
4
5
# File 'lib/tinypass/ui/purchase_request.rb', line 3

def secondary_offer
  @secondary_offer
end

#user_refObject

Returns the value of attribute user_ref.



3
4
5
# File 'lib/tinypass/ui/purchase_request.rb', line 3

def user_ref
  @user_ref
end

Instance Method Details



14
15
16
17
18
19
20
21
22
# File 'lib/tinypass/ui/purchase_request.rb', line 14

def generate_link(return_url, cancel_url)
  self.options['return_url'] = return_url if return_url
  self.options['cancel_url'] = cancel_url if cancel_url

  builder = ClientBuilder.new
  ticket_string = builder.build_purchase_request(self)

  Config.endpoint + Config::CONTEXT + "/jsapi/auth.js?aid=#{ Tinypass.aid }&r=#{ ticket_string }"
end

#generate_tagObject



9
10
11
12
# File 'lib/tinypass/ui/purchase_request.rb', line 9

def generate_tag
  widget = HtmlWidget.new
  widget.create_button_html(self)
end