소스 검색

OAuth tokens can be revoked with ShopifyAPI::OAuth.revoke .

Nick Hoffman 10 년 전
부모
커밋
9da9190b4a
3개의 변경된 파일22개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      lib/shopify_api/resources/o_auth.rb
  2. 5 0
      test/fixtures/o_auth_revoke.json
  3. 8 0
      test/o_auth_test.rb

+ 9 - 0
lib/shopify_api/resources/o_auth.rb

@@ -0,0 +1,9 @@
+module ShopifyAPI
+  class OAuth < Base
+    self.collection_name = 'oauth'
+
+    def self.revoke
+      delete(:revoke)
+    end
+  end
+end

+ 5 - 0
test/fixtures/o_auth_revoke.json

@@ -0,0 +1,5 @@
+{
+  "permission": {
+    "access_token": "8ccb0232e04c672bf044f71ff0156098"
+  }
+}

+ 8 - 0
test/o_auth_test.rb

@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class OAuthTest < Test::Unit::TestCase
+  def test_revoke_kills_the_token
+    fake 'oauth/revoke', method: :delete, body: load_fixture('o_auth_revoke')
+    assert ShopifyAPI::OAuth.revoke
+  end
+end