Module: Kaui::ObjectHelper

Defined in:
app/helpers/kaui/object_helper.rb

Instance Method Summary collapse

Instance Method Details

#object_typesObject



23
24
25
# File 'app/helpers/kaui/object_helper.rb', line 23

def object_types
  [:ACCOUNT, :BUNDLE, :INVOICE, :INVOICE_ITEM, :INVOICE_PAYMENT, :PAYMENT, :SUBSCRIPTION, :TRANSACTION]
end

#object_types_for_advanced_searchObject



27
28
29
# File 'app/helpers/kaui/object_helper.rb', line 27

def object_types_for_advanced_search
  [:ACCOUNT, :BUNDLE, :INVOICE, :CREDIT, :CUSTOM_FIELD, :INVOICE_PAYMENT, :INVOICE, :PAYMENT, :SUBSCRIPTION, :TRANSACTION, :TAG, :TAG_DEFINITION]
end

#url_for_object(object_id, object_type) ⇒ Object

Because we don’t have access to the account_id, we use the restful_show routes



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/kaui/object_helper.rb', line 5

def url_for_object(object_id, object_type)
  if object_type == 'ACCOUNT'
    (object_id)
  elsif object_type == 'BUNDLE'
    bundle_path(object_id)
  elsif object_type == 'SUBSCRIPTION'
    subscription_path(object_id)
  elsif object_type == 'INVOICE'
    invoice_path(object_id)
  elsif object_type == 'PAYMENT'
    payment_path(object_id)
  elsif object_type == 'PAYMENT_METHOD'
    payment_method_path(object_id)
  else
    nil
  end
end