Class: PaysonAPI::V1::Envelope

Inherits:
Object
  • Object
show all
Defined in:
lib/payson_api/v1/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.



13
14
15
16
17
# File 'lib/payson_api/v1/envelope.rb', line 13

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.



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

def ack
  @ack
end

#correlation_idObject

Returns the value of attribute correlation_id.



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

def correlation_id
  @correlation_id
end

#timestampObject

Returns the value of attribute timestamp.



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

def timestamp
  @timestamp
end

Class Method Details

.parse(data) ⇒ Object



19
20
21
22
23
24
# File 'lib/payson_api/v1/envelope.rb', line 19

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']
  new(ack, timestamp, correlation_id)
end