Class: AdvancedBilling::SubscriptionNote
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::SubscriptionNote
- Defined in:
- lib/advanced_billing/models/subscription_note.rb
Overview
SubscriptionNote Model.
Instance Attribute Summary collapse
-
#body ⇒ String
TODO: Write general description for this method.
-
#created_at ⇒ DateTime
TODO: Write general description for this method.
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#sticky ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#subscription_id ⇒ Integer
TODO: Write general description for this method.
-
#updated_at ⇒ DateTime
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(id: SKIP, body: SKIP, subscription_id: SKIP, created_at: SKIP, updated_at: SKIP, sticky: SKIP, additional_properties: {}) ⇒ SubscriptionNote
constructor
A new instance of SubscriptionNote.
- #to_custom_created_at ⇒ Object
- #to_custom_updated_at ⇒ Object
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(id: SKIP, body: SKIP, subscription_id: SKIP, created_at: SKIP, updated_at: SKIP, sticky: SKIP, additional_properties: {}) ⇒ SubscriptionNote
Returns a new instance of SubscriptionNote.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/advanced_billing/models/subscription_note.rb', line 66 def initialize(id: SKIP, body: SKIP, subscription_id: SKIP, created_at: SKIP, updated_at: SKIP, sticky: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @id = id unless id == SKIP @body = body unless body == SKIP @subscription_id = subscription_id unless subscription_id == SKIP @created_at = created_at unless created_at == SKIP @updated_at = updated_at unless updated_at == SKIP @sticky = sticky unless sticky == SKIP end |
Instance Attribute Details
#body ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/advanced_billing/models/subscription_note.rb', line 19 def body @body end |
#created_at ⇒ DateTime
TODO: Write general description for this method
27 28 29 |
# File 'lib/advanced_billing/models/subscription_note.rb', line 27 def created_at @created_at end |
#id ⇒ Integer
TODO: Write general description for this method
15 16 17 |
# File 'lib/advanced_billing/models/subscription_note.rb', line 15 def id @id end |
#sticky ⇒ TrueClass | FalseClass
TODO: Write general description for this method
35 36 37 |
# File 'lib/advanced_billing/models/subscription_note.rb', line 35 def sticky @sticky end |
#subscription_id ⇒ Integer
TODO: Write general description for this method
23 24 25 |
# File 'lib/advanced_billing/models/subscription_note.rb', line 23 def subscription_id @subscription_id end |
#updated_at ⇒ DateTime
TODO: Write general description for this method
31 32 33 |
# File 'lib/advanced_billing/models/subscription_note.rb', line 31 def updated_at @updated_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
83 84 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 |
# File 'lib/advanced_billing/models/subscription_note.rb', line 83 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP body = hash.key?('body') ? hash['body'] : SKIP subscription_id = hash.key?('subscription_id') ? hash['subscription_id'] : SKIP created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) else SKIP end updated_at = if hash.key?('updated_at') (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at']) else SKIP end sticky = hash.key?('sticky') ? hash['sticky'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. SubscriptionNote.new(id: id, body: body, subscription_id: subscription_id, created_at: created_at, updated_at: updated_at, sticky: sticky, additional_properties: additional_properties) end |
.names ⇒ Object
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/subscription_note.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['body'] = 'body' @_hash['subscription_id'] = 'subscription_id' @_hash['created_at'] = 'created_at' @_hash['updated_at'] = 'updated_at' @_hash['sticky'] = 'sticky' @_hash end |
.nullables ⇒ Object
An array for nullable fields
62 63 64 |
# File 'lib/advanced_billing/models/subscription_note.rb', line 62 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/advanced_billing/models/subscription_note.rb', line 50 def self.optionals %w[ id body subscription_id created_at updated_at sticky ] end |
Instance Method Details
#to_custom_created_at ⇒ Object
116 117 118 |
# File 'lib/advanced_billing/models/subscription_note.rb', line 116 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_updated_at ⇒ Object
120 121 122 |
# File 'lib/advanced_billing/models/subscription_note.rb', line 120 def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end |