class Unleashed::PaymentTermResource

Resource for the PaymentTerms API The PaymentTerms resource allows PaymentTerms to be listed.

@see apidocs.unleashedsoftware.com/PaymentTerms

Public Instance Methods

all() click to toggle source

List all payment_terms /PaymentTerms - also returns the first 200 payment_terms because page number 1 is the default.

@return [Array<Unleashed::PaymentTerm>] List all payment terms. {

"Items": [
  {
      "Guid": "6223b37e-2ee4-41ed-a215-5f14c53e8f7f",
      "Type": "DaysOfTheMonthFollowing",
      "Days": 20,
      "Obsolete": false,
      "PaymentTermDescription": "20th Month following"
  },
  {
      "Guid": "6488bee4-ea4c-4a25-ba1b-a86965120e34",
      "Type": "DaysOfTheMonthFollowing",
      "Days": 25,
      "Obsolete": false,
      "PaymentTermDescription": "25th Month following"
  }
]

}

# File lib/unleashed/resources/payment_term_resource.rb, line 33
def all
  endpoint = 'PaymentTerms'
  response = JSON.parse(@client.get(endpoint).body)
  payment_terms = response.key?('Items') ? response['Items'] : []
  payment_terms.map { |attributes| Unleashed::PaymentTerm.new(@client, attributes) }
end
first() click to toggle source

Get a first payment_term in all

@return [Unleashed::PaymentTerm]

# File lib/unleashed/resources/payment_term_resource.rb, line 43
def first
  all.first
end
last() click to toggle source

Get a last payment_term in all

@return [Unleashed::PaymentTerm]

# File lib/unleashed/resources/payment_term_resource.rb, line 50
def last
  all.last
end
model() click to toggle source
# File lib/unleashed/resources/payment_term_resource.rb, line 7
def model
  Unleashed::PaymentTerm
end