app/models/effective/subscripter.rb
# The stripe metadata limit is 500 characters
The stripe metadata limit is 500 characters
The stripe metadata limit is 500 characters
def metadata(subscriptions: nil)
      retval = { user_id: user.id.to_s, user: user.to_s.truncate(500) }
      (subscriptions || customer.subscriptions).group_by { |sub| sub.subscribable_type }.each do |subscribable_type, subs|
        subs = subs.sort
        if subs.length == 1
          retval[subscribable_type.downcase + '_id'] = subs.map { |sub| sub.subscribable.id }.join(',')
          retval[subscribable_type.downcase] = subs.map { |sub| sub.subscribable.to_s }.join(',').truncate(500)
        else
          retval[subscribable_type.downcase + '_ids'] = subs.map { |sub| sub.subscribable.id }.join(',')
          retval[subscribable_type.downcase.pluralize] = subs.map { |sub| sub.subscribable.to_s }.join(',').truncate(500)
        end
      end
      retval
    end
def metadata ( subscriptions : nil ) retval = { user_id : user . id . to_s , user : user . to_s . truncate ( 500 ) } ( subscriptions || customer . subscriptions ) . group_by { | sub | sub . subscribable_type } . each do | subscribable_type , subs | subs = subs . sort if subs . length == 1 retval [ subscribable_type . downcase + '_id' ] = subs . map { | sub | sub . subscribable . id } . join ( ',' ) retval [ subscribable_type . downcase ] = subs . map { | sub | sub . subscribable . to_s } . join ( ',' ) . truncate ( 500 ) else retval [ subscribable_type . downcase + '_ids' ] = subs . map { | sub | sub . subscribable . id } . join ( ',' ) retval [ subscribable_type . downcase . pluralize ] = subs . map { | sub | sub . subscribable . to_s } . join ( ',' ) . truncate ( 500 ) end end retval end
The stripe metadata limit is 500 characters
The stripe metadata limit is 500 characters
subscriptions