Class: EportRequestPlainText

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

Constant Summary collapse

OPERATION_TYPES =
[
  "CHECK",
  "OPERATION",
  "CONFIRM",
  "CANCEL"
]
STRING_SEPARATOR =
"\r\n"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ EportRequestPlainText

Returns a new instance of EportRequestPlainText.



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/eport_request_plain_text.rb', line 21

def initialize(&block)
  @operation_type = nil
  @operation_id   = nil
  @product_id     = nil
  @value          = nil
  @account        = nil
  
  if block
    block.call
  end
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



11
12
13
# File 'lib/eport_request_plain_text.rb', line 11

def 
  @account
end

#operation_idObject

Returns the value of attribute operation_id.



11
12
13
# File 'lib/eport_request_plain_text.rb', line 11

def operation_id
  @operation_id
end

#operation_typeObject

Returns the value of attribute operation_type.



11
12
13
# File 'lib/eport_request_plain_text.rb', line 11

def operation_type
  @operation_type
end

#product_idObject

Returns the value of attribute product_id.



11
12
13
# File 'lib/eport_request_plain_text.rb', line 11

def product_id
  @product_id
end

#valueObject

Returns the value of attribute value.



11
12
13
# File 'lib/eport_request_plain_text.rb', line 11

def value
  @value
end

Instance Method Details

#bodyObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/eport_request_plain_text.rb', line 33

def body
  output = ""
  output << @operation_type + STRING_SEPARATOR
  output << key_value("id", @operation_id)
  output << key_value("checkid", @operation_id)
  output << key_value("product", @product_id)
  output << key_value("value", @value)
  output << key_value("account", @account)
  output
end