Class: IpnMessage
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- IpnMessage
- Defined in:
- lib/generators/templates/ipn_message.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#unique_ids ⇒ Object
returns hash of unique_id:string => status:bool.
Class Method Details
.create_from_message(hash) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/generators/templates/ipn_message.rb', line 5 def self.(hash) = IpnMessage.new .body = hash.to_yaml .success = hash["ACK"] == "Success" .correlation_id = hash["correlation_id"] .transaction_id = hash["transaction_id"] .save return end |
Instance Method Details
#unique_ids ⇒ Object
returns hash of unique_id:string => status:bool
18 19 20 21 22 23 24 25 26 |
# File 'lib/generators/templates/ipn_message.rb', line 18 def unique_ids hash = YAML.load(self.body) return hash.inject({}){|acc, (k,v)| k.to_s =~ /unique_id_(\d+)/ acc[v] = hash["status_#{$1}"] == "Completed" if $1 acc } end |