Sha256: 5eaa44f5a8e7248b79972aaa1b3e5ab4ed67365997083b8b32326db6517ed67e

Contents?: true

Size: 774 Bytes

Versions: 7

Compression:

Stored size: 774 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

7 entries across 7 versions & 1 rubygems

Version Path
chargebee-1.5.6 lib/chargebee/models/event.rb
chargebee-1.5.5 lib/chargebee/models/event.rb
chargebee-1.5.4 lib/chargebee/models/event.rb
chargebee-1.5.3 lib/chargebee/models/event.rb
chargebee-1.5.2 lib/chargebee/models/event.rb
chargebee-1.5.1 lib/chargebee/models/event.rb
chargebee-1.5.0 lib/chargebee/models/event.rb