Class: AdvancedBilling::NetTerms
- Defined in:
- lib/advanced_billing/models/net_terms.rb
Overview
NetTerms Model.
Instance Attribute Summary collapse
-
#automatic_net_terms ⇒ Integer
TODO: Write general description for this method.
-
#custom_net_terms_enabled ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#default_net_terms ⇒ Integer
TODO: Write general description for this method.
-
#net_terms_on_remittance_signups_enabled ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#remittance_net_terms ⇒ Integer
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(default_net_terms: 0, automatic_net_terms: 0, remittance_net_terms: 0, net_terms_on_remittance_signups_enabled: false, custom_net_terms_enabled: false, additional_properties: {}) ⇒ NetTerms
constructor
A new instance of NetTerms.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(default_net_terms: 0, automatic_net_terms: 0, remittance_net_terms: 0, net_terms_on_remittance_signups_enabled: false, custom_net_terms_enabled: false, additional_properties: {}) ⇒ NetTerms
Returns a new instance of NetTerms.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/advanced_billing/models/net_terms.rb', line 60 def initialize(default_net_terms: 0, automatic_net_terms: 0, remittance_net_terms: 0, net_terms_on_remittance_signups_enabled: false, custom_net_terms_enabled: false, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @default_net_terms = default_net_terms unless default_net_terms == SKIP @automatic_net_terms = automatic_net_terms unless automatic_net_terms == SKIP @remittance_net_terms = remittance_net_terms unless remittance_net_terms == SKIP unless net_terms_on_remittance_signups_enabled == SKIP @net_terms_on_remittance_signups_enabled = net_terms_on_remittance_signups_enabled end @custom_net_terms_enabled = custom_net_terms_enabled unless custom_net_terms_enabled == SKIP end |
Instance Attribute Details
#automatic_net_terms ⇒ Integer
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/net_terms.rb', line 18 def automatic_net_terms @automatic_net_terms end |
#custom_net_terms_enabled ⇒ TrueClass | FalseClass
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/net_terms.rb', line 30 def custom_net_terms_enabled @custom_net_terms_enabled end |
#default_net_terms ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/net_terms.rb', line 14 def default_net_terms @default_net_terms end |
#net_terms_on_remittance_signups_enabled ⇒ TrueClass | FalseClass
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/net_terms.rb', line 26 def net_terms_on_remittance_signups_enabled @net_terms_on_remittance_signups_enabled end |
#remittance_net_terms ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/net_terms.rb', line 22 def remittance_net_terms @remittance_net_terms end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/advanced_billing/models/net_terms.rb', line 80 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. default_net_terms = hash['default_net_terms'] ||= 0 automatic_net_terms = hash['automatic_net_terms'] ||= 0 remittance_net_terms = hash['remittance_net_terms'] ||= 0 net_terms_on_remittance_signups_enabled = hash['net_terms_on_remittance_signups_enabled'] ||= false custom_net_terms_enabled = hash['custom_net_terms_enabled'] ||= false # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. NetTerms.new(default_net_terms: default_net_terms, automatic_net_terms: automatic_net_terms, remittance_net_terms: remittance_net_terms, net_terms_on_remittance_signups_enabled: net_terms_on_remittance_signups_enabled, custom_net_terms_enabled: custom_net_terms_enabled, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/advanced_billing/models/net_terms.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['default_net_terms'] = 'default_net_terms' @_hash['automatic_net_terms'] = 'automatic_net_terms' @_hash['remittance_net_terms'] = 'remittance_net_terms' @_hash['net_terms_on_remittance_signups_enabled'] = 'net_terms_on_remittance_signups_enabled' @_hash['custom_net_terms_enabled'] = 'custom_net_terms_enabled' @_hash end |
.nullables ⇒ Object
An array for nullable fields
56 57 58 |
# File 'lib/advanced_billing/models/net_terms.rb', line 56 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 50 51 52 53 |
# File 'lib/advanced_billing/models/net_terms.rb', line 45 def self.optionals %w[ default_net_terms automatic_net_terms remittance_net_terms net_terms_on_remittance_signups_enabled custom_net_terms_enabled ] end |