Class: TranslationCms::Api::Order

Inherits:
Base
  • Object
show all
Extended by:
EnumField::EnumeratedAttribute
Includes:
HumanizeFields
Defined in:
lib/translation_cms/api/order.rb

Direct Known Subclasses

Customers::Order, OrderTranslation

Constant Summary collapse

AVAILABLE_STATES =
%w[evaluation waiting test to_check free pending to_upload for_revision problematic
refunded revised done archived deleted canceled recovered].freeze
COMPLETED_STATES =
%w[refunded done archived].freeze
CANCELED_STATES =
%w[canceled].freeze
PROCESSING_STATES =
(AVAILABLE_STATES - COMPLETED_STATES - CANCELED_STATES - %w[deleted]).freeze
PENDING_STATES =
%w[evaluation].freeze
REFUNDED_STATES =
%w[refunded].freeze
BLOCK_EXTRAS_STATES =
%w[evaluation refunded revised done archived deleted canceled].freeze
REF_MATERIALS_MANAGE_STATES =
%w[evaluation waiting test].freeze

Instance Method Summary collapse

Methods included from HumanizeFields

#human_name, #human_value

Methods inherited from Base

all!, custom_scope!, default_attributes, destroy, dummy_resource!, #method_missing_with_translations_will_change, parsed!, path_with_custom_scope, resource_type!, update

Instance Method Details

#deafult_featuresObject



90
91
92
93
94
# File 'lib/translation_cms/api/order.rb', line 90

def deafult_features
  return [] if features.blank?

  features.reject(&:extras?)
end

#extra_featuresObject



80
81
82
83
84
# File 'lib/translation_cms/api/order.rb', line 80

def extra_features
  return [] if features.blank?

  features.select(&:extras?)
end

#not_paid?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/translation_cms/api/order.rb', line 68

def not_paid?
  waiting_payment_token.present?
end

#state_titleObject



72
73
74
# File 'lib/translation_cms/api/order.rb', line 72

def state_title
  I18n.t state, scope: [:account, :state]
end

#target_titleObject



76
77
78
# File 'lib/translation_cms/api/order.rb', line 76

def target_title
  industry_expertise_title
end

#urgencyObject



86
87
88
# File 'lib/translation_cms/api/order.rb', line 86

def urgency
  @urgency ||= urgency_type.try(:title)
end