Sha256: ba431cc200fa2a4e9bf95a2fb99aaa1cbde1f2b27ed301bd54e01543107490eb

Contents?: true

Size: 728 Bytes

Versions: 2

Compression:

Stored size: 728 Bytes

Contents

# frozen_string_literal: true
module TopsConnect
  class Community
    attr_reader :data

    def initialize(data)
      @data = data
    end

    def id
      data['CommunityKey']
    end
    alias community_key id

    def code
      data['CommunityID']
    end

    def name
      data['Name']
    end

    def city
      data['DefaultCity']
    end

    def state
      data['DefaultState']
    end

    def zip
      data['DefaultZip']
    end

    def last_synced_at
      DateTime.parse data['LastSyncTime'] if data['LastSyncTime']
    end

    def updated_at
      return unless data['Metadata']['ModifiedDate']

      DateTime.parse data['Metadata']['ModifiedDate']
    end
    alias modified_date updated_at
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tops_connect-0.3.1 lib/tops_connect/community.rb
tops_connect-0.3.0 lib/tops_connect/community.rb