{"action":"opened","issue":{"url":"https://api.github.com/repos/MollieS/oystercard/issues/15","labels_url":"https://api.github.com/repos/MollieS/oystercard/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/MollieS/oystercard/issues/15/comments","events_url":"https://api.github.com/repos/MollieS/oystercard/issues/15/events","html_url":"https://github.com/MollieS/oystercard/issues/15","id":103512728,"number":15,"title":"Adding zone information to the journey history","user":{"login":"MollieS","id":11349388,"avatar_url":"https://avatars.githubusercontent.com/u/11349388?v=3","gravatar_id":"","url":"https://api.github.com/users/MollieS","html_url":"https://github.com/MollieS","followers_url":"https://api.github.com/users/MollieS/followers","following_url":"https://api.github.com/users/MollieS/following{/other_user}","gists_url":"https://api.github.com/users/MollieS/gists{/gist_id}","starred_url":"https://api.github.com/users/MollieS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MollieS/subscriptions","organizations_url":"https://api.github.com/users/MollieS/orgs","repos_url":"https://api.github.com/users/MollieS/repos","events_url":"https://api.github.com/users/MollieS/events{/privacy}","received_events_url":"https://api.github.com/users/MollieS/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-27T13:44:00Z","updated_at":"2015-08-27T13:44:00Z","closed_at":null,"body":"The last issue wasn't easy wasn't it? However, you learned and reinforced quite a few important concepts. You also did some basic refactoring. Finally, you used Ruby data structures – arrays and hashes – to store data, which you will do in pretty much every single Ruby project you'll ever work on.\n\nRight now our card holds the history of all trips made. Every station is stored simply as a string: \"Angel\", \"Bank\" or \"Camden Town\". Let's add zone information to the stations (e.g. Angel and Bank are in zone 1 but Camden Town is in zone 2). Once we do this, we'll be able to display zones in the travel history and calculate fares between different zones.\n\nDiscuss with your pairing partner different ways – there are several strategies that you could come up with – to add zone information to the list of stations. Implement it using the guidelines below.\n\n## Skills you will learn:\n- S141: Use Ruby's `require` method to load external files\n- S172: Use a constant\n- S174: Access a constant from outside the class/module\n- S220: Use modules\n- S221: Use OpenStruct\n- S222: Use `let` method in RSpec\n\n## Interview questions you may expect:\n- I178: What are constants and how are they different from variables? Why use them?\n- I179: What does the DRY acronym mean? Why is it important to keep your code DRY?\n- I225: What are Ruby modules? How are they different from classes? When would you use a module?\n- I226: What is an OpenStruct? What are the advantages of using OS over using a hash?\n- I227: How do you include an external Ruby file in your program? Why would you do this?\n- I228: When would you use the `let` keyword in RSpec tests?\n\n## To complete this challenge:\n- [ ] Update your tests to use an instance of OpenStruct class holding station info (name and zone) instead of strings\n- [ ] Use a module named `Stations` to store the list of stations as instances of OpenStruct as constants\n- [ ] Load the file necessary for OpenStruct to work\n- [ ] Use `let` keyword in RSpec to keep your code DRY by instantiating the stations you need only once\n- [ ] Write a test that checks that the journey now contains information about zones and make it pass\n- [ ] Use only one expectation per test. Use multiple `describe` blocks if necessary\n\n## Suggested resources:\n- [Betterspecs#let](http://betterspecs.org/#let)\n- [Modules on RubyMonk](https://rubymonk.com/learning/books/1-ruby-primer/chapters/35-modules/lessons/79-getting-modular)\n- [Modules: Learn Ruby the Hard Way](http://learnrubythehardway.org/book/ex40.html)\n- [Modules on Pragmatic Programmers](http://ruby-doc.com/docs/ProgrammingRuby/html/tut_modules.html)\n- [Including other files in Ruby](http://rubylearning.com/satishtalim/including_other_files_in_ruby.html)\n- [Struct and OpenStruct in Ruby](http://community.logicalbricks.com/node/235)\n- [OpenStruct documentation](http://ruby-doc.org/stdlib-2.0.0/libdoc/ostruct/rdoc/OpenStruct.html)\n- [Don't repeat yourself – O'Reilly](http://programmer.97things.oreilly.com/wiki/index.php/Don't_Repeat_Yourself)"}}