Module: Kaui::ObjectHelper
- Defined in:
- app/helpers/kaui/object_helper.rb
Constant Summary collapse
- ADVANCED_SEARCH_OBJECT_FIELDS =
%w[ID EXTERNAL_KEY NUMBER].freeze
- ADVANCED_SEARCH_OBJECT_FIELDS_MAP =
{ # ID is supported by all object types, hence not listed. EXTERNAL_KEY: %w[ACCOUNT PAYMENT TRANSACTION BUNDLE], NUMBER: %w[INVOICE] }.freeze
Instance Method Summary collapse
- #advanced_search_object_fields_map ⇒ Object
- #object_fields_for_advanced_search ⇒ Object
- #object_types ⇒ Object
- #object_types_for_advanced_search ⇒ Object
-
#url_for_object(object_id, object_type) ⇒ Object
Because we don’t have access to the account_id, we use the restful_show routes.
Instance Method Details
#advanced_search_object_fields_map ⇒ Object
44 45 46 |
# File 'app/helpers/kaui/object_helper.rb', line 44 def advanced_search_object_fields_map ADVANCED_SEARCH_OBJECT_FIELDS_MAP end |
#object_fields_for_advanced_search ⇒ Object
40 41 42 |
# File 'app/helpers/kaui/object_helper.rb', line 40 def object_fields_for_advanced_search [' '] + ADVANCED_SEARCH_OBJECT_FIELDS end |
#object_types ⇒ Object
32 33 34 |
# File 'app/helpers/kaui/object_helper.rb', line 32 def object_types %i[ACCOUNT BUNDLE INVOICE INVOICE_ITEM INVOICE_PAYMENT PAYMENT SUBSCRIPTION TRANSACTION] end |
#object_types_for_advanced_search ⇒ Object
36 37 38 |
# File 'app/helpers/kaui/object_helper.rb', line 36 def object_types_for_advanced_search %i[ACCOUNT BUNDLE INVOICE CREDIT CUSTOM_FIELD INVOICE_PAYMENT 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
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/helpers/kaui/object_helper.rb', line 13 def url_for_object(object_id, object_type) case object_type when 'ACCOUNT' account_path(object_id) when 'BUNDLE' bundle_path(object_id) when 'SUBSCRIPTION' subscription_path(object_id) when 'INVOICE' invoice_path(object_id) when 'PAYMENT' payment_path(object_id) when 'PAYMENT_METHOD' payment_method_path(object_id) else nil end end |