class Bfwd::InvoiceLine

An invoice-line represents the portion of an invoice specific to one particular pricing-component and its associated pricing-component-value.

Attributes

calculation[RW]

{ "description" : "A human readable explanation of how the value of the invoice-line was calculated.", "verbs":["POST","PUT","GET"] }

changed_by[RW]

{ "description" : "ID of the user who last updated the entity.", "verbs":[] }

charge_type[RW]

{ "description" : "charge-type.", "verbs":["POST","PUT","GET"] }

child_invoice_id[RW]

The ID of the invoice that is associated with the invoice-line.

component_value[RW]

{ "description" : "The component value for the unit-of-measure that is associated with the invoice-line.", "verbs":["POST","PUT","GET"] }

cost[RW]

{ "description" : "The cost of the invoice-line including tax.", "verbs":["POST","PUT","GET"] }

created[RW]

{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }

description[RW]

{ "description" : "The human readable description of the invoice-line.", "verbs":["POST","PUT","GET"] }

id[RW]

{ "description" : "ID of the invoice-line.", "verbs":["POST","PUT","GET"] }

invoice_id[RW]

{ "description" : "invoice associated with the invoice-line.", "verbs":["POST","PUT","GET"] }

name[RW]

{ "description" : "The human readable name of the invoice-line.", "verbs":["POST","PUT","GET"] }

organization_id[RW]

{ "description" : "ID of the organization associated with the invoice-line.", "verbs":["POST","PUT","GET"] }

period_end[RW]

The period end of the charge.

period_start[RW]

The period start of the charge.

pricing_component_id[RW]

The ID of the pricing-component that is associated with the invoice-line.

pricing_component_name[RW]

The name of the pricing-component that is associated with the invoice-line.

pricing_component_type[RW]

{ "description" : "The type of the pricing component associated with the invoice line.", "verbs":["POST","PUT","GET"] }

product_id[RW]

{ "description" : "the product ID associated with the invoice-line.", "verbs":["POST","PUT","GET"] }

product_name[RW]

{ "description" : "the product name associated with the invoice-line.", "verbs":["POST","PUT","GET"] }

product_rate_plan_id[RW]

{ "description" : "the product rate plan ID associated with the invoice-line.", "verbs":["POST","PUT","GET"] }

product_rate_plan_name[RW]

{ "description" : "the product rate plan name associated with the invoice-line.", "verbs":["POST","PUT","GET"] }

public_pricing_component_name[RW]

The public name of the pricing-component that is associated with the invoice-line.

public_product_name[RW]

{ "description" : "the public product name associated with the invoice-line.", "verbs":["POST","PUT","GET"] }

public_product_rate_plan_name[RW]

{ "description" : "the public product rate plan name associated with the invoice-line.", "verbs":["POST","PUT","GET"] }

subscription_charge_id[RW]

The ID of the subscription-charge that is associated with the invoice-line.

subscription_id[RW]

{ "description" : "the subscription ID associated with the invoice-line.", "verbs":["POST","PUT","GET"] }

tax[RW]

{ "description" : "The cumulative tax of the invoice-line.", "verbs":["POST","PUT","GET"] }

type[RW]

The type of the invoice-line.

unit_of_measure[RW]

{ "description" : "The unit-of-measure associated with the invoice-line.", "verbs":["POST","PUT","GET"] }

unit_of_measure_id[RW]

{ "description" : "unit-of-measure associated with the invoice-line.", "verbs":["POST","PUT","GET"] }

updated[RW]

{ "description" : "The UTC DateTime when the object was last updated.", "verbs":[] }

Public Class Methods

attribute_map() click to toggle source

Attribute mapping from ruby-style variable name to JSON key.

# File lib/bf_ruby2/models/invoice_line.rb, line 134
def self.attribute_map
  {
    :'unit_of_measure' => :'unitOfMeasure',
    :'pricing_component_type' => :'pricingComponentType',
    :'charge_type' => :'chargeType',
    :'period_start' => :'periodStart',
    :'period_end' => :'periodEnd',
    :'created' => :'created',
    :'changed_by' => :'changedBy',
    :'updated' => :'updated',
    :'id' => :'id',
    :'invoice_id' => :'invoiceID',
    :'unit_of_measure_id' => :'unitOfMeasureID',
    :'subscription_id' => :'subscriptionID',
    :'product_rate_plan_id' => :'productRatePlanID',
    :'public_product_rate_plan_name' => :'publicProductRatePlanName',
    :'product_rate_plan_name' => :'productRatePlanName',
    :'product_id' => :'productID',
    :'public_product_name' => :'publicProductName',
    :'product_name' => :'productName',
    :'organization_id' => :'organizationID',
    :'name' => :'name',
    :'description' => :'description',
    :'calculation' => :'calculation',
    :'cost' => :'cost',
    :'tax' => :'tax',
    :'component_value' => :'componentValue',
    :'pricing_component_id' => :'pricingComponentID',
    :'public_pricing_component_name' => :'publicPricingComponentName',
    :'pricing_component_name' => :'pricingComponentName',
    :'subscription_charge_id' => :'subscriptionChargeID',
    :'child_invoice_id' => :'childInvoiceID',
    :'type' => :'type'
  }
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/bf_ruby2/models/invoice_line.rb, line 209
def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'unitOfMeasure')
    self.unit_of_measure = attributes[:'unitOfMeasure']
  end

  if attributes.has_key?(:'pricingComponentType')
    self.pricing_component_type = attributes[:'pricingComponentType']
  end

  if attributes.has_key?(:'chargeType')
    self.charge_type = attributes[:'chargeType']
  end

  if attributes.has_key?(:'periodStart')
    self.period_start = attributes[:'periodStart']
  end

  if attributes.has_key?(:'periodEnd')
    self.period_end = attributes[:'periodEnd']
  end

  if attributes.has_key?(:'created')
    self.created = attributes[:'created']
  end

  if attributes.has_key?(:'changedBy')
    self.changed_by = attributes[:'changedBy']
  end

  if attributes.has_key?(:'updated')
    self.updated = attributes[:'updated']
  end

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'invoiceID')
    self.invoice_id = attributes[:'invoiceID']
  end

  if attributes.has_key?(:'unitOfMeasureID')
    self.unit_of_measure_id = attributes[:'unitOfMeasureID']
  end

  if attributes.has_key?(:'subscriptionID')
    self.subscription_id = attributes[:'subscriptionID']
  end

  if attributes.has_key?(:'productRatePlanID')
    self.product_rate_plan_id = attributes[:'productRatePlanID']
  end

  if attributes.has_key?(:'publicProductRatePlanName')
    self.public_product_rate_plan_name = attributes[:'publicProductRatePlanName']
  end

  if attributes.has_key?(:'productRatePlanName')
    self.product_rate_plan_name = attributes[:'productRatePlanName']
  end

  if attributes.has_key?(:'productID')
    self.product_id = attributes[:'productID']
  end

  if attributes.has_key?(:'publicProductName')
    self.public_product_name = attributes[:'publicProductName']
  end

  if attributes.has_key?(:'productName')
    self.product_name = attributes[:'productName']
  end

  if attributes.has_key?(:'organizationID')
    self.organization_id = attributes[:'organizationID']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.has_key?(:'calculation')
    self.calculation = attributes[:'calculation']
  end

  if attributes.has_key?(:'cost')
    self.cost = attributes[:'cost']
  end

  if attributes.has_key?(:'tax')
    self.tax = attributes[:'tax']
  end

  if attributes.has_key?(:'componentValue')
    self.component_value = attributes[:'componentValue']
  end

  if attributes.has_key?(:'pricingComponentID')
    self.pricing_component_id = attributes[:'pricingComponentID']
  end

  if attributes.has_key?(:'publicPricingComponentName')
    self.public_pricing_component_name = attributes[:'publicPricingComponentName']
  end

  if attributes.has_key?(:'pricingComponentName')
    self.pricing_component_name = attributes[:'pricingComponentName']
  end

  if attributes.has_key?(:'subscriptionChargeID')
    self.subscription_charge_id = attributes[:'subscriptionChargeID']
  end

  if attributes.has_key?(:'childInvoiceID')
    self.child_invoice_id = attributes[:'childInvoiceID']
  end

  if attributes.has_key?(:'type')
    self.type = attributes[:'type']
  end

end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/bf_ruby2/models/invoice_line.rb, line 171
def self.swagger_types
  {
    :'unit_of_measure' => :'UnitOfMeasure',
    :'pricing_component_type' => :'String',
    :'charge_type' => :'String',
    :'period_start' => :'DateTime',
    :'period_end' => :'DateTime',
    :'created' => :'DateTime',
    :'changed_by' => :'String',
    :'updated' => :'DateTime',
    :'id' => :'String',
    :'invoice_id' => :'String',
    :'unit_of_measure_id' => :'String',
    :'subscription_id' => :'String',
    :'product_rate_plan_id' => :'String',
    :'public_product_rate_plan_name' => :'String',
    :'product_rate_plan_name' => :'String',
    :'product_id' => :'String',
    :'public_product_name' => :'String',
    :'product_name' => :'String',
    :'organization_id' => :'String',
    :'name' => :'String',
    :'description' => :'String',
    :'calculation' => :'String',
    :'cost' => :'Float',
    :'tax' => :'Float',
    :'component_value' => :'Integer',
    :'pricing_component_id' => :'String',
    :'public_pricing_component_name' => :'String',
    :'pricing_component_name' => :'String',
    :'subscription_charge_id' => :'String',
    :'child_invoice_id' => :'String',
    :'type' => :'String'
  }
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/bf_ruby2/models/invoice_line.rb, line 482
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      unit_of_measure == o.unit_of_measure &&
      pricing_component_type == o.pricing_component_type &&
      charge_type == o.charge_type &&
      period_start == o.period_start &&
      period_end == o.period_end &&
      created == o.created &&
      changed_by == o.changed_by &&
      updated == o.updated &&
      id == o.id &&
      invoice_id == o.invoice_id &&
      unit_of_measure_id == o.unit_of_measure_id &&
      subscription_id == o.subscription_id &&
      product_rate_plan_id == o.product_rate_plan_id &&
      public_product_rate_plan_name == o.public_product_rate_plan_name &&
      product_rate_plan_name == o.product_rate_plan_name &&
      product_id == o.product_id &&
      public_product_name == o.public_product_name &&
      product_name == o.product_name &&
      organization_id == o.organization_id &&
      name == o.name &&
      description == o.description &&
      calculation == o.calculation &&
      cost == o.cost &&
      tax == o.tax &&
      component_value == o.component_value &&
      pricing_component_id == o.pricing_component_id &&
      public_pricing_component_name == o.public_pricing_component_name &&
      pricing_component_name == o.pricing_component_name &&
      subscription_charge_id == o.subscription_charge_id &&
      child_invoice_id == o.child_invoice_id &&
      type == o.type
end
_deserialize(type, value) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# File lib/bf_ruby2/models/invoice_line.rb, line 554
def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = Bfwd.const_get(type).new
    temp_model.build_from_hash(value)
  end
end
_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/bf_ruby2/models/invoice_line.rb, line 620
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/bf_ruby2/models/invoice_line.rb, line 533
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end
charge_type=(charge_type) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] charge_type Object to be assigned

# File lib/bf_ruby2/models/invoice_line.rb, line 462
def charge_type=(charge_type)
  validator = EnumAttributeValidator.new('String', ["Credit", "Debit"])
  unless validator.valid?(charge_type)
    fail ArgumentError, "invalid value for 'charge_type', must be one of #{validator.allowable_values}."
  end
  @charge_type = charge_type
end
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/bf_ruby2/models/invoice_line.rb, line 520
def eql?(o)
  self == o
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# File lib/bf_ruby2/models/invoice_line.rb, line 526
def hash
  [unit_of_measure, pricing_component_type, charge_type, period_start, period_end, created, changed_by, updated, id, invoice_id, unit_of_measure_id, subscription_id, product_rate_plan_id, public_product_rate_plan_name, product_rate_plan_name, product_id, public_product_name, product_name, organization_id, name, description, calculation, cost, tax, component_value, pricing_component_id, public_pricing_component_name, pricing_component_name, subscription_charge_id, child_invoice_id, type].hash
end
list_invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properies with the reasons

# File lib/bf_ruby2/models/invoice_line.rb, line 343
def list_invalid_properties
  invalid_properties = Array.new
  if @pricing_component_type.nil?
    invalid_properties.push("invalid value for 'pricing_component_type', pricing_component_type cannot be nil.")
  end

  if @charge_type.nil?
    invalid_properties.push("invalid value for 'charge_type', charge_type cannot be nil.")
  end

  if @period_start.nil?
    invalid_properties.push("invalid value for 'period_start', period_start cannot be nil.")
  end

  if @period_end.nil?
    invalid_properties.push("invalid value for 'period_end', period_end cannot be nil.")
  end

  if @invoice_id.nil?
    invalid_properties.push("invalid value for 'invoice_id', invoice_id cannot be nil.")
  end

  if @organization_id.nil?
    invalid_properties.push("invalid value for 'organization_id', organization_id cannot be nil.")
  end

  if @name.nil?
    invalid_properties.push("invalid value for 'name', name cannot be nil.")
  end

  if @description.nil?
    invalid_properties.push("invalid value for 'description', description cannot be nil.")
  end

  if @calculation.nil?
    invalid_properties.push("invalid value for 'calculation', calculation cannot be nil.")
  end

  if @cost.nil?
    invalid_properties.push("invalid value for 'cost', cost cannot be nil.")
  end

  if @tax.nil?
    invalid_properties.push("invalid value for 'tax', tax cannot be nil.")
  end

  if @component_value.nil?
    invalid_properties.push("invalid value for 'component_value', component_value cannot be nil.")
  end

  if @pricing_component_id.nil?
    invalid_properties.push("invalid value for 'pricing_component_id', pricing_component_id cannot be nil.")
  end

  if @public_pricing_component_name.nil?
    invalid_properties.push("invalid value for 'public_pricing_component_name', public_pricing_component_name cannot be nil.")
  end

  if @pricing_component_name.nil?
    invalid_properties.push("invalid value for 'pricing_component_name', pricing_component_name cannot be nil.")
  end

  if @subscription_charge_id.nil?
    invalid_properties.push("invalid value for 'subscription_charge_id', subscription_charge_id cannot be nil.")
  end

  if @child_invoice_id.nil?
    invalid_properties.push("invalid value for 'child_invoice_id', child_invoice_id cannot be nil.")
  end

  if @type.nil?
    invalid_properties.push("invalid value for 'type', type cannot be nil.")
  end

  return invalid_properties
end
pricing_component_type=(pricing_component_type) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] pricing_component_type Object to be assigned

# File lib/bf_ruby2/models/invoice_line.rb, line 452
def pricing_component_type=(pricing_component_type)
  validator = EnumAttributeValidator.new('String', ["setup", "subscription", "arrears", "usage"])
  unless validator.valid?(pricing_component_type)
    fail ArgumentError, "invalid value for 'pricing_component_type', must be one of #{validator.allowable_values}."
  end
  @pricing_component_type = pricing_component_type
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/bf_ruby2/models/invoice_line.rb, line 600
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/bf_ruby2/models/invoice_line.rb, line 606
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/bf_ruby2/models/invoice_line.rb, line 594
def to_s
  to_hash.to_s
end
type=(type) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] type Object to be assigned

# File lib/bf_ruby2/models/invoice_line.rb, line 472
def type=(type)
  validator = EnumAttributeValidator.new('String', ["PricingComponent", "Coupon", "Migration", "AggregatedInvoice"])
  unless validator.valid?(type)
    fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
  end
  @type = type
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/bf_ruby2/models/invoice_line.rb, line 422
def valid?
  return false if @pricing_component_type.nil?
  pricing_component_type_validator = EnumAttributeValidator.new('String', ["setup", "subscription", "arrears", "usage"])
  return false unless pricing_component_type_validator.valid?(@pricing_component_type)
  return false if @charge_type.nil?
  charge_type_validator = EnumAttributeValidator.new('String', ["Credit", "Debit"])
  return false unless charge_type_validator.valid?(@charge_type)
  return false if @period_start.nil?
  return false if @period_end.nil?
  return false if @invoice_id.nil?
  return false if @organization_id.nil?
  return false if @name.nil?
  return false if @description.nil?
  return false if @calculation.nil?
  return false if @cost.nil?
  return false if @tax.nil?
  return false if @component_value.nil?
  return false if @pricing_component_id.nil?
  return false if @public_pricing_component_name.nil?
  return false if @pricing_component_name.nil?
  return false if @subscription_charge_id.nil?
  return false if @child_invoice_id.nil?
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ["PricingComponent", "Coupon", "Migration", "AggregatedInvoice"])
  return false unless type_validator.valid?(@type)
  return true
end