Method: AdvancedBilling::PendingCancellationChange.from_hash
- Defined in:
- lib/advanced_billing/models/pending_cancellation_change.rb
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/advanced_billing/models/pending_cancellation_change.rb', line 50 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. cancellation_state = hash.key?('cancellation_state') ? hash['cancellation_state'] : nil cancels_at = if hash.key?('cancels_at') (DateTimeHelper.from_rfc3339(hash['cancels_at']) if hash['cancels_at']) end # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. PendingCancellationChange.new(cancellation_state: cancellation_state, cancels_at: cancels_at, additional_properties: hash) end |