Sha256: 9428c855ecb773b1bbd1e6288c089bdf885229a302d765f341a62033d230b307

Contents?: true

Size: 775 Bytes

Versions: 3

Compression:

Stored size: 775 Bytes

Contents

module ChargeBee
  class Event < Model

  attr_accessor :id, :occurred_at, :source, :webhook_status, :webhook_failure_reason, :event_type

  class Content < Result
  end

  def content
    Content.new(@values[:content])
  end

  def self.deserialize(json)
    begin
      webhook_data = JSON.parse(json)
    rescue JSON::ParserError => e
      raise Error.new("Invalid webhook object to deserialize. #{e}",e)
    end
    webhook_data = Util.symbolize_keys(webhook_data)
    Event.construct(webhook_data)
  end

  # OPERATIONS
  #-----------

  def self.list(params={}, env=nil)
    Request.send('get', uri_path("events"), params, env)
  end

  def self.retrieve(id, env=nil)
    Request.send('get', uri_path("events",id.to_s), {}, env)
  end

  end # ~Event
end # ~ChargeBee

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chargebee-1.4.9 lib/chargebee/models/event.rb
chargebee-1.4.8 lib/chargebee/models/event.rb
chargebee-1.4.7 lib/chargebee/models/event.rb