Class: Beanie::SalesOrder

Inherits:
Api
  • Object
show all
Defined in:
lib/beanie/sales_order.rb

Constant Summary collapse

BILL_FREQUENCY_DAILY =
0
BILL_FREQUENCY_WEEKLY =
1
BILL_FREQUENCY_FORTNIGHTLY =
2
BILL_FREQUENCY_MONTHLY =
3
BILL_FREQUENCY_QUARTERLY =
4
BILL_FREQUENCY_ANNUALLY =
5
BILL_FREQUENCY_NAMES =
[
  ["Daily", BILL_FREQUENCY_DAILY],
  ["Weekly", BILL_FREQUENCY_WEEKLY],
  ["Fortnightly", BILL_FREQUENCY_FORTNIGHTLY],
  ["Monthly", BILL_FREQUENCY_MONTHLY],
  ["Quarterly", BILL_FREQUENCY_QUARTERLY],
  ["Yearly", BILL_FREQUENCY_ANNUALLY]
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Api

all, build_url, #construct_path, delete, #extract, #field_name, find, get, #object_name, #populate, post, put, #save!, set_headers

Constructor Details

#initializeSalesOrder

Initialize instance variables



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/beanie/sales_order.rb', line 53

def initialize
  @id = nil
  @cash_customer_ref = nil
  @number = nil
  @date = nil
  @title = nil
  @billing_frequency = BILL_FREQUENCY_DAILY
  @your_ref = nil
  @currency = nil
  @customer_id = nil
end

Instance Attribute Details

#billing_frequencyObject

Returns the value of attribute billing_frequency.



32
33
34
# File 'lib/beanie/sales_order.rb', line 32

def billing_frequency
  @billing_frequency
end

#cash_customer_refObject

Returns the value of attribute cash_customer_ref.



32
33
34
# File 'lib/beanie/sales_order.rb', line 32

def cash_customer_ref
  @cash_customer_ref
end

#currency_idObject

Returns the value of attribute currency_id.



33
34
35
# File 'lib/beanie/sales_order.rb', line 33

def currency_id
  @currency_id
end

#customer_idObject

Returns the value of attribute customer_id.



33
34
35
# File 'lib/beanie/sales_order.rb', line 33

def customer_id
  @customer_id
end

#dateObject

Returns the value of attribute date.



32
33
34
# File 'lib/beanie/sales_order.rb', line 32

def date
  @date
end

#idObject

Returns the value of attribute id.



32
33
34
# File 'lib/beanie/sales_order.rb', line 32

def id
  @id
end

#numberObject

Returns the value of attribute number.



32
33
34
# File 'lib/beanie/sales_order.rb', line 32

def number
  @number
end

#titleObject

Returns the value of attribute title.



32
33
34
# File 'lib/beanie/sales_order.rb', line 32

def title
  @title
end

#your_refObject

Returns the value of attribute your_ref.



33
34
35
# File 'lib/beanie/sales_order.rb', line 33

def your_ref
  @your_ref
end

Instance Method Details

#frequency_nameObject

Pretty name for the frequency



67
68
69
70
71
72
# File 'lib/beanie/sales_order.rb', line 67

def frequency_name
  BILL_FREQUENCY_NAMES.each do |fn|
    return fn[0] if fn[1] == self.billing_frequency
  end
  return "Unknown?"
end