Sha256: 03b36aca5c2605cb9fba13a6e31c1d9bd2bb14b4f4de1fad52c7f7799e799d64

Contents?: true

Size: 635 Bytes

Versions: 2

Compression:

Stored size: 635 Bytes

Contents

module Parliament
  module Decorators
    module Incumbency
      def start_date
        respond_to?(:incumbencyStartDate) ? DateTime.parse(incumbencyStartDate) : nil
      end

      def end_date
        respond_to?(:incumbencyEndDate) ? DateTime.parse(incumbencyEndDate) : nil
      end

      def current?
        has_end_date = respond_to?(:incumbencyEndDate)

        !has_end_date
      end

      def member
        respond_to?(:incumbencyHasMember) ? incumbencyHasMember.first : nil
      end

      def contact_points
        respond_to?(:incumbencyHasContactPoint) ? incumbencyHasContactPoint : []
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
parliament-ruby-0.5.1 lib/parliament/decorators/incumbency.rb
parliament-ruby-0.5.0 lib/parliament/decorators/incumbency.rb