Sha256: 8673815f67937caa01b7066572c5fec8780852a0237b8456ad082d679091d215

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

require 'active_support/core_ext/module/delegation'

module Buckaroo
  module Ideal
    class Order
      def self.defaults
        { :currency => 'EUR' }
      end
      
      # @return [Float] The total amount that this order is for
      attr_accessor :amount
      
      # @return [String] The currency that is being used for the transaction
      attr_accessor :currency
      
      # @return [String] The bank that will be used for the order's transaction.
      attr_accessor :bank
      
      # @return [String] The description for the transaction
      attr_accessor :description
      
      # @return [String] The reference that will be passed to the response URLs
      attr_accessor :reference
      
      # @return [String] The invoice number that is associated with the order
      attr_accessor :invoice_number
      
      # Initialize a new +Order+ with the given settings. Uses the defaults from
      # +Buckaroo::Ideal::Order.defaults+ for settings that are not specified.
      #
      # @return [Buckaroo::Ideal::Order] The +Order+ instance
      def initialize(settings = {})
        settings = self.class.defaults.merge(settings)
        settings.each do |key, value|
          set key, value
        end
      end
      
      private
      
      def set(key, value)
        instance_variable_set(:"@#{key}", value)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
buckaroo-ideal-0.0.2 lib/buckaroo-ideal/order.rb