Class: Erede::Sdk

Inherits:
Object
  • Object
show all
Defined in:
lib/erede/sdk.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(store) ⇒ Sdk

Returns a new instance of Sdk.



5
6
7
# File 'lib/erede/sdk.rb', line 5

def initialize(store)
  @store = store
end

Instance Attribute Details

#storeObject

Returns the value of attribute store.



3
4
5
# File 'lib/erede/sdk.rb', line 3

def store
  @store
end

Instance Method Details

#cancel(transaction) ⇒ Object



14
15
16
17
# File 'lib/erede/sdk.rb', line 14

def cancel(transaction)
  service = ::Erede::Services::CancelTransaction.new(@store, transaction)
  service.execute
end

#capture(transaction) ⇒ Object



19
20
21
22
# File 'lib/erede/sdk.rb', line 19

def capture(transaction)
  service = ::Erede::Services::CaptureTransaction.new(@store, transaction)
  service.execute
end

#create(transaction) ⇒ Object



9
10
11
12
# File 'lib/erede/sdk.rb', line 9

def create(transaction)
  service = ::Erede::Services::CreateTransaction.new(@store, transaction)
  service.execute
end

#get_by_reference(reference) ⇒ Object



30
31
32
33
34
# File 'lib/erede/sdk.rb', line 30

def get_by_reference(reference)
  service           = ::Erede::Services::GetTransaction.new(@store)
  service.reference = reference
  service.execute
end

#get_by_tid(tid) ⇒ Object



24
25
26
27
28
# File 'lib/erede/sdk.rb', line 24

def get_by_tid(tid)
  service     = ::Erede::Services::GetTransaction.new(@store)
  service.tid = tid
  service.execute
end

#get_refund(tid, refundId) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/erede/sdk.rb', line 43

def get_refund(tid, refundId)
  service         = ::Erede::Services::GetTransaction.new(@store)
  service.tid     = tid
  service.refunds = true
  service.refundId = refundId
  service.execute
end

#get_refunds(tid) ⇒ Object



36
37
38
39
40
41
# File 'lib/erede/sdk.rb', line 36

def get_refunds(tid)
  service         = ::Erede::Services::GetTransaction.new(@store)
  service.tid     = tid
  service.refunds = true
  service.execute
end