{"action":"created","comment":{"url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/comments/25278507","id":25278507,"diff_hunk":"@@ -0,0 +1,217 @@\n+require 'savon'\n+require './app/models/api/weather_client'\n+\n+def keys(hash)\n+  hash.each_with_object([]) do |(key, value), keys|\n+    keys << key\n+  end\n+end\n+\n+describe WeatherClient do\n+  describe \"for one lat lon point\", vcr: { cassette_name: \"one lat lon point\",\n+                                           record: :new_episodes } do\n+    let(:client) { WeatherClient.new }\n+    let(:response) { client.request({ list_lat_lon: \"41.837,-87.685\",\n+                                      start_time:   \"2015-01-30\",\n+                                      end_time:     \"2015-02-08\" }) }\n+    let(:weather_data) { response.weather_data }\n+\n+    it \"has the expected parameters nested under data\" do\n+      parameters = [:location, :time_layout]\n+      parameters.each do |parameter|\n+        expect(weather_data.data).to have_key(parameter)\n+      end\n+    end\n+\n+    it \"has the expected parameters nested under :parameters\" do\n+      parameters = [:temperature,\n+                    :weather,\n+                    :cloud_amount,\n+                    :conditions_icon,\n+                    :@applicable_location]\n+      parameters.each do |parameter|\n+        expect(weather_data.data[:parameters]).to have_key(parameter)\n+      end\n+    end\n+\n+    it \"returns expected attributes as arrays of 1 object\" do\n+      attributes = [:locations,\n+                    :weather,\n+                    :temperatures,\n+                    :cloud_covers,\n+                    :conditions_icons]\n+      attributes.each do |attr|\n+        expect(weather_data.send(attr)).to be_an(Array)\n+        expect(weather_data.send(attr).count).to eq(1)\n+      end\n+    end\n+\n+    it \"returns locations with location_key, latitude, and longitude\" do\n+      expect(weather_data.locations[0]).to respond_to(:location_key, :latitude, :longitude)\n+    end\n+\n+    it \"returns time_layouts as an array of at least 1 object\" do\n+      expect(weather_data.time_layouts).to be_an(Array)\n+      expect(weather_data.time_layouts.count).to be > 0\n+    end\n+\n+    it \"returns time_layouts with layout_key, start_valid_time, end_valid_time\" do\n+      expect(weather_data.time_layouts[0]).to respond_to(:layout_key,\n+                                                         :start_valid_time,\n+                                                         :end_valid_time)\n+    end\n+\n+    # Some may be nil in the array\n+    it \"returns some weather_conditions with expected attributes\" do\n+      existing_conditions = weather_data.weather[0].weather_conditions.compact\n+      expect(existing_conditions[0]).to respond_to(:coverages,\n+                                                  :intensities,\n+                                                  :weather_types,\n+                                                  :qualifiers,\n+                                                  :additives)\n+      w = weather_data.weather[0].weather_conditions\n+    end\n+\n+    it \"returns temperatures with maxt and mint\" do\n+      expect(weather_data.temperatures[0]).to respond_to(:maxt, :mint)\n+    end\n+\n+    it \"returns maxt with temperature type parameters\" do\n+      expect(weather_data.temperatures[0].maxt).to respond_to(:name, :value, :type, :units, :time_layout)\n+    end\n+\n+    it \"returns mint with temperature type parameters\" do\n+      expect(weather_data.temperatures[0].mint).to respond_to(:name, :value, :type, :units, :time_layout)\n+    end\n+\n+    it \"returns cloud cover with correct parameters\" do\n+      expect(weather_data.cloud_covers[0]).to respond_to(:name, :value, :type, :units, :time_layout)\n+    end\n+\n+    it \"returns conditions icons with correct parameters\" do\n+      expect(weather_data.conditions_icons[0]).to respond_to(:name, :icon_link, :type, :time_layout)\n+    end\n+\n+    it \"returns applicable locations that are one of the location_keys\" do\n+      location_keys = weather_data.locations.each_with_object([]) do |location, keys| \n+                        keys << location.location_key\n+                      end\n+      difference = weather_data.applicable_locations - location_keys\n+      expect(difference).to be_empty\n+    end","path":"cyoa/spec/models/api/weather_client_spec.rb","position":101,"original_position":101,"commit_id":"315f03ca8a60e591a82b9fb85ffc0477122d6a18","original_commit_id":"315f03ca8a60e591a82b9fb85ffc0477122d6a18","user":{"login":"jmmastey","id":302011,"avatar_url":"https://avatars.githubusercontent.com/u/302011?v=3","gravatar_id":"","url":"https://api.github.com/users/jmmastey","html_url":"https://github.com/jmmastey","followers_url":"https://api.github.com/users/jmmastey/followers","following_url":"https://api.github.com/users/jmmastey/following{/other_user}","gists_url":"https://api.github.com/users/jmmastey/gists{/gist_id}","starred_url":"https://api.github.com/users/jmmastey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmmastey/subscriptions","organizations_url":"https://api.github.com/users/jmmastey/orgs","repos_url":"https://api.github.com/users/jmmastey/repos","events_url":"https://api.github.com/users/jmmastey/events{/privacy}","received_events_url":"https://api.github.com/users/jmmastey/received_events","type":"User","site_admin":false},"body":"Since arrays are ordered, it shouldn't be necessary to do the difference thing. Something like this should suffice:\r\n\r\n```\r\nexpect(weather.applicable_locations).to eq(weather.locations.map(&:location_key))","created_at":"2015-02-24T18:37:53Z","updated_at":"2015-02-24T18:37:53Z","html_url":"https://github.com/jmmastey/level_up_exercises/pull/515#discussion_r25278507","pull_request_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/515","_links":{"self":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/comments/25278507"},"html":{"href":"https://github.com/jmmastey/level_up_exercises/pull/515#discussion_r25278507"},"pull_request":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/515"}}},"pull_request":{"url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/515","id":29393864,"html_url":"https://github.com/jmmastey/level_up_exercises/pull/515","diff_url":"https://github.com/jmmastey/level_up_exercises/pull/515.diff","patch_url":"https://github.com/jmmastey/level_up_exercises/pull/515.patch","issue_url":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/515","number":515,"state":"open","locked":false,"title":"Cyoa (need discussion)","user":{"login":"jfinzel","id":10077712,"avatar_url":"https://avatars.githubusercontent.com/u/10077712?v=3","gravatar_id":"","url":"https://api.github.com/users/jfinzel","html_url":"https://github.com/jfinzel","followers_url":"https://api.github.com/users/jfinzel/followers","following_url":"https://api.github.com/users/jfinzel/following{/other_user}","gists_url":"https://api.github.com/users/jfinzel/gists{/gist_id}","starred_url":"https://api.github.com/users/jfinzel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfinzel/subscriptions","organizations_url":"https://api.github.com/users/jfinzel/orgs","repos_url":"https://api.github.com/users/jfinzel/repos","events_url":"https://api.github.com/users/jfinzel/events{/privacy}","received_events_url":"https://api.github.com/users/jfinzel/received_events","type":"User","site_admin":false},"body":"Working so far: the user registration/login, and the weather API is fully functioning and updating when needed.  Joe/Dan - please see my email upcoming before assigning.","created_at":"2015-02-16T18:52:41Z","updated_at":"2015-02-24T18:37:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"16b07d366d63f5a0eae1d3c7e2dce11d47bf5f74","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/515/commits","review_comments_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/515/comments","review_comment_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/515/comments","statuses_url":"https://api.github.com/repos/jmmastey/level_up_exercises/statuses/315f03ca8a60e591a82b9fb85ffc0477122d6a18","head":{"label":"jfinzel:cyoa","ref":"cyoa","sha":"315f03ca8a60e591a82b9fb85ffc0477122d6a18","user":{"login":"jfinzel","id":10077712,"avatar_url":"https://avatars.githubusercontent.com/u/10077712?v=3","gravatar_id":"","url":"https://api.github.com/users/jfinzel","html_url":"https://github.com/jfinzel","followers_url":"https://api.github.com/users/jfinzel/followers","following_url":"https://api.github.com/users/jfinzel/following{/other_user}","gists_url":"https://api.github.com/users/jfinzel/gists{/gist_id}","starred_url":"https://api.github.com/users/jfinzel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfinzel/subscriptions","organizations_url":"https://api.github.com/users/jfinzel/orgs","repos_url":"https://api.github.com/users/jfinzel/repos","events_url":"https://api.github.com/users/jfinzel/events{/privacy}","received_events_url":"https://api.github.com/users/jfinzel/received_events","type":"User","site_admin":false},"repo":{"id":27552070,"name":"level_up_exercises","full_name":"jfinzel/level_up_exercises","owner":{"login":"jfinzel","id":10077712,"avatar_url":"https://avatars.githubusercontent.com/u/10077712?v=3","gravatar_id":"","url":"https://api.github.com/users/jfinzel","html_url":"https://github.com/jfinzel","followers_url":"https://api.github.com/users/jfinzel/followers","following_url":"https://api.github.com/users/jfinzel/following{/other_user}","gists_url":"https://api.github.com/users/jfinzel/gists{/gist_id}","starred_url":"https://api.github.com/users/jfinzel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfinzel/subscriptions","organizations_url":"https://api.github.com/users/jfinzel/orgs","repos_url":"https://api.github.com/users/jfinzel/repos","events_url":"https://api.github.com/users/jfinzel/events{/privacy}","received_events_url":"https://api.github.com/users/jfinzel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jfinzel/level_up_exercises","description":"A series of code-related assignments to challenge starting engineers","fork":true,"url":"https://api.github.com/repos/jfinzel/level_up_exercises","forks_url":"https://api.github.com/repos/jfinzel/level_up_exercises/forks","keys_url":"https://api.github.com/repos/jfinzel/level_up_exercises/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jfinzel/level_up_exercises/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jfinzel/level_up_exercises/teams","hooks_url":"https://api.github.com/repos/jfinzel/level_up_exercises/hooks","issue_events_url":"https://api.github.com/repos/jfinzel/level_up_exercises/issues/events{/number}","events_url":"https://api.github.com/repos/jfinzel/level_up_exercises/events","assignees_url":"https://api.github.com/repos/jfinzel/level_up_exercises/assignees{/user}","branches_url":"https://api.github.com/repos/jfinzel/level_up_exercises/branches{/branch}","tags_url":"https://api.github.com/repos/jfinzel/level_up_exercises/tags","blobs_url":"https://api.github.com/repos/jfinzel/level_up_exercises/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jfinzel/level_up_exercises/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jfinzel/level_up_exercises/git/refs{/sha}","trees_url":"https://api.github.com/repos/jfinzel/level_up_exercises/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jfinzel/level_up_exercises/statuses/{sha}","languages_url":"https://api.github.com/repos/jfinzel/level_up_exercises/languages","stargazers_url":"https://api.github.com/repos/jfinzel/level_up_exercises/stargazers","contributors_url":"https://api.github.com/repos/jfinzel/level_up_exercises/contributors","subscribers_url":"https://api.github.com/repos/jfinzel/level_up_exercises/subscribers","subscription_url":"https://api.github.com/repos/jfinzel/level_up_exercises/subscription","commits_url":"https://api.github.com/repos/jfinzel/level_up_exercises/commits{/sha}","git_commits_url":"https://api.github.com/repos/jfinzel/level_up_exercises/git/commits{/sha}","comments_url":"https://api.github.com/repos/jfinzel/level_up_exercises/comments{/number}","issue_comment_url":"https://api.github.com/repos/jfinzel/level_up_exercises/issues/comments{/number}","contents_url":"https://api.github.com/repos/jfinzel/level_up_exercises/contents/{+path}","compare_url":"https://api.github.com/repos/jfinzel/level_up_exercises/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jfinzel/level_up_exercises/merges","archive_url":"https://api.github.com/repos/jfinzel/level_up_exercises/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jfinzel/level_up_exercises/downloads","issues_url":"https://api.github.com/repos/jfinzel/level_up_exercises/issues{/number}","pulls_url":"https://api.github.com/repos/jfinzel/level_up_exercises/pulls{/number}","milestones_url":"https://api.github.com/repos/jfinzel/level_up_exercises/milestones{/number}","notifications_url":"https://api.github.com/repos/jfinzel/level_up_exercises/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jfinzel/level_up_exercises/labels{/name}","releases_url":"https://api.github.com/repos/jfinzel/level_up_exercises/releases{/id}","created_at":"2014-12-04T17:39:35Z","updated_at":"2015-01-02T16:01:06Z","pushed_at":"2015-02-17T16:18:02Z","git_url":"git://github.com/jfinzel/level_up_exercises.git","ssh_url":"git@github.com:jfinzel/level_up_exercises.git","clone_url":"https://github.com/jfinzel/level_up_exercises.git","svn_url":"https://github.com/jfinzel/level_up_exercises","homepage":"http://leveluprails.herokuapp.com","size":777,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jmmastey:master","ref":"master","sha":"f208d381f275b417df72d3cdf6562ceb443bfd3a","user":{"login":"jmmastey","id":302011,"avatar_url":"https://avatars.githubusercontent.com/u/302011?v=3","gravatar_id":"","url":"https://api.github.com/users/jmmastey","html_url":"https://github.com/jmmastey","followers_url":"https://api.github.com/users/jmmastey/followers","following_url":"https://api.github.com/users/jmmastey/following{/other_user}","gists_url":"https://api.github.com/users/jmmastey/gists{/gist_id}","starred_url":"https://api.github.com/users/jmmastey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmmastey/subscriptions","organizations_url":"https://api.github.com/users/jmmastey/orgs","repos_url":"https://api.github.com/users/jmmastey/repos","events_url":"https://api.github.com/users/jmmastey/events{/privacy}","received_events_url":"https://api.github.com/users/jmmastey/received_events","type":"User","site_admin":false},"repo":{"id":20705648,"name":"level_up_exercises","full_name":"jmmastey/level_up_exercises","owner":{"login":"jmmastey","id":302011,"avatar_url":"https://avatars.githubusercontent.com/u/302011?v=3","gravatar_id":"","url":"https://api.github.com/users/jmmastey","html_url":"https://github.com/jmmastey","followers_url":"https://api.github.com/users/jmmastey/followers","following_url":"https://api.github.com/users/jmmastey/following{/other_user}","gists_url":"https://api.github.com/users/jmmastey/gists{/gist_id}","starred_url":"https://api.github.com/users/jmmastey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmmastey/subscriptions","organizations_url":"https://api.github.com/users/jmmastey/orgs","repos_url":"https://api.github.com/users/jmmastey/repos","events_url":"https://api.github.com/users/jmmastey/events{/privacy}","received_events_url":"https://api.github.com/users/jmmastey/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jmmastey/level_up_exercises","description":"A series of code-related assignments to challenge starting engineers","fork":false,"url":"https://api.github.com/repos/jmmastey/level_up_exercises","forks_url":"https://api.github.com/repos/jmmastey/level_up_exercises/forks","keys_url":"https://api.github.com/repos/jmmastey/level_up_exercises/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jmmastey/level_up_exercises/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jmmastey/level_up_exercises/teams","hooks_url":"https://api.github.com/repos/jmmastey/level_up_exercises/hooks","issue_events_url":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/events{/number}","events_url":"https://api.github.com/repos/jmmastey/level_up_exercises/events","assignees_url":"https://api.github.com/repos/jmmastey/level_up_exercises/assignees{/user}","branches_url":"https://api.github.com/repos/jmmastey/level_up_exercises/branches{/branch}","tags_url":"https://api.github.com/repos/jmmastey/level_up_exercises/tags","blobs_url":"https://api.github.com/repos/jmmastey/level_up_exercises/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jmmastey/level_up_exercises/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jmmastey/level_up_exercises/git/refs{/sha}","trees_url":"https://api.github.com/repos/jmmastey/level_up_exercises/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jmmastey/level_up_exercises/statuses/{sha}","languages_url":"https://api.github.com/repos/jmmastey/level_up_exercises/languages","stargazers_url":"https://api.github.com/repos/jmmastey/level_up_exercises/stargazers","contributors_url":"https://api.github.com/repos/jmmastey/level_up_exercises/contributors","subscribers_url":"https://api.github.com/repos/jmmastey/level_up_exercises/subscribers","subscription_url":"https://api.github.com/repos/jmmastey/level_up_exercises/subscription","commits_url":"https://api.github.com/repos/jmmastey/level_up_exercises/commits{/sha}","git_commits_url":"https://api.github.com/repos/jmmastey/level_up_exercises/git/commits{/sha}","comments_url":"https://api.github.com/repos/jmmastey/level_up_exercises/comments{/number}","issue_comment_url":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/comments{/number}","contents_url":"https://api.github.com/repos/jmmastey/level_up_exercises/contents/{+path}","compare_url":"https://api.github.com/repos/jmmastey/level_up_exercises/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jmmastey/level_up_exercises/merges","archive_url":"https://api.github.com/repos/jmmastey/level_up_exercises/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jmmastey/level_up_exercises/downloads","issues_url":"https://api.github.com/repos/jmmastey/level_up_exercises/issues{/number}","pulls_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls{/number}","milestones_url":"https://api.github.com/repos/jmmastey/level_up_exercises/milestones{/number}","notifications_url":"https://api.github.com/repos/jmmastey/level_up_exercises/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jmmastey/level_up_exercises/labels{/name}","releases_url":"https://api.github.com/repos/jmmastey/level_up_exercises/releases{/id}","created_at":"2014-06-10T23:42:24Z","updated_at":"2015-02-18T21:05:33Z","pushed_at":"2015-02-18T21:05:33Z","git_url":"git://github.com/jmmastey/level_up_exercises.git","ssh_url":"git@github.com:jmmastey/level_up_exercises.git","clone_url":"https://github.com/jmmastey/level_up_exercises.git","svn_url":"https://github.com/jmmastey/level_up_exercises","homepage":"http://leveluprails.herokuapp.com","size":145305,"stargazers_count":14,"watchers_count":14,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":71,"mirror_url":null,"open_issues_count":3,"forks":71,"open_issues":3,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/515"},"html":{"href":"https://github.com/jmmastey/level_up_exercises/pull/515"},"issue":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/515"},"comments":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/515/comments"},"review_comments":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/515/comments"},"review_comment":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/515/commits"},"statuses":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/statuses/315f03ca8a60e591a82b9fb85ffc0477122d6a18"}}}}