nerdEd / gtfs

Ruby lib for dealing with GTFS
http://www.edschmalzle.com
MIT License
61 stars 40 forks source link

agency.email return NoMethodError #35

Closed thestrauss3 closed 3 years ago

thestrauss3 commented 7 years ago

agencies = source.agencies

[27] pry(main)> agencies[1].email NoMethodError: undefined method `email' for # [28] pry(main)> agencies[1] => #<GTFS::Agency:0x007f918c8b9b40 @id="2", @lang="EN", @name="Massport", @phone="1-800-23-LOGAN", @timezone="America/New_York", @url="http://www.massport.com"> [29] pry(main)> agencies[1].fare_url => nil

pry(main)> GTFS::Agency.attrs => [:name, :url, :timezone, :id, :lang, :phone, :fare_url]

As you can see the agency in question does not have a fare_url or an email, but calling #fare_url => nil, whereas #email => NoMethodError

thestrauss3 commented 7 years ago

UPDATE: The source code for gtfs-0.2.5 (most recent release, same applies to 0.2.4) clearly does not include email

module GTFS
  class Agency
    include GTFS::Model

    has_required_attrs :name, :url, :timezone
    has_optional_attrs :id, :lang, :phone, :fare_url
    attr_accessor *attrs

    ...

    end
  end
end
drewda commented 7 years ago

FYI, we've added the agency email field (as well as other additions) in our own fork at https://github.com/transitland/gtfs

thestrauss3 commented 7 years ago

Ah! I'll take a closer look at your repo, thanks

stephenyeargin commented 3 years ago

Field should now be published in v0.3.0.