Sha256: ceaf68e6adc291167ed18224899180d4e3cd3650adc76c545b63b9b752574e83

Contents?: true

Size: 1.22 KB

Versions: 20

Compression:

Stored size: 1.22 KB

Contents

module ChargeBee
  class Event < Model

    class Webhook < Model
      attr_accessor :id, :webhook_status
    end

  attr_accessor :id, :occurred_at, :source, :user, :webhook_status, :webhook_failure_reason, :webhooks,
  :event_type, :api_version, :origin_user

  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

    api_version = webhook_data["api_version"]
    if api_version != nil && api_version.casecmp(Environment::API_VERSION) != 0
       raise Error.new("API version [#{api_version.upcase}] in response does not match with client library API version [#{Environment::API_VERSION.upcase}]")
    end

    webhook_data = Util.symbolize_keys(webhook_data)
    Event.construct(webhook_data)
  end

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

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

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

  end # ~Event
end # ~ChargeBee

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
chargebee-2.49.0 lib/chargebee/models/event.rb
chargebee-2.48.0 lib/chargebee/models/event.rb
chargebee-2.47.1 lib/chargebee/models/event.rb
chargebee-2.47.0 lib/chargebee/models/event.rb
chargebee-2.47.0.beta.1 lib/chargebee/models/event.rb
chargebee-2.46.0 lib/chargebee/models/event.rb
chargebee-2.45.0 lib/chargebee/models/event.rb
chargebee-2.44.1 lib/chargebee/models/event.rb
chargebee-2.44.0 lib/chargebee/models/event.rb
chargebee-2.43.0 lib/chargebee/models/event.rb
chargebee-2.42.0 lib/chargebee/models/event.rb
chargebee-2.41.0 lib/chargebee/models/event.rb
chargebee-2.40.0 lib/chargebee/models/event.rb
chargebee-2.38.1 lib/chargebee/models/event.rb
chargebee-2.38.0 lib/chargebee/models/event.rb
chargebee-2.37.1 lib/chargebee/models/event.rb
chargebee-2.37.0 lib/chargebee/models/event.rb
chargebee-2.36.2 lib/chargebee/models/event.rb
chargebee-2.36.1 lib/chargebee/models/event.rb
chargebee-2.36.0 lib/chargebee/models/event.rb