Class: MC2P::Sale

Inherits:
ReadOnlyObjectItem show all
Defined in:
lib/objects.rb

Overview

Sale object

Instance Attribute Summary

Attributes inherited from ObjectItemMixin

#_deleted, #json_dict, #resource

Instance Method Summary collapse

Methods inherited from ReadOnlyObjectItem

get, #retrieve

Methods inherited from ObjectItem

#method_missing, #respond_to?, #respond_to_missing?, #set

Methods inherited from ObjectItemMixin

#id_required_and_not_deleted, #to_s

Constructor Details

#initialize(json_dict, resource) ⇒ Sale

Initializes an object item Params:

json_dict

Data of the object

resource

Resource used to delete, save, create or retrieve the object



68
69
70
71
# File 'lib/objects.rb', line 68

def initialize(json_dict, resource)
  super(json_dict, resource)
  @rcv_mixin = RefundCaptureVoidObjectItemMixin.new(json_dict, resource)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MC2P::ObjectItem

Instance Method Details

#capture(data = nil) ⇒ Object

Capture the object item Params:

data

data to send

Returns: response dictionary



89
90
91
92
93
94
95
# File 'lib/objects.rb', line 89

def capture(data = nil)
  @rcv_mixin.json_dict = @json_dict
  @rcv_mixin._deleted = @_deleted
  @rcv_mixin.capture(data)
  @json_dict = @rcv_mixin.json_dict
  @_deleted = @rcv_mixin._deleted
end

#refund(data = nil) ⇒ Object

Refund the object item Params:

data

data to send

Returns: response dictionary



77
78
79
80
81
82
83
# File 'lib/objects.rb', line 77

def refund(data = nil)
  @rcv_mixin.json_dict = @json_dict
  @rcv_mixin._deleted = @_deleted
  @rcv_mixin.refund(data)
  @json_dict = @rcv_mixin.json_dict
  @_deleted = @rcv_mixin._deleted
end

#void(data = nil) ⇒ Object

Void the object item Params:

data

data to send

Returns: response dictionary



101
102
103
104
105
106
107
# File 'lib/objects.rb', line 101

def void(data = nil)
  @rcv_mixin.json_dict = @json_dict
  @rcv_mixin._deleted = @_deleted
  @rcv_mixin.void(data)
  @json_dict = @rcv_mixin.json_dict
  @_deleted = @rcv_mixin._deleted
end