Class: PaysonAPI::Envelope

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

Constant Summary collapse

FORMAT_STRING =
"responseEnvelope.%s"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ack, timestamp, correlation_id) ⇒ Envelope

Returns a new instance of Envelope.



8
9
10
11
12
# File 'lib/payson_api/envelope.rb', line 8

def initialize(ack, timestamp, correlation_id)
  @ack = ack
  @timestamp = timestamp
  @correlation_id = correlation_id
end

Instance Attribute Details

#ackObject

Returns the value of attribute ack.



5
6
7
# File 'lib/payson_api/envelope.rb', line 5

def ack
  @ack
end

#correlation_idObject

Returns the value of attribute correlation_id.



5
6
7
# File 'lib/payson_api/envelope.rb', line 5

def correlation_id
  @correlation_id
end

#timestampObject

Returns the value of attribute timestamp.



5
6
7
# File 'lib/payson_api/envelope.rb', line 5

def timestamp
  @timestamp
end

Class Method Details

.parse(data) ⇒ Object



14
15
16
17
18
19
# File 'lib/payson_api/envelope.rb', line 14

def self.parse(data)
  ack = data[FORMAT_STRING % 'ack']
  timestamp = DateTime.parse(CGI.unescape(data[FORMAT_STRING % 'timestamp'].to_s))
  correlation_id = data[FORMAT_STRING % 'correlationId']
  self.new(ack, timestamp, correlation_id)
end