Class: Suitcase::PaymentOption
- Inherits:
-
Object
- Object
- Suitcase::PaymentOption
- Extended by:
- Helpers
- Defined in:
- lib/suitcase/hotel/payment_option.rb
Instance Attribute Summary (collapse)
-
- (Object) code
Returns the value of attribute code.
-
- (Object) name
Returns the value of attribute name.
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (PaymentOption) initialize(code, name)
constructor
A new instance of PaymentOption.
Methods included from Helpers
base_url, main_url, parse_response, update_session, url
Constructor Details
- (PaymentOption) initialize(code, name)
A new instance of PaymentOption
6 7 8 9 |
# File 'lib/suitcase/hotel/payment_option.rb', line 6 def initialize(code, name) @code = code @name = name end |
Instance Attribute Details
- (Object) code
Returns the value of attribute code
3 4 5 |
# File 'lib/suitcase/hotel/payment_option.rb', line 3 def code @code end |
- (Object) name
Returns the value of attribute name
3 4 5 |
# File 'lib/suitcase/hotel/payment_option.rb', line 3 def name @name end |
Class Method Details
+ (Object) find(info)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/suitcase/hotel/payment_option.rb', line 11 def self.find(info) params = { "currencyCode" => info[:currency_code] } if Configuration.cache? and Configuration.cache.cached?(:paymentInfo, params) types_raw = Configuration.cache.get_query(:paymentInfo, params) else types_raw = parse_response(url(:method => "paymentInfo", :params => params, :session => info[:session])) Configuration.cache.save_query(:paymentInfo, params, types_raw) if Configuration.cache? end = [] types_raw["HotelPaymentResponse"].each do |raw| types = raw[0] != "PaymentType" ? [] : raw[1] types.each do |type| .push PaymentOption.new(type["code"], type["name"]) end end update_session(types_raw, info[:session]) end |