Sha256: 04bf0cddda29f9bfaf773ff85448aaa21f6480e18717aec94f4799010a4753f2

Contents?: true

Size: 427 Bytes

Versions: 122

Compression:

Stored size: 427 Bytes

Contents

class Eco::API::Common::People::DefaultParsers::FreemiumParser < Eco::API::Common::Loaders::Parser
  attribute "freemium"

  def parser(hash, deps)
    value = hash["freemium"]
    value = value.first if value.is_a?(Array)
    truthy(value)
  end

  def serializer(person, deps)
    person.freemium&.to_s
  end

  private

  def truthy (value)
    %w[true y yes x].include?(value.to_s&.downcase)
  end

end

Version data entries

122 entries across 122 versions & 1 rubygems

Version Path
eco-helpers-2.0.30 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.29 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.28 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.27 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.26 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.25 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.24 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.23 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.22 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.21 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.19 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.18 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.17 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.16 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.15 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.14 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.13 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.12 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.11 lib/eco/api/common/people/default_parsers/freemium_parser.rb
eco-helpers-2.0.10 lib/eco/api/common/people/default_parsers/freemium_parser.rb