omniauth-ebay 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +23 -17
- data/fixtures/vcr_cassettes/callback_phase.yml +113 -0
- data/fixtures/vcr_cassettes/request_phase.yml +58 -0
- data/lib/ebay_api.rb +21 -8
- data/lib/omniauth/strategies/ebay.rb +4 -14
- data/lib/omniauth-ebay/version.rb +1 -1
- data/omniauth-ebay.gemspec +8 -2
- data/spec/lib/ebay_api_spec.rb +4 -0
- data/spec/omniauth/strategies/ebay_spec.rb +49 -0
- data/spec/spec_helper.rb +13 -0
- metadata +117 -63
data/README.md
CHANGED
@@ -1,24 +1,25 @@
|
|
1
|
-
OmniAuth eBay
|
2
|
-
|
1
|
+
# OmniAuth eBay
|
2
|
+
|
3
|
+
![OmniAuth-Ebay!](http://dl.dropbox.com/u/7525692/omniauthebay.png)
|
3
4
|
|
4
5
|
In this gem you will find an OmniAuth eBay strategy that is compliant with the Open eBay Apps API.
|
5
6
|
You can read all about it here: [Open eBay Apps Developers Zone](http://developer.ebay.com/DevZone/open-ebay-apps/Concepts/OpeneBayUGDev.html)
|
6
7
|
|
7
|
-
Usage
|
8
|
-
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
Note: The examples are for a Rails 3 app.
|
9
11
|
|
10
|
-
|
12
|
+
* Add our gem to your Gemfile:
|
11
13
|
|
12
|
-
* Add our gem to your `Gemfile`
|
13
14
|
`gem 'omniauth-ebay'`
|
14
15
|
|
15
16
|
* Add to your omniauth initializer (`config/initializers/omniauth.rb`) the ebay strategy like so:
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
```ruby
|
19
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
20
|
+
provider :ebay, "runame", "devid", "appid", "certid", "siteid", "apiurl"
|
21
|
+
end
|
22
|
+
```
|
22
23
|
|
23
24
|
Insert your app credentials in the given order. You can find out these details by going into your developer's account at [eBay DevZone](https://developer.ebay.com/DevZone/account/)
|
24
25
|
|
@@ -28,17 +29,21 @@ You will need to define the callback path in your relevant app RUname, so don't
|
|
28
29
|
* Set a route to the callback path of your sessions controller, and handle the session creation there. You will be able to access
|
29
30
|
the omniauth session data by accessing `request.env['omniauth.auth']`
|
30
31
|
|
31
|
-
|
32
|
-
====================================
|
32
|
+
## Requirements
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
Ruby 1.8.7+, Rails 3.0+, OmniAuth 1.0+.
|
35
|
+
|
36
|
+
# How it Works
|
37
|
+
|
38
|
+
The ebay strategy module uses the standard omniauth strategy module, and it also uses a small module
|
39
|
+
designed just for the eBay API calls.
|
40
|
+
|
41
|
+
## Request Phase
|
36
42
|
|
37
43
|
* API call to eBay, requesting a session id.
|
38
44
|
* Redirecting to eBay login with the session id.
|
39
45
|
|
40
|
-
Callback Phase
|
41
|
-
-----------------------------------------
|
46
|
+
## Callback Phase
|
42
47
|
|
43
48
|
* API call to eBay, requesting an ebay auth token, with the secret id and username retrieved from the request.
|
44
49
|
* API call to eBay, requesting the user's info by using the ebay auth token from the last call.
|
@@ -49,5 +54,6 @@ Callback Phase
|
|
49
54
|
`ebay_token` - The current session's auth token, to be used for API calls.
|
50
55
|
|
51
56
|
`email` - The user's email address.
|
57
|
+
|
52
58
|
* Extra data - We're also passing an optional parameter, `return_to`, which allows you to specify a URL you want the redirect the user to when the authentication process is completed.
|
53
59
|
|
@@ -0,0 +1,113 @@
|
|
1
|
+
---
|
2
|
+
recorded_with: VCR 2.0.1
|
3
|
+
http_interactions:
|
4
|
+
- request:
|
5
|
+
method: post
|
6
|
+
uri: https://api.ebay.com/ws/api.dll
|
7
|
+
body:
|
8
|
+
string: " <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <FetchTokenRequest xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <RequesterCredentials>\n <Username>test_user</Username>\n </RequesterCredentials>\n <SecretID>fake</SecretID>\n </FetchTokenRequest>\n"
|
9
|
+
headers:
|
10
|
+
x-ebay-api-call-name:
|
11
|
+
- FetchToken
|
12
|
+
accept:
|
13
|
+
- "*/*"
|
14
|
+
content-type:
|
15
|
+
- text/xml
|
16
|
+
x-ebay-api-app-name:
|
17
|
+
- a219dda1-87b5-11e1-b0c4-0800200c9a66
|
18
|
+
content-length:
|
19
|
+
- "350"
|
20
|
+
x-ebay-api-dev-name:
|
21
|
+
- bdc8a861-87b5-11e1-b0c4-0800200c9a66
|
22
|
+
x-ebay-api-cert-name:
|
23
|
+
- cf9340f3-87b5-11e1-b0c4-0800200c9a66
|
24
|
+
x-ebay-api-siteid:
|
25
|
+
- "0"
|
26
|
+
x-ebay-api-compatibility-level:
|
27
|
+
- "675"
|
28
|
+
response:
|
29
|
+
status:
|
30
|
+
code: 200
|
31
|
+
message: OK
|
32
|
+
headers:
|
33
|
+
x-ebay-api-pool-name:
|
34
|
+
- 11212345690123456722222
|
35
|
+
x-ebay-esb-siteid:
|
36
|
+
- "0"
|
37
|
+
content-type:
|
38
|
+
- text/xml
|
39
|
+
x-ebay-esb-guid:
|
40
|
+
- fak:uuid:Fakefakefakefakefakefakefakefak
|
41
|
+
x-ebay-esb-app-name:
|
42
|
+
- fakefake-fake-fake-fake-fakefakefake
|
43
|
+
server:
|
44
|
+
- Apache-Coyote/1.1
|
45
|
+
content-length:
|
46
|
+
- "1219"
|
47
|
+
x-ebay-esb-call-name:
|
48
|
+
- FetchToken
|
49
|
+
date:
|
50
|
+
- Mon, 16 Apr 2012 11:13:26 GMT
|
51
|
+
x-ebay-api-server-name:
|
52
|
+
- ___ffffffffffffffffffffffffffffffffffffffffffff
|
53
|
+
body:
|
54
|
+
string: |-
|
55
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
56
|
+
<FetchTokenResponse xmlns="urn:ebay:apis:eBLBaseComponents"><Timestamp>2012-04-16T11:13:26.603Z</Timestamp><Ack>Success</Ack><Version>767</Version><Build>E767_CORE_BUNDLED_14671989_R1</Build><eBayAuthToken>fake</eBayAuthToken><HardExpirationTime>2013-10-08T08:36:50.000Z</HardExpirationTime></FetchTokenResponse>
|
57
|
+
http_version: "1.1"
|
58
|
+
recorded_at: Mon, 16 Apr 2012 11:12:58 GMT
|
59
|
+
- request:
|
60
|
+
method: post
|
61
|
+
uri: https://api.ebay.com/ws/api.dll
|
62
|
+
body:
|
63
|
+
string: " <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <GetUserRequest xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <RequesterCredentials>\n <eBayAuthToken>fake</eBayAuthToken>\n </RequesterCredentials>\n </GetUserRequest>\n"
|
64
|
+
headers:
|
65
|
+
x-ebay-api-call-name:
|
66
|
+
- GetUser
|
67
|
+
accept:
|
68
|
+
- "*/*"
|
69
|
+
content-type:
|
70
|
+
- text/xml
|
71
|
+
x-ebay-api-app-name:
|
72
|
+
- a219dda1-87b5-11e1-b0c4-0800200c9a66
|
73
|
+
content-length:
|
74
|
+
- "350"
|
75
|
+
x-ebay-api-dev-name:
|
76
|
+
- bdc8a861-87b5-11e1-b0c4-0800200c9a66
|
77
|
+
x-ebay-api-cert-name:
|
78
|
+
- cf9340f3-87b5-11e1-b0c4-0800200c9a66
|
79
|
+
x-ebay-api-siteid:
|
80
|
+
- "0"
|
81
|
+
x-ebay-api-compatibility-level:
|
82
|
+
- "675"
|
83
|
+
response:
|
84
|
+
status:
|
85
|
+
code: 200
|
86
|
+
message: OK
|
87
|
+
headers:
|
88
|
+
x-ebay-api-pool-name:
|
89
|
+
- fake
|
90
|
+
x-ebay-esb-siteid:
|
91
|
+
- "0"
|
92
|
+
content-type:
|
93
|
+
- text/xml
|
94
|
+
x-ebay-esb-guid:
|
95
|
+
- fake
|
96
|
+
x-ebay-esb-app-name:
|
97
|
+
- fake
|
98
|
+
server:
|
99
|
+
- Apache-Coyote/1.1
|
100
|
+
content-length:
|
101
|
+
- "2162"
|
102
|
+
x-ebay-esb-call-name:
|
103
|
+
- GetUser
|
104
|
+
date:
|
105
|
+
- Mon, 16 Apr 2012 11:13:30 GMT
|
106
|
+
x-ebay-api-server-name:
|
107
|
+
- ___dm8ucis2MTZkMzB8KTYzKzczLTQ2MS09MD07NT43
|
108
|
+
body:
|
109
|
+
string: |-
|
110
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
111
|
+
<GetUserResponse xmlns="urn:ebay:apis:eBLBaseComponents"><Timestamp>2012-04-16T11:13:31.701Z</Timestamp><Ack>Success</Ack><Version>767</Version><Build>E767_CORE_BUNDLED_14671989_R1</Build><User><AboutMePage>false</AboutMePage><EIASToken>fake_eias_token</EIASToken><Email>test@user.com</Email><FeedbackScore>27</FeedbackScore><UniqueNegativeFeedbackCount>0</UniqueNegativeFeedbackCount><UniquePositiveFeedbackCount>0</UniquePositiveFeedbackCount><PositiveFeedbackPercent>0.0</PositiveFeedbackPercent><FeedbackPrivate>false</FeedbackPrivate><FeedbackRatingStar>Yellow</FeedbackRatingStar><IDVerified>false</IDVerified><eBayGoodStanding>true</eBayGoodStanding><NewUser>false</NewUser><RegistrationDate>2000-01-01T07:06:10.000Z</RegistrationDate><Site>US</Site><Status>Confirmed</Status><UserID>test_user</UserID><UserIDChanged>false</UserIDChanged><UserIDLastChanged>2004-01-02T19:18:59.000Z</UserIDLastChanged><VATStatus>NoVATTax</VATStatus><SellerInfo><AllowPaymentEdit>true</AllowPaymentEdit><CheckoutEnabled>true</CheckoutEnabled><CIPBankAccountStored>false</CIPBankAccountStored><GoodStanding>true</GoodStanding><LiveAuctionAuthorized>false</LiveAuctionAuthorized><MerchandizingPref>OptIn</MerchandizingPref><QualifiesForB2BVAT>false</QualifiesForB2BVAT><SellerGuaranteeLevel>NotEligible</SellerGuaranteeLevel><SchedulingInfo><MaxScheduledMinutes>30240</MaxScheduledMinutes><MinScheduledMinutes>0</MinScheduledMinutes><MaxScheduledItems>3000</MaxScheduledItems></SchedulingInfo><StoreOwner>false</StoreOwner><PaymentMethod>NothingOnFile</PaymentMethod><CharityRegistered>false</CharityRegistered><SafePaymentExempt>true</SafePaymentExempt><TransactionPercent>0.0</TransactionPercent><RecoupmentPolicyConsent/></SellerInfo><PayPalAccountLevel>Verified</PayPalAccountLevel><PayPalAccountType>Personal</PayPalAccountType><PayPalAccountStatus>Active</PayPalAccountStatus><eBayWikiReadOnly>false</eBayWikiReadOnly><MotorsDealer>false</MotorsDealer><UniqueNeutralFeedbackCount>0</UniqueNeutralFeedbackCount><EnterpriseSeller>false</EnterpriseSeller></User></GetUserResponse>
|
112
|
+
http_version: "1.1"
|
113
|
+
recorded_at: Mon, 16 Apr 2012 11:13:03 GMT
|
@@ -0,0 +1,58 @@
|
|
1
|
+
---
|
2
|
+
recorded_with: VCR 2.0.1
|
3
|
+
http_interactions:
|
4
|
+
- request:
|
5
|
+
method: post
|
6
|
+
uri: https://api.ebay.com/ws/api.dll
|
7
|
+
body:
|
8
|
+
string: " <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <GetSessionIDRequest xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <RuName>fak_fak_fakeeee-eeeeeeee-eeee-e-eeeee</RuName>\n </GetSessionIDRequest>\n"
|
9
|
+
headers:
|
10
|
+
x-ebay-api-call-name:
|
11
|
+
- GetSessionID
|
12
|
+
accept:
|
13
|
+
- "*/*"
|
14
|
+
content-type:
|
15
|
+
- text/xml
|
16
|
+
x-ebay-api-app-name:
|
17
|
+
- a219dda1-87b5-11e1-b0c4-0800200c9a66
|
18
|
+
content-length:
|
19
|
+
- "350"
|
20
|
+
x-ebay-api-dev-name:
|
21
|
+
- bdc8a861-87b5-11e1-b0c4-0800200c9a66
|
22
|
+
x-ebay-api-cert-name:
|
23
|
+
- cf9340f3-87b5-11e1-b0c4-0800200c9a66
|
24
|
+
x-ebay-api-siteid:
|
25
|
+
- "0"
|
26
|
+
x-ebay-api-compatibility-level:
|
27
|
+
- "675"
|
28
|
+
response:
|
29
|
+
status:
|
30
|
+
code: 200
|
31
|
+
message: OK
|
32
|
+
headers:
|
33
|
+
x-ebay-api-pool-name:
|
34
|
+
- 11212345690123456722222
|
35
|
+
x-ebay-esb-siteid:
|
36
|
+
- "0"
|
37
|
+
content-type:
|
38
|
+
- text/xml
|
39
|
+
x-ebay-esb-guid:
|
40
|
+
- fak:uuid:Fakefakefakefakefakefakefakefak
|
41
|
+
x-ebay-esb-app-name:
|
42
|
+
- fakefake-fake-fake-fake-fakefakefake
|
43
|
+
server:
|
44
|
+
- Apache-Coyote/1.1
|
45
|
+
content-length:
|
46
|
+
- "318"
|
47
|
+
x-ebay-esb-call-name:
|
48
|
+
- GetSessionID
|
49
|
+
date:
|
50
|
+
- Mon, 16 Apr 2012 11:13:24 GMT
|
51
|
+
x-ebay-api-server-name:
|
52
|
+
- ____ffffffffffffffffffffffffffffffffffffffffffff
|
53
|
+
body:
|
54
|
+
string: |-
|
55
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
56
|
+
<GetSessionIDResponse xmlns="urn:ebay:apis:eBLBaseComponents"><Timestamp>2012-04-16T11:13:25.255Z</Timestamp><Ack>Success</Ack><Version>767</Version><Build>E767_CORE_BUNDLED_14671989_R1</Build><SessionID>fake</SessionID></GetSessionIDResponse>
|
57
|
+
http_version: "1.1"
|
58
|
+
recorded_at: Mon, 16 Apr 2012 11:12:57 GMT
|
data/lib/ebay_api.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'multi_xml'
|
2
|
+
|
1
3
|
module EbayAPI
|
2
4
|
|
3
5
|
EBAY_LOGIN_URL = "https://signin.ebay.com/ws/eBayISAPI.dll"
|
@@ -16,7 +18,7 @@ module EbayAPI
|
|
16
18
|
END
|
17
19
|
|
18
20
|
response = api(X_EBAY_API_GETSESSIONID_CALL_NAME, request)
|
19
|
-
MultiXml.parse(response
|
21
|
+
MultiXml.parse(response)["GetSessionIDResponse"]["SessionID"]
|
20
22
|
end
|
21
23
|
|
22
24
|
def get_auth_token(username, secret_id)
|
@@ -31,7 +33,7 @@ module EbayAPI
|
|
31
33
|
END
|
32
34
|
|
33
35
|
response = api(X_EBAY_API_FETCHAUTHTOKEN_CALL_NAME, request)
|
34
|
-
MultiXml.parse(response
|
36
|
+
MultiXml.parse(response)["FetchTokenResponse"]["eBayAuthToken"]
|
35
37
|
end
|
36
38
|
|
37
39
|
def get_user_info(auth_token)
|
@@ -45,15 +47,27 @@ module EbayAPI
|
|
45
47
|
END
|
46
48
|
|
47
49
|
response = api(X_EBAY_API_GETUSER_CALL_NAME, request)
|
48
|
-
MultiXml.parse(response
|
50
|
+
MultiXml.parse(response)["GetUserResponse"]['User']
|
51
|
+
end
|
52
|
+
|
53
|
+
def ebay_login_url(session_id)
|
54
|
+
#TODO: Refactor ruparams to receive all of the request query string
|
55
|
+
url = "#{EBAY_LOGIN_URL}?SingleSignOn&runame=#{options.runame}&sid=#{URI.escape(session_id).gsub('+', '%2B')}"
|
56
|
+
internal_return_to = request.params['internal_return_to'] || request.params[:internal_return_to]
|
57
|
+
url << "&ruparams=#{CGI::escape('internal_return_to=' + internal_return_to)}" if internal_return_to
|
58
|
+
|
59
|
+
return url
|
49
60
|
end
|
50
61
|
|
51
62
|
protected
|
52
63
|
|
53
64
|
def api(call_name, request)
|
54
65
|
headers = ebay_request_headers(call_name, request.length.to_s)
|
55
|
-
|
56
|
-
|
66
|
+
url = URI.parse(options.apiurl)
|
67
|
+
req = Net::HTTP::Post.new(url.path, headers)
|
68
|
+
http = Net::HTTP.new(url.host, url.port)
|
69
|
+
http.use_ssl = true
|
70
|
+
http.start { |http| http.request(req, request) }.body
|
57
71
|
end
|
58
72
|
|
59
73
|
def ebay_request_headers(call_name, request_length)
|
@@ -63,10 +77,9 @@ module EbayAPI
|
|
63
77
|
'X-EBAY-API-DEV-NAME' => options.devid,
|
64
78
|
'X-EBAY-API-APP-NAME' => options.appid,
|
65
79
|
'X-EBAY-API-CERT-NAME' => options.certid,
|
66
|
-
'X-EBAY-API-SITEID' => options.siteid,
|
80
|
+
'X-EBAY-API-SITEID' => options.siteid.to_s,
|
67
81
|
'Content-Type' => X_EBAY_API_REQUEST_CONTENT_TYPE,
|
68
82
|
'Content-Length' => request_length
|
69
83
|
}
|
70
84
|
end
|
71
|
-
|
72
|
-
end
|
85
|
+
end
|
@@ -26,7 +26,7 @@ module OmniAuth
|
|
26
26
|
|
27
27
|
extra do
|
28
28
|
{
|
29
|
-
:
|
29
|
+
:internal_return_to => request.params['internal_return_to'] || request.params[:internal_return_to]
|
30
30
|
}
|
31
31
|
end
|
32
32
|
|
@@ -36,6 +36,8 @@ module OmniAuth
|
|
36
36
|
def request_phase
|
37
37
|
session_id = generate_session_id
|
38
38
|
redirect ebay_login_url(session_id)
|
39
|
+
rescue Exception => ex
|
40
|
+
fail!("Failed to retrieve session id from ebay", ex)
|
39
41
|
end
|
40
42
|
|
41
43
|
#4: We'll get to the callback phase by setting our accept/reject URL in the ebay application settings(/auth/ebay/callback)
|
@@ -52,20 +54,8 @@ module OmniAuth
|
|
52
54
|
def raw_info
|
53
55
|
@user_info
|
54
56
|
end
|
55
|
-
|
56
|
-
protected
|
57
|
-
|
58
|
-
def ebay_login_url(session_id)
|
59
|
-
#TODO: Refactor ruparams to receive all of the request query string
|
60
|
-
url = "#{EBAY_LOGIN_URL}?SingleSignOn&runame=#{options.runame}&sid=#{URI.escape(session_id).gsub('+', '%2B')}"
|
61
|
-
if request.params[:return_to]
|
62
|
-
url << "&ruparams=#{CGI::escape('return_to=' + request.params['return_to'])}"
|
63
|
-
end
|
64
|
-
return url
|
65
|
-
end
|
66
|
-
|
67
57
|
end
|
68
58
|
end
|
69
59
|
end
|
70
60
|
|
71
|
-
OmniAuth.config.add_camelization 'ebay', 'Ebay'
|
61
|
+
OmniAuth.config.add_camelization 'ebay', 'Ebay'
|
data/omniauth-ebay.gemspec
CHANGED
@@ -9,8 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.email = ["itayadler@gmail.com"]
|
10
10
|
s.homepage = "https://github.com/TheGiftsProject/omniauth-ebay"
|
11
11
|
s.summary = %q{OmniAuth strategy for eBay}
|
12
|
-
s.description = %q{In this gem you will find an OmniAuth eBay strategy that is compliant with the Open eBay Apps API.
|
13
|
-
You can read all about it here: [Open eBay Apps Developers Zone](http://developer.ebay.com/DevZone/open-ebay-apps/Concepts/OpeneBayUGDev.html)}
|
12
|
+
s.description = %q{In this gem you will find an OmniAuth eBay strategy that is compliant with the Open eBay Apps API.}
|
14
13
|
|
15
14
|
s.rubyforge_project = "omniauth-ebay"
|
16
15
|
|
@@ -20,5 +19,12 @@ You can read all about it here: [Open eBay Apps Developers Zone](http://develope
|
|
20
19
|
s.require_paths = ["lib"]
|
21
20
|
|
22
21
|
s.add_runtime_dependency 'omniauth', '~> 1.0'
|
22
|
+
s.add_runtime_dependency 'multi_xml'
|
23
23
|
s.add_development_dependency 'rspec', '~> 2.7'
|
24
|
+
s.add_development_dependency 'rake'
|
25
|
+
s.add_development_dependency 'multi_xml'
|
26
|
+
s.add_development_dependency 'rack-test'
|
27
|
+
s.add_development_dependency 'vcr'
|
28
|
+
s.add_development_dependency 'fakeweb'
|
29
|
+
s.add_development_dependency 'capybara-mechanize'
|
24
30
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vcr'
|
3
|
+
require 'fakeweb'
|
4
|
+
|
5
|
+
VCR.configure do |c|
|
6
|
+
c.cassette_library_dir = 'fixtures/vcr_cassettes'
|
7
|
+
c.hook_into :fakeweb
|
8
|
+
end
|
9
|
+
|
10
|
+
describe OmniAuth::Strategies::Ebay do
|
11
|
+
def app
|
12
|
+
Rack::Builder.new {
|
13
|
+
use Rack::Session::Cookie
|
14
|
+
use OmniAuth::Strategies::Ebay, "runame", "devid", "appid", "certid", "siteid", "https://api.ebay.com/ws/api.dll"
|
15
|
+
run lambda {|env| [404, {'Content-Type' => 'text/plain'}, [nil || env.key?('omniauth.auth').to_s]] }
|
16
|
+
}.to_app
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:auth_hash) { last_request.env['omniauth.auth'] }
|
20
|
+
describe "#request_phase" do
|
21
|
+
it "should redirect to ebay with session_id" do
|
22
|
+
VCR.use_cassette 'request_phase' do
|
23
|
+
get '/auth/ebay'
|
24
|
+
last_response.should be_redirect
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should fail" do
|
29
|
+
get '/auth/ebay'
|
30
|
+
last_response.should be_redirect
|
31
|
+
last_response.location.should =~ /\/auth\/failure/
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#callback_phase" do
|
36
|
+
it "should initialize auth uid and info" do
|
37
|
+
VCR.use_cassette 'callback_phase' do
|
38
|
+
get '/auth/ebay/callback?sid=fake&username=test_user&'
|
39
|
+
auth_hash.should_not be_nil
|
40
|
+
auth_hash.uid.should == 'fake_eias_token'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should fail" do
|
45
|
+
get '/auth/ebay/callback'
|
46
|
+
auth_hash.should be_nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
Bundler.setup :default, :development, :test
|
4
|
+
|
5
|
+
require 'rack/test'
|
6
|
+
require 'capybara/rspec'
|
7
|
+
require 'capybara/mechanize'
|
8
|
+
require 'omniauth-ebay'
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.include Rack::Test::Methods
|
12
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
|
+
end
|
metadata
CHANGED
@@ -1,105 +1,159 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-ebay
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 0.0.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Itay Adler
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-05-14 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: omniauth
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &11628860 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
18
|
+
requirements:
|
26
19
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 0
|
32
|
-
version: "1.0"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
33
22
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rspec
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: *11628860
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: multi_xml
|
27
|
+
requirement: &11628420 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
|
-
requirements:
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *11628420
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &11627820 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
41
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 2
|
46
|
-
- 7
|
47
|
-
version: "2.7"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '2.7'
|
48
44
|
type: :development
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *11627820
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: &11627380 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *11627380
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: multi_xml
|
60
|
+
requirement: &11626920 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *11626920
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack-test
|
71
|
+
requirement: &11626480 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *11626480
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: vcr
|
82
|
+
requirement: &11623000 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *11623000
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: fakeweb
|
93
|
+
requirement: &11622580 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *11622580
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: capybara-mechanize
|
104
|
+
requirement: &11622160 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *11622160
|
113
|
+
description: In this gem you will find an OmniAuth eBay strategy that is compliant
|
114
|
+
with the Open eBay Apps API.
|
115
|
+
email:
|
54
116
|
- itayadler@gmail.com
|
55
117
|
executables: []
|
56
|
-
|
57
118
|
extensions: []
|
58
|
-
|
59
119
|
extra_rdoc_files: []
|
60
|
-
|
61
|
-
files:
|
120
|
+
files:
|
62
121
|
- .gitignore
|
63
122
|
- Gemfile
|
64
123
|
- README.md
|
65
124
|
- Rakefile
|
125
|
+
- fixtures/vcr_cassettes/callback_phase.yml
|
126
|
+
- fixtures/vcr_cassettes/request_phase.yml
|
66
127
|
- lib/ebay_api.rb
|
67
128
|
- lib/omniauth-ebay.rb
|
68
129
|
- lib/omniauth-ebay/version.rb
|
69
130
|
- lib/omniauth/strategies/ebay.rb
|
70
131
|
- omniauth-ebay.gemspec
|
132
|
+
- spec/lib/ebay_api_spec.rb
|
133
|
+
- spec/omniauth/strategies/ebay_spec.rb
|
134
|
+
- spec/spec_helper.rb
|
71
135
|
homepage: https://github.com/TheGiftsProject/omniauth-ebay
|
72
136
|
licenses: []
|
73
|
-
|
74
137
|
post_install_message:
|
75
138
|
rdoc_options: []
|
76
|
-
|
77
|
-
require_paths:
|
139
|
+
require_paths:
|
78
140
|
- lib
|
79
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
142
|
none: false
|
81
|
-
requirements:
|
82
|
-
- -
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
|
85
|
-
|
86
|
-
- 0
|
87
|
-
version: "0"
|
88
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ! '>='
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
148
|
none: false
|
90
|
-
requirements:
|
91
|
-
- -
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
|
94
|
-
segments:
|
95
|
-
- 0
|
96
|
-
version: "0"
|
149
|
+
requirements:
|
150
|
+
- - ! '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
97
153
|
requirements: []
|
98
|
-
|
99
154
|
rubyforge_project: omniauth-ebay
|
100
155
|
rubygems_version: 1.8.17
|
101
156
|
signing_key:
|
102
157
|
specification_version: 3
|
103
158
|
summary: OmniAuth strategy for eBay
|
104
159
|
test_files: []
|
105
|
-
|