Class: Cardia::Order

Inherits:
Object show all
Defined in:
lib/cardia/order.rb

Overview

This is the very minimum that’s required in order for an Order to function. You probably have your own… For home baked order classes, you need to implement methods listed below

Defined Under Namespace

Classes: Status

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(amount, description) ⇒ Order

Creates an instance: Parameters:

  • amount: The amount as an integer

  • description: Give a describing name (not used for much…)



11
12
13
14
# File 'lib/cardia/order.rb', line 11

def initialize(amount, description)
  @amount,@description = amount, description
  @reference = rand(10000)
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



5
6
7
# File 'lib/cardia/order.rb', line 5

def amount
  @amount
end

#customerObject

Returns the value of attribute customer.



6
7
8
# File 'lib/cardia/order.rb', line 6

def customer
  @customer
end

#descriptionObject (readonly)

Returns the value of attribute description.



5
6
7
# File 'lib/cardia/order.rb', line 5

def description
  @description
end

#referenceObject (readonly)

You need to provide a reference that’s guaranteed to be unique for your merchant



17
18
19
# File 'lib/cardia/order.rb', line 17

def reference
  @reference
end

#statusObject

Returns the value of attribute status.



6
7
8
# File 'lib/cardia/order.rb', line 6

def status
  @status
end

Instance Method Details

#be_confirmedObject

Callback that’s called when an order is confirmed



26
27
28
# File 'lib/cardia/order.rb', line 26

def be_confirmed
  @status = Status.confirmed
end

#compute_access_keyObject

:nodoc:



21
22
23
# File 'lib/cardia/order.rb', line 21

def compute_access_key #:nodoc:
  "ello"
end