Class: AdvancedBilling::PublicKey

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

Overview

PublicKey Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(public_key: SKIP, requires_security_token: SKIP, created_at: SKIP, additional_properties: {}) ⇒ PublicKey

Returns a new instance of PublicKey.



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

def initialize(public_key: SKIP, requires_security_token: SKIP,
               created_at: SKIP, additional_properties: {})
  @public_key = public_key unless public_key == SKIP
  @requires_security_token = requires_security_token unless requires_security_token == SKIP
  @created_at = created_at unless created_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/public_key.rb', line 23

def created_at
  @created_at
end

#public_keyString

TODO: Write general description for this method

Returns:

  • (String)


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

def public_key
  @public_key
end

#requires_security_tokenTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def requires_security_token
  @requires_security_token
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/advanced_billing/models/public_key.rb', line 61

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  public_key = hash.key?('public_key') ? hash['public_key'] : SKIP
  requires_security_token =
    hash.key?('requires_security_token') ? hash['requires_security_token'] : SKIP
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               else
                 SKIP
               end

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

  # Create object from extracted values.
  PublicKey.new(public_key: public_key,
                requires_security_token: requires_security_token,
                created_at: created_at,
                additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
# File 'lib/advanced_billing/models/public_key.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['public_key'] = 'public_key'
  @_hash['requires_security_token'] = 'requires_security_token'
  @_hash['created_at'] = 'created_at'
  @_hash
end

.nullablesObject

An array for nullable fields



44
45
46
# File 'lib/advanced_billing/models/public_key.rb', line 44

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    public_key
    requires_security_token
    created_at
  ]
end

Instance Method Details

#to_custom_created_atObject



84
85
86
# File 'lib/advanced_billing/models/public_key.rb', line 84

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end