Sha256: 9554072a80233df0c4eeef73c4d72a4a139a18e67096d3eebf30440e4535907c
Contents?: true
Size: 1.29 KB
Versions: 7
Compression:
Stored size: 1.29 KB
Contents
module Recurly class AddOn < Resource # @return [Plan] belongs_to :plan # @return [[Tier], []] has_many :tiers, class_name: :Tier, readonly: false # @return [[PercentageTier], []] has_many :percentage_tiers, class_name: :CurrencyPercentageTier, readonly: false define_attribute_methods %w( add_on_code item_code name item_state accounting_code default_quantity unit_amount_in_cents display_quantity_on_hosted_page tax_code add_on_type measured_unit_id optional usage_type usage_percentage revenue_schedule_type created_at updated_at tier_type usage_timeframe usage_calculation_type external_sku avalara_service_type avalara_transaction_type ) + RevRec::PRODUCT_ATTRIBUTES alias to_param add_on_code alias quantity default_quantity def changed_attributes attrs = super if tiers.any?(&:changed?) attrs['tiers'] = tiers.select(&:changed?) elsif percentage_tiers.any?(&:changed?) attrs['percentage_tiers'] = percentage_tiers.select(&:changed?) end attrs end # Add-ons are only writeable and readable through {Plan} instances. embedded! private_class_method :find end end
Version data entries
7 entries across 7 versions & 1 rubygems