class SwaggerClient::Contract

Attributes

action_upon_completion_of_autopays[RW]

The renewal action to be taken when this AutoPay is completed. Possible values are: * ContractExpires * ContractAutomaticallyRenews

agreement_terms[RW]

Business-defined terms and conditions for the contract.

assigns_membership_id[RW]

The ID of the membership that was assigned to the client when the client signed up for a contract.

assigns_membership_name[RW]

The name of the membership that was assigned to the client when the client signed up for this contract.

autopay_enabled[RW]

When `true`, this contract establishes an AutoPay on the client’s account.

autopay_schedule[RW]

Contains information about the AutoPay schedule. This parameter is null if `AutopayTriggerType` has a value of `PricingOptionRunsOutOrExpires`.

autopay_trigger_type[RW]

Defines whether the AutoPay, if applicable to this contract, runs on a set schedule or when the pricing option runs out or expires. Possible values are: * OnSetSchedule * PricingOptionRunsOutOrExpires

client_terminate_online[RW]

When `true`, indicates that the client can terminate this contract on the Internet.

clients_charged_on[RW]

The value that indicates when clients are charged. Possible values are: * OnSaleDate * FirstOfTheMonth * FifteenthOfTheMonth * LastDayOfTheMonth * FirstOrFifteenthOfTheMonth * FirstOrSixteenthOfTheMonth * FifteenthOrEndOfTheMonth * SpecificDate

clients_charged_on_specific_date[RW]

If `ClientsChargedOn` is defined as a specific date, this property holds the value of that date. Otherwise, this property is null.

contract_items[RW]

Contains information about the items in the contract.

deposit_amount[RW]

The amount of the deposit required for this contract.

description[RW]

A description of the contract.

discount_amount[RW]

The calculated discount applied to the items in this contract.

first_autopay_free[RW]

When `true`, indicates that the first payment for the AutoPay is free.

first_payment_amount_subtotal[RW]

The subtotal of the amount that the client is to be charged when signing up for the contract.

first_payment_amount_tax[RW]

The amount of tax that the client is to be charged when signing up for the contract.

first_payment_amount_total[RW]

The total amount that the client is to be charged when signing up for the contract.

id[RW]

The contract’s ID at the subscriber’s business.

intro_offer[RW]

Defines whether this contract is treated as an introductory offer. If this is an introductory offer, then clients are always charged a set number of times rather than month to month, using their AutoPays. Possible values are: * None * NewConsumer * NewAndReturningConsumer

last_autopay_free[RW]

When `true`, indicates that the last payment for the AutoPay is free.

location_purchase_restriction_ids[RW]

The IDs of the locations where this contract may be sold. If there are no restrictions, this value is null.

location_purchase_restriction_names[RW]

Location names where the contract may be purchased. If this value is null, there are no restrictions.

membership_type_restrictions[RW]

Contains information about the memberships that can purchase this contract. If null, then no membership restrictions exist, and anyone can purchase the contract.

name[RW]

The name of the contract.

number_of_autopays[RW]

The number of times that the AutoPay is to be run. This value is null if `FrequencyType` is `MonthToMonth`.

recurring_payment_amount_subtotal[RW]

The subtotal amount that the client is to be charged on an ongoing basis.

recurring_payment_amount_tax[RW]

The amount of tax the client is to be charged on an ongoing basis.

recurring_payment_amount_total[RW]

The total amount that the client is to be charged on an ongoing basis.

requires_electronic_confirmation[RW]

When `true`, clients who purchase the contract are prompted to agree to the terms of the contract the next time that they log in.

sold_online[RW]

When `true`, indicates that this membership is intended to be shown to clients in client experiences.<br /> When `false`, this contract should only be shown to staff members.

total_contract_amount_subtotal[RW]

The subtotal amount that the client is to be charged over the lifespan of the contract.

total_contract_amount_tax[RW]

The total amount of tax the client is to be charged over the lifespan of the contract.

total_contract_amount_total[RW]

The total amount the client is to be charged over the lifespan of the contract.

Public Class Methods

attribute_map() click to toggle source

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

# File lib/swagger_client/models/contract.rb, line 120
def self.attribute_map
  {
    :'id' => :'Id',
    :'name' => :'Name',
    :'description' => :'Description',
    :'assigns_membership_id' => :'AssignsMembershipId',
    :'assigns_membership_name' => :'AssignsMembershipName',
    :'sold_online' => :'SoldOnline',
    :'contract_items' => :'ContractItems',
    :'intro_offer' => :'IntroOffer',
    :'autopay_schedule' => :'AutopaySchedule',
    :'number_of_autopays' => :'NumberOfAutopays',
    :'autopay_trigger_type' => :'AutopayTriggerType',
    :'action_upon_completion_of_autopays' => :'ActionUponCompletionOfAutopays',
    :'clients_charged_on' => :'ClientsChargedOn',
    :'clients_charged_on_specific_date' => :'ClientsChargedOnSpecificDate',
    :'discount_amount' => :'DiscountAmount',
    :'deposit_amount' => :'DepositAmount',
    :'first_autopay_free' => :'FirstAutopayFree',
    :'last_autopay_free' => :'LastAutopayFree',
    :'client_terminate_online' => :'ClientTerminateOnline',
    :'membership_type_restrictions' => :'MembershipTypeRestrictions',
    :'location_purchase_restriction_ids' => :'LocationPurchaseRestrictionIds',
    :'location_purchase_restriction_names' => :'LocationPurchaseRestrictionNames',
    :'agreement_terms' => :'AgreementTerms',
    :'requires_electronic_confirmation' => :'RequiresElectronicConfirmation',
    :'autopay_enabled' => :'AutopayEnabled',
    :'first_payment_amount_subtotal' => :'FirstPaymentAmountSubtotal',
    :'first_payment_amount_tax' => :'FirstPaymentAmountTax',
    :'first_payment_amount_total' => :'FirstPaymentAmountTotal',
    :'recurring_payment_amount_subtotal' => :'RecurringPaymentAmountSubtotal',
    :'recurring_payment_amount_tax' => :'RecurringPaymentAmountTax',
    :'recurring_payment_amount_total' => :'RecurringPaymentAmountTotal',
    :'total_contract_amount_subtotal' => :'TotalContractAmountSubtotal',
    :'total_contract_amount_tax' => :'TotalContractAmountTax',
    :'total_contract_amount_total' => :'TotalContractAmountTotal'
  }
end
new(attributes = {}) click to toggle source

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

# File lib/swagger_client/models/contract.rb, line 201
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?(:'Id')
    self.id = attributes[:'Id']
  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?(:'AssignsMembershipId')
    self.assigns_membership_id = attributes[:'AssignsMembershipId']
  end

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

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

  if attributes.has_key?(:'ContractItems')
    if (value = attributes[:'ContractItems']).is_a?(Array)
      self.contract_items = value
    end
  end

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.has_key?(:'MembershipTypeRestrictions')
    if (value = attributes[:'MembershipTypeRestrictions']).is_a?(Array)
      self.membership_type_restrictions = value
    end
  end

  if attributes.has_key?(:'LocationPurchaseRestrictionIds')
    if (value = attributes[:'LocationPurchaseRestrictionIds']).is_a?(Array)
      self.location_purchase_restriction_ids = value
    end
  end

  if attributes.has_key?(:'LocationPurchaseRestrictionNames')
    if (value = attributes[:'LocationPurchaseRestrictionNames']).is_a?(Array)
      self.location_purchase_restriction_names = value
    end
  end

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

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

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

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

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

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

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

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

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

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

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

  if attributes.has_key?(:'TotalContractAmountTotal')
    self.total_contract_amount_total = attributes[:'TotalContractAmountTotal']
  end
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/swagger_client/models/contract.rb, line 160
def self.swagger_types
  {
    :'id' => :'Integer',
    :'name' => :'String',
    :'description' => :'String',
    :'assigns_membership_id' => :'Integer',
    :'assigns_membership_name' => :'String',
    :'sold_online' => :'BOOLEAN',
    :'contract_items' => :'Array<ContractItem>',
    :'intro_offer' => :'String',
    :'autopay_schedule' => :'AutopaySchedule',
    :'number_of_autopays' => :'Integer',
    :'autopay_trigger_type' => :'String',
    :'action_upon_completion_of_autopays' => :'String',
    :'clients_charged_on' => :'String',
    :'clients_charged_on_specific_date' => :'DateTime',
    :'discount_amount' => :'Float',
    :'deposit_amount' => :'Float',
    :'first_autopay_free' => :'BOOLEAN',
    :'last_autopay_free' => :'BOOLEAN',
    :'client_terminate_online' => :'BOOLEAN',
    :'membership_type_restrictions' => :'Array<MembershipTypeRestriction>',
    :'location_purchase_restriction_ids' => :'Array<Integer>',
    :'location_purchase_restriction_names' => :'Array<String>',
    :'agreement_terms' => :'String',
    :'requires_electronic_confirmation' => :'BOOLEAN',
    :'autopay_enabled' => :'BOOLEAN',
    :'first_payment_amount_subtotal' => :'Float',
    :'first_payment_amount_tax' => :'Float',
    :'first_payment_amount_total' => :'Float',
    :'recurring_payment_amount_subtotal' => :'Float',
    :'recurring_payment_amount_tax' => :'Float',
    :'recurring_payment_amount_total' => :'Float',
    :'total_contract_amount_subtotal' => :'Float',
    :'total_contract_amount_tax' => :'Float',
    :'total_contract_amount_total' => :'Float'
  }
end

Public Instance Methods

==(o) click to toggle source

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

# File lib/swagger_client/models/contract.rb, line 367
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      name == o.name &&
      description == o.description &&
      assigns_membership_id == o.assigns_membership_id &&
      assigns_membership_name == o.assigns_membership_name &&
      sold_online == o.sold_online &&
      contract_items == o.contract_items &&
      intro_offer == o.intro_offer &&
      autopay_schedule == o.autopay_schedule &&
      number_of_autopays == o.number_of_autopays &&
      autopay_trigger_type == o.autopay_trigger_type &&
      action_upon_completion_of_autopays == o.action_upon_completion_of_autopays &&
      clients_charged_on == o.clients_charged_on &&
      clients_charged_on_specific_date == o.clients_charged_on_specific_date &&
      discount_amount == o.discount_amount &&
      deposit_amount == o.deposit_amount &&
      first_autopay_free == o.first_autopay_free &&
      last_autopay_free == o.last_autopay_free &&
      client_terminate_online == o.client_terminate_online &&
      membership_type_restrictions == o.membership_type_restrictions &&
      location_purchase_restriction_ids == o.location_purchase_restriction_ids &&
      location_purchase_restriction_names == o.location_purchase_restriction_names &&
      agreement_terms == o.agreement_terms &&
      requires_electronic_confirmation == o.requires_electronic_confirmation &&
      autopay_enabled == o.autopay_enabled &&
      first_payment_amount_subtotal == o.first_payment_amount_subtotal &&
      first_payment_amount_tax == o.first_payment_amount_tax &&
      first_payment_amount_total == o.first_payment_amount_total &&
      recurring_payment_amount_subtotal == o.recurring_payment_amount_subtotal &&
      recurring_payment_amount_tax == o.recurring_payment_amount_tax &&
      recurring_payment_amount_total == o.recurring_payment_amount_total &&
      total_contract_amount_subtotal == o.total_contract_amount_subtotal &&
      total_contract_amount_tax == o.total_contract_amount_tax &&
      total_contract_amount_total == o.total_contract_amount_total
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/swagger_client/models/contract.rb, line 442
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 = SwaggerClient.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/swagger_client/models/contract.rb, line 508
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/swagger_client/models/contract.rb, line 421
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
eql?(o) click to toggle source

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

# File lib/swagger_client/models/contract.rb, line 408
def eql?(o)
  self == o
end
hash() click to toggle source

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

# File lib/swagger_client/models/contract.rb, line 414
def hash
  [id, name, description, assigns_membership_id, assigns_membership_name, sold_online, contract_items, intro_offer, autopay_schedule, number_of_autopays, autopay_trigger_type, action_upon_completion_of_autopays, clients_charged_on, clients_charged_on_specific_date, discount_amount, deposit_amount, first_autopay_free, last_autopay_free, client_terminate_online, membership_type_restrictions, location_purchase_restriction_ids, location_purchase_restriction_names, agreement_terms, requires_electronic_confirmation, autopay_enabled, first_payment_amount_subtotal, first_payment_amount_tax, first_payment_amount_total, recurring_payment_amount_subtotal, recurring_payment_amount_tax, recurring_payment_amount_total, total_contract_amount_subtotal, total_contract_amount_tax, total_contract_amount_total].hash
end
list_invalid_properties() click to toggle source

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

# File lib/swagger_client/models/contract.rb, line 354
def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
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/swagger_client/models/contract.rb, line 488
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/swagger_client/models/contract.rb, line 494
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/swagger_client/models/contract.rb, line 482
def to_s
  to_hash.to_s
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/swagger_client/models/contract.rb, line 361
def valid?
  true
end