Sha256: de22ab53fab52960e23374599bb45d2080fa313cda973828246194d409903c91

Contents?: true

Size: 486 Bytes

Versions: 40

Compression:

Stored size: 486 Bytes

Contents

class Eco::API::Common::People::DefaultParsers::SendInvitesParser < Eco::API::Common::Loaders::Parser
  attribute "send_invites"

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

  def serializer(person, _deps)
    return unless account = person.account
    account.send_invites&.to_s
  end

  private

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

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
eco-helpers-3.0.21 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.20 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.19 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.18 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.17 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.16 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.15 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.14 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.13 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.12 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.11 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.10 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.9 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.8 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.7 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.6 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.5 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.4 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.3 lib/eco/api/common/people/default_parsers/send_invites_parser.rb
eco-helpers-3.0.2 lib/eco/api/common/people/default_parsers/send_invites_parser.rb