GitHub PullRequestReviewCommentEvent at 2014-09-15 16:19:42
Repository: eidolon
Actor: AshFurrow
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/artsy/eidolon/pulls/comments/17551866","id":17551866,"diff_hunk":"@@ -0,0 +1,97 @@\n+import Quick\n+import Nimble\n+import Kiosk\n+\n+func beInTheFuture() -> MatcherFunc<NSDate> {\n+    return MatcherFunc { actualExpression, failureMessage in\n+        let instance = actualExpression.evaluate()\n+        let now = NSDate.date()\n+        return instance.compare(now) == NSComparisonResult.OrderedDescending\n+    }\n+}\n+\n+class ArtsyAPISpec: QuickSpec {\n+    override func spec() {\n+        describe(\"keys\", { () -> () in\n+            it(\"stubs responses for invalid keys\") {\n+                let invalidKeys = APIKeys(key: \"\", secret: \"\")\n+                expect(invalidKeys.stubResponses).to(beTruthy())\n+            }\n+            \n+            it(\"doesn't stub responses for valid keys\") {\n+                let validKeys = APIKeys(key: \"key\", secret: \"secret\")\n+                expect(validKeys.stubResponses).to(beFalsy())\n+            }\n+        })\n+        \n+        describe(\"requests\") {\n+            beforeSuite { () -> () in\n+                // Force provider to stub responses\n+                APIKeys.sharedKeys = APIKeys(key: \"\", secret: \"\")\n+                Provider.sharedProvider = Provider.StubbingProvider()\n+            }\n+            \n+            afterSuite { () -> () in\n+                // Reset provider\n+                APIKeys.sharedKeys = APIKeys()\n+                Provider.sharedProvider = Provider.DefaultProvider()\n+            }\n+            \n+            it(\"returns some data\") {\n+                setDefaultsKeys(\"\", nil)\n+                \n+                var called = false\n+                // Make any XApp request, doesn't matter which, but make sure to subscribe so it actually fires\n+                XAppRequest(.FeaturedWorks).subscribeNext({ (object) -> Void in\n+                    called = true\n+                })\n+                \n+                expect{called}.toEventually(beTruthy(), timeout: 1.0, pollInterval: 0.1)\n+            }\n+            \n+            it(\"gets XApp token if it doesn't exist yet\") {\n+                setDefaultsKeys(\"\", nil)\n+                \n+                XAppRequest(.FeaturedWorks).subscribeNext({ (object) -> Void in\n+                    // nop\n+                })\n+                \n+                let past = NSDate(timeIntervalSinceNow: -1000)\n+                expect{getDefaultsKeys().key}.toEventually(equal(\"some token that never expires\"), timeout: 1.0, pollInterval: 0.1)\n+                expect{getDefaultsKeys().expiry}.toEventuallyNot(beNil(), timeout: 1.0, pollInterval: 0.1)\n+                expect{getDefaultsKeys().expiry ?? past}.toEventually(beInTheFuture(), timeout: 1.0, pollInterval: 0.1)","path":"KioskTests/ArtsyAPISpec.swift","position":62,"original_position":62,"commit_id":"6b16ef15bd3ef04fd46cd6fd698c5319d76c7107","original_commit_id":"6b16ef15bd3ef04fd46cd6fd698c5319d76c7107","user":{"login":"AshFurrow","id":498212,"avatar_url":"https://avatars.githubusercontent.com/u/498212?v=2","gravatar_id":"0ebf471a3ae8df42a84f93a7efbbdbd0","url":"https://api.github.com/users/AshFurrow","html_url":"https://github.com/AshFurrow","followers_url":"https://api.github.com/users/AshFurrow/followers","following_url":"https://api.github.com/users/AshFurrow/following{/other_user}","gists_url":"https://api.github.com/users/AshFurrow/gists{/gist_id}","starred_url":"https://api.github.com/users/AshFurrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AshFurrow/subscriptions","organizations_url":"https://api.github.com/users/AshFurrow/orgs","repos_url":"https://api.github.com/users/AshFurrow/repos","events_url":"https://api.github.com/users/AshFurrow/events{/privacy}","received_events_url":"https://api.github.com/users/AshFurrow/received_events","type":"User","site_admin":false},"body":"Ah, you know what? I'm being silly. Originally, Moya used a `RACSubject` to send data back, but now it uses a proper `RACSignal`. So we should be fine to move to `to` instead of `toEventually`, but it'll require a change in Moya. \r\n\r\nWant to merge this as-is for now, and I'll create an issue to make that change?","created_at":"2014-09-15T16:19:42Z","updated_at":"2014-09-15T16:19:42Z","html_url":"https://github.com/artsy/eidolon/pull/29#discussion_r17551866","pull_request_url":"https://api.github.com/repos/artsy/eidolon/pulls/29","_links":{"self":{"href":"https://api.github.com/repos/artsy/eidolon/pulls/comments/17551866"},"html":{"href":"https://github.com/artsy/eidolon/pull/29#discussion_r17551866"},"pull_request":{"href":"https://api.github.com/repos/artsy/eidolon/pulls/29"}}},"pull_request":{"url":"https://api.github.com/repos/artsy/eidolon/pulls/29","id":21184402,"html_url":"https://github.com/artsy/eidolon/pull/29","diff_url":"https://github.com/artsy/eidolon/pull/29.diff","patch_url":"https://github.com/artsy/eidolon/pull/29.patch","issue_url":"https://api.github.com/repos/artsy/eidolon/issues/29","number":29,"state":"open","locked":false,"title":"@orta => Basics of transparent self-app-token-fetching API client","user":{"login":"AshFurrow","id":498212,"avatar_url":"https://avatars.githubusercontent.com/u/498212?v=2","gravatar_id":"0ebf471a3ae8df42a84f93a7efbbdbd0","url":"https://api.github.com/users/AshFurrow","html_url":"https://github.com/AshFurrow","followers_url":"https://api.github.com/users/AshFurrow/followers","following_url":"https://api.github.com/users/AshFurrow/following{/other_user}","gists_url":"https://api.github.com/users/AshFurrow/gists{/gist_id}","starred_url":"https://api.github.com/users/AshFurrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AshFurrow/subscriptions","organizations_url":"https://api.github.com/users/AshFurrow/orgs","repos_url":"https://api.github.com/users/AshFurrow/repos","events_url":"https://api.github.com/users/AshFurrow/events{/privacy}","received_events_url":"https://api.github.com/users/AshFurrow/received_events","type":"User","site_admin":false},"body":"There is a call to `.FeaturedWorks` (\"/api/v1/sets\") in the app delegate as a proof-of-concept. \r\n\r\nThe basics of use are, instead of calling `ArtsyProvider.request(.Whatever)` as you normally would, you just call `ArtsyProvider.XAppRequest(.Whatever)`. It'll check if the [XApp token](https://developers.artsy.net/docs/authentication) is present and hasn't expired yet, transparently fetching a new one if required, and signing all non-XApp token requests with the XApp token. \r\n\r\nWork-in-progress because I still want to address: \r\n\r\n- [x] Needs tests.\r\n- [x] I don't like the `ReactiveMoyaProvider` extension instance method referencing `ArtsyProvider`, an instance of that class. \r\n\r\n![](http://i.imgur.com/UT69wID.gif)","created_at":"2014-09-12T23:00:09Z","updated_at":"2014-09-15T16:19:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2f57888f2370d3de34cdfa871ee108a9066af39c","assignee":{"login":"orta","id":49038,"avatar_url":"https://avatars.githubusercontent.com/u/49038?v=2","gravatar_id":"f116cb3be23153ec08b94e8bd4dbcfeb","url":"https://api.github.com/users/orta","html_url":"https://github.com/orta","followers_url":"https://api.github.com/users/orta/followers","following_url":"https://api.github.com/users/orta/following{/other_user}","gists_url":"https://api.github.com/users/orta/gists{/gist_id}","starred_url":"https://api.github.com/users/orta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orta/subscriptions","organizations_url":"https://api.github.com/users/orta/orgs","repos_url":"https://api.github.com/users/orta/repos","events_url":"https://api.github.com/users/orta/events{/privacy}","received_events_url":"https://api.github.com/users/orta/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/artsy/eidolon/pulls/29/commits","review_comments_url":"https://api.github.com/repos/artsy/eidolon/pulls/29/comments","review_comment_url":"https://api.github.com/repos/artsy/eidolon/pulls/comments/{number}","comments_url":"https://api.github.com/repos/artsy/eidolon/issues/29/comments","statuses_url":"https://api.github.com/repos/artsy/eidolon/statuses/6b16ef15bd3ef04fd46cd6fd698c5319d76c7107","head":{"label":"AshFurrow:auctions-api","ref":"auctions-api","sha":"6b16ef15bd3ef04fd46cd6fd698c5319d76c7107","user":{"login":"AshFurrow","id":498212,"avatar_url":"https://avatars.githubusercontent.com/u/498212?v=2","gravatar_id":"0ebf471a3ae8df42a84f93a7efbbdbd0","url":"https://api.github.com/users/AshFurrow","html_url":"https://github.com/AshFurrow","followers_url":"https://api.github.com/users/AshFurrow/followers","following_url":"https://api.github.com/users/AshFurrow/following{/other_user}","gists_url":"https://api.github.com/users/AshFurrow/gists{/gist_id}","starred_url":"https://api.github.com/users/AshFurrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AshFurrow/subscriptions","organizations_url":"https://api.github.com/users/AshFurrow/orgs","repos_url":"https://api.github.com/users/AshFurrow/repos","events_url":"https://api.github.com/users/AshFurrow/events{/privacy}","received_events_url":"https://api.github.com/users/AshFurrow/received_events","type":"User","site_admin":false},"repo":{"id":22613572,"name":"eidolon","full_name":"AshFurrow/eidolon","owner":{"login":"AshFurrow","id":498212,"avatar_url":"https://avatars.githubusercontent.com/u/498212?v=2","gravatar_id":"0ebf471a3ae8df42a84f93a7efbbdbd0","url":"https://api.github.com/users/AshFurrow","html_url":"https://github.com/AshFurrow","followers_url":"https://api.github.com/users/AshFurrow/followers","following_url":"https://api.github.com/users/AshFurrow/following{/other_user}","gists_url":"https://api.github.com/users/AshFurrow/gists{/gist_id}","starred_url":"https://api.github.com/users/AshFurrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AshFurrow/subscriptions","organizations_url":"https://api.github.com/users/AshFurrow/orgs","repos_url":"https://api.github.com/users/AshFurrow/repos","events_url":"https://api.github.com/users/AshFurrow/events{/privacy}","received_events_url":"https://api.github.com/users/AshFurrow/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AshFurrow/eidolon","description":"The Artsy Auction Kiosk App","fork":true,"url":"https://api.github.com/repos/AshFurrow/eidolon","forks_url":"https://api.github.com/repos/AshFurrow/eidolon/forks","keys_url":"https://api.github.com/repos/AshFurrow/eidolon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AshFurrow/eidolon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AshFurrow/eidolon/teams","hooks_url":"https://api.github.com/repos/AshFurrow/eidolon/hooks","issue_events_url":"https://api.github.com/repos/AshFurrow/eidolon/issues/events{/number}","events_url":"https://api.github.com/repos/AshFurrow/eidolon/events","assignees_url":"https://api.github.com/repos/AshFurrow/eidolon/assignees{/user}","branches_url":"https://api.github.com/repos/AshFurrow/eidolon/branches{/branch}","tags_url":"https://api.github.com/repos/AshFurrow/eidolon/tags","blobs_url":"https://api.github.com/repos/AshFurrow/eidolon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AshFurrow/eidolon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AshFurrow/eidolon/git/refs{/sha}","trees_url":"https://api.github.com/repos/AshFurrow/eidolon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AshFurrow/eidolon/statuses/{sha}","languages_url":"https://api.github.com/repos/AshFurrow/eidolon/languages","stargazers_url":"https://api.github.com/repos/AshFurrow/eidolon/stargazers","contributors_url":"https://api.github.com/repos/AshFurrow/eidolon/contributors","subscribers_url":"https://api.github.com/repos/AshFurrow/eidolon/subscribers","subscription_url":"https://api.github.com/repos/AshFurrow/eidolon/subscription","commits_url":"https://api.github.com/repos/AshFurrow/eidolon/commits{/sha}","git_commits_url":"https://api.github.com/repos/AshFurrow/eidolon/git/commits{/sha}","comments_url":"https://api.github.com/repos/AshFurrow/eidolon/comments{/number}","issue_comment_url":"https://api.github.com/repos/AshFurrow/eidolon/issues/comments/{number}","contents_url":"https://api.github.com/repos/AshFurrow/eidolon/contents/{+path}","compare_url":"https://api.github.com/repos/AshFurrow/eidolon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AshFurrow/eidolon/merges","archive_url":"https://api.github.com/repos/AshFurrow/eidolon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AshFurrow/eidolon/downloads","issues_url":"https://api.github.com/repos/AshFurrow/eidolon/issues{/number}","pulls_url":"https://api.github.com/repos/AshFurrow/eidolon/pulls{/number}","milestones_url":"https://api.github.com/repos/AshFurrow/eidolon/milestones{/number}","notifications_url":"https://api.github.com/repos/AshFurrow/eidolon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AshFurrow/eidolon/labels{/name}","releases_url":"https://api.github.com/repos/AshFurrow/eidolon/releases{/id}","created_at":"2014-08-04T17:39:14Z","updated_at":"2014-08-07T13:17:22Z","pushed_at":"2014-09-15T16:00:10Z","git_url":"git://github.com/AshFurrow/eidolon.git","ssh_url":"git@github.com:AshFurrow/eidolon.git","clone_url":"https://github.com/AshFurrow/eidolon.git","svn_url":"https://github.com/AshFurrow/eidolon","homepage":null,"size":576,"stargazers_count":0,"watchers_count":0,"language":"Swift","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":"artsy:master","ref":"master","sha":"0ad27cf9c9b2710ef6bfdbaf28b68795448350cb","user":{"login":"artsy","id":546231,"avatar_url":"https://avatars.githubusercontent.com/u/546231?v=2","gravatar_id":"b220e837a1f803e7e25a06cc8f551251","url":"https://api.github.com/users/artsy","html_url":"https://github.com/artsy","followers_url":"https://api.github.com/users/artsy/followers","following_url":"https://api.github.com/users/artsy/following{/other_user}","gists_url":"https://api.github.com/users/artsy/gists{/gist_id}","starred_url":"https://api.github.com/users/artsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artsy/subscriptions","organizations_url":"https://api.github.com/users/artsy/orgs","repos_url":"https://api.github.com/users/artsy/repos","events_url":"https://api.github.com/users/artsy/events{/privacy}","received_events_url":"https://api.github.com/users/artsy/received_events","type":"Organization","site_admin":false},"repo":{"id":22613546,"name":"eidolon","full_name":"artsy/eidolon","owner":{"login":"artsy","id":546231,"avatar_url":"https://avatars.githubusercontent.com/u/546231?v=2","gravatar_id":"b220e837a1f803e7e25a06cc8f551251","url":"https://api.github.com/users/artsy","html_url":"https://github.com/artsy","followers_url":"https://api.github.com/users/artsy/followers","following_url":"https://api.github.com/users/artsy/following{/other_user}","gists_url":"https://api.github.com/users/artsy/gists{/gist_id}","starred_url":"https://api.github.com/users/artsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artsy/subscriptions","organizations_url":"https://api.github.com/users/artsy/orgs","repos_url":"https://api.github.com/users/artsy/repos","events_url":"https://api.github.com/users/artsy/events{/privacy}","received_events_url":"https://api.github.com/users/artsy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/artsy/eidolon","description":"The Artsy Auction Kiosk App","fork":false,"url":"https://api.github.com/repos/artsy/eidolon","forks_url":"https://api.github.com/repos/artsy/eidolon/forks","keys_url":"https://api.github.com/repos/artsy/eidolon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/artsy/eidolon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/artsy/eidolon/teams","hooks_url":"https://api.github.com/repos/artsy/eidolon/hooks","issue_events_url":"https://api.github.com/repos/artsy/eidolon/issues/events{/number}","events_url":"https://api.github.com/repos/artsy/eidolon/events","assignees_url":"https://api.github.com/repos/artsy/eidolon/assignees{/user}","branches_url":"https://api.github.com/repos/artsy/eidolon/branches{/branch}","tags_url":"https://api.github.com/repos/artsy/eidolon/tags","blobs_url":"https://api.github.com/repos/artsy/eidolon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/artsy/eidolon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/artsy/eidolon/git/refs{/sha}","trees_url":"https://api.github.com/repos/artsy/eidolon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/artsy/eidolon/statuses/{sha}","languages_url":"https://api.github.com/repos/artsy/eidolon/languages","stargazers_url":"https://api.github.com/repos/artsy/eidolon/stargazers","contributors_url":"https://api.github.com/repos/artsy/eidolon/contributors","subscribers_url":"https://api.github.com/repos/artsy/eidolon/subscribers","subscription_url":"https://api.github.com/repos/artsy/eidolon/subscription","commits_url":"https://api.github.com/repos/artsy/eidolon/commits{/sha}","git_commits_url":"https://api.github.com/repos/artsy/eidolon/git/commits{/sha}","comments_url":"https://api.github.com/repos/artsy/eidolon/comments{/number}","issue_comment_url":"https://api.github.com/repos/artsy/eidolon/issues/comments/{number}","contents_url":"https://api.github.com/repos/artsy/eidolon/contents/{+path}","compare_url":"https://api.github.com/repos/artsy/eidolon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/artsy/eidolon/merges","archive_url":"https://api.github.com/repos/artsy/eidolon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/artsy/eidolon/downloads","issues_url":"https://api.github.com/repos/artsy/eidolon/issues{/number}","pulls_url":"https://api.github.com/repos/artsy/eidolon/pulls{/number}","milestones_url":"https://api.github.com/repos/artsy/eidolon/milestones{/number}","notifications_url":"https://api.github.com/repos/artsy/eidolon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/artsy/eidolon/labels{/name}","releases_url":"https://api.github.com/repos/artsy/eidolon/releases{/id}","created_at":"2014-08-04T17:38:26Z","updated_at":"2014-09-15T16:10:30Z","pushed_at":"2014-09-15T13:34:22Z","git_url":"git://github.com/artsy/eidolon.git","ssh_url":"git@github.com:artsy/eidolon.git","clone_url":"https://github.com/artsy/eidolon.git","svn_url":"https://github.com/artsy/eidolon","homepage":null,"size":732,"stargazers_count":49,"watchers_count":49,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":49,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/artsy/eidolon/pulls/29"},"html":{"href":"https://github.com/artsy/eidolon/pull/29"},"issue":{"href":"https://api.github.com/repos/artsy/eidolon/issues/29"},"comments":{"href":"https://api.github.com/repos/artsy/eidolon/issues/29/comments"},"review_comments":{"href":"https://api.github.com/repos/artsy/eidolon/pulls/29/comments"},"review_comment":{"href":"https://api.github.com/repos/artsy/eidolon/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/artsy/eidolon/pulls/29/commits"},"statuses":{"href":"https://api.github.com/repos/artsy/eidolon/statuses/6b16ef15bd3ef04fd46cd6fd698c5319d76c7107"}}}}