Class: AdvancedBilling::PortalManagementLink

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

Overview

PortalManagementLink Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(url: SKIP, fetch_count: SKIP, created_at: SKIP, new_link_available_at: SKIP, expires_at: SKIP, last_invite_sent_at: SKIP, additional_properties: {}) ⇒ PortalManagementLink

Returns a new instance of PortalManagementLink.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/advanced_billing/models/portal_management_link.rb', line 68

def initialize(url: SKIP, fetch_count: SKIP, created_at: SKIP,
               new_link_available_at: SKIP, expires_at: SKIP,
               last_invite_sent_at: SKIP, additional_properties: {})
  @url = url unless url == SKIP
  @fetch_count = fetch_count unless fetch_count == SKIP
  @created_at = created_at unless created_at == SKIP
  @new_link_available_at = new_link_available_at unless new_link_available_at == SKIP
  @expires_at = expires_at unless expires_at == SKIP
  @last_invite_sent_at = last_invite_sent_at unless last_invite_sent_at == SKIP

  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end
end

Instance Attribute Details

#created_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


23
24
25
# File 'lib/advanced_billing/models/portal_management_link.rb', line 23

def created_at
  @created_at
end

#expires_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


31
32
33
# File 'lib/advanced_billing/models/portal_management_link.rb', line 31

def expires_at
  @expires_at
end

#fetch_countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


19
20
21
# File 'lib/advanced_billing/models/portal_management_link.rb', line 19

def fetch_count
  @fetch_count
end

#last_invite_sent_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


35
36
37
# File 'lib/advanced_billing/models/portal_management_link.rb', line 35

def last_invite_sent_at
  @last_invite_sent_at
end

TODO: Write general description for this method

Returns:

  • (DateTime)


27
28
29
# File 'lib/advanced_billing/models/portal_management_link.rb', line 27

def new_link_available_at
  @new_link_available_at
end

#urlString

TODO: Write general description for this method

Returns:

  • (String)


15
16
17
# File 'lib/advanced_billing/models/portal_management_link.rb', line 15

def url
  @url
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/advanced_billing/models/portal_management_link.rb', line 85

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  url = hash.key?('url') ? hash['url'] : SKIP
  fetch_count = hash.key?('fetch_count') ? hash['fetch_count'] : SKIP
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               else
                 SKIP
               end
  new_link_available_at = if hash.key?('new_link_available_at')
                            (DateTimeHelper.from_rfc3339(hash['new_link_available_at']) if hash['new_link_available_at'])
                          else
                            SKIP
                          end
  expires_at = if hash.key?('expires_at')
                 (DateTimeHelper.from_rfc3339(hash['expires_at']) if hash['expires_at'])
               else
                 SKIP
               end
  last_invite_sent_at = if hash.key?('last_invite_sent_at')
                          (DateTimeHelper.from_rfc3339(hash['last_invite_sent_at']) if hash['last_invite_sent_at'])
                        else
                          SKIP
                        end

  # Clean out expected properties from Hash.
  names.each_value { |k| hash.delete(k) }

  # Create object from extracted values.
  PortalManagementLink.new(url: url,
                           fetch_count: fetch_count,
                           created_at: created_at,
                           new_link_available_at: new_link_available_at,
                           expires_at: expires_at,
                           last_invite_sent_at: last_invite_sent_at,
                           additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
47
# File 'lib/advanced_billing/models/portal_management_link.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['url'] = 'url'
  @_hash['fetch_count'] = 'fetch_count'
  @_hash['created_at'] = 'created_at'
  @_hash['new_link_available_at'] = 'new_link_available_at'
  @_hash['expires_at'] = 'expires_at'
  @_hash['last_invite_sent_at'] = 'last_invite_sent_at'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
65
66
# File 'lib/advanced_billing/models/portal_management_link.rb', line 62

def self.nullables
  %w[
    last_invite_sent_at
  ]
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
57
58
59
# File 'lib/advanced_billing/models/portal_management_link.rb', line 50

def self.optionals
  %w[
    url
    fetch_count
    created_at
    new_link_available_at
    expires_at
    last_invite_sent_at
  ]
end

Instance Method Details

#to_custom_created_atObject



125
126
127
# File 'lib/advanced_billing/models/portal_management_link.rb', line 125

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_expires_atObject



133
134
135
# File 'lib/advanced_billing/models/portal_management_link.rb', line 133

def to_custom_expires_at
  DateTimeHelper.to_rfc3339(expires_at)
end

#to_custom_last_invite_sent_atObject



137
138
139
# File 'lib/advanced_billing/models/portal_management_link.rb', line 137

def to_custom_last_invite_sent_at
  DateTimeHelper.to_rfc3339(last_invite_sent_at)
end


129
130
131
# File 'lib/advanced_billing/models/portal_management_link.rb', line 129

def to_custom_new_link_available_at
  DateTimeHelper.to_rfc3339(new_link_available_at)
end