Class: AdvancedBilling::Endpoint

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/endpoint.rb

Overview

Endpoint Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id = SKIP, url = SKIP, site_id = SKIP, status = SKIP, webhook_subscriptions = SKIP) ⇒ Endpoint

Returns a new instance of Endpoint.



59
60
61
62
63
64
65
66
# File 'lib/advanced_billing/models/endpoint.rb', line 59

def initialize(id = SKIP, url = SKIP, site_id = SKIP, status = SKIP,
               webhook_subscriptions = SKIP)
  @id = id unless id == SKIP
  @url = url unless url == SKIP
  @site_id = site_id unless site_id == SKIP
  @status = status unless status == SKIP
  @webhook_subscriptions = webhook_subscriptions unless webhook_subscriptions == SKIP
end

Instance Attribute Details

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/advanced_billing/models/endpoint.rb', line 14

def id
  @id
end

#site_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


22
23
24
# File 'lib/advanced_billing/models/endpoint.rb', line 22

def site_id
  @site_id
end

#statusString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/advanced_billing/models/endpoint.rb', line 26

def status
  @status
end

#urlString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/advanced_billing/models/endpoint.rb', line 18

def url
  @url
end

#webhook_subscriptionsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


30
31
32
# File 'lib/advanced_billing/models/endpoint.rb', line 30

def webhook_subscriptions
  @webhook_subscriptions
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/advanced_billing/models/endpoint.rb', line 69

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  url = hash.key?('url') ? hash['url'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  webhook_subscriptions =
    hash.key?('webhook_subscriptions') ? hash['webhook_subscriptions'] : SKIP

  # Create object from extracted values.
  Endpoint.new(id,
               url,
               site_id,
               status,
               webhook_subscriptions)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/advanced_billing/models/endpoint.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['url'] = 'url'
  @_hash['site_id'] = 'site_id'
  @_hash['status'] = 'status'
  @_hash['webhook_subscriptions'] = 'webhook_subscriptions'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/advanced_billing/models/endpoint.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
52
# File 'lib/advanced_billing/models/endpoint.rb', line 44

def self.optionals
  %w[
    id
    url
    site_id
    status
    webhook_subscriptions
  ]
end