Class: ChargeBee::Event

Inherits:
Model
  • Object
show all
Defined in:
lib/chargebee/models/event.rb

Defined Under Namespace

Classes: Content, Webhook

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

construct, #init_dependant, #init_dependant_list, #initialize, #inspect, #load, #method_missing, #to_s, uri_path

Constructor Details

This class inherits a constructor from ChargeBee::Model

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ChargeBee::Model

Instance Attribute Details

#api_versionObject

Returns the value of attribute api_version.



8
9
10
# File 'lib/chargebee/models/event.rb', line 8

def api_version
  @api_version
end

#event_typeObject

Returns the value of attribute event_type.



8
9
10
# File 'lib/chargebee/models/event.rb', line 8

def event_type
  @event_type
end

#idObject

Returns the value of attribute id.



8
9
10
# File 'lib/chargebee/models/event.rb', line 8

def id
  @id
end

#occurred_atObject

Returns the value of attribute occurred_at.



8
9
10
# File 'lib/chargebee/models/event.rb', line 8

def occurred_at
  @occurred_at
end

#sourceObject

Returns the value of attribute source.



8
9
10
# File 'lib/chargebee/models/event.rb', line 8

def source
  @source
end

#userObject

Returns the value of attribute user.



8
9
10
# File 'lib/chargebee/models/event.rb', line 8

def user
  @user
end

#webhook_failure_reasonObject

Returns the value of attribute webhook_failure_reason.



8
9
10
# File 'lib/chargebee/models/event.rb', line 8

def webhook_failure_reason
  @webhook_failure_reason
end

#webhook_statusObject

Returns the value of attribute webhook_status.



8
9
10
# File 'lib/chargebee/models/event.rb', line 8

def webhook_status
  @webhook_status
end

#webhooksObject

Returns the value of attribute webhooks.



8
9
10
# File 'lib/chargebee/models/event.rb', line 8

def webhooks
  @webhooks
end

Class Method Details

.deserialize(json) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/chargebee/models/event.rb', line 18

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

.list(params = {}, env = nil, headers = {}) ⇒ Object

OPERATIONS




37
38
39
# File 'lib/chargebee/models/event.rb', line 37

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

.retrieve(id, env = nil, headers = {}) ⇒ Object



41
42
43
# File 'lib/chargebee/models/event.rb', line 41

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

Instance Method Details

#contentObject



14
15
16
# File 'lib/chargebee/models/event.rb', line 14

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