gigya 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +15 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +6 -0
- data/gigya.gemspec +21 -0
- data/lib/gigya.rb +25 -0
- data/lib/gigya/http_service.rb +12 -0
- data/lib/gigya/oauth.rb +38 -0
- data/lib/gigya/rest_api.rb +9 -0
- data/lib/gigya/version.rb +3 -0
- data/spec/cassettes/Gigya_OAuth/get_token/returns_the_oauth_access_token.json +1 -0
- data/spec/cassettes/Gigya_OAuth/login/returns_the_code_in_response_location.json +1 -0
- data/spec/cassettes/Gigya_RestAPI/get_user_info/returns_the_user_infos.json +1 -0
- data/spec/lib/gigya/oauth_spec.rb +31 -0
- data/spec/lib/gigya/rest_api_spec.rb +16 -0
- data/spec/lib/gigya_spec.rb +9 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/support/vcr.rb +23 -0
- metadata +91 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 68df57c03b0c57dcc5153ab121f41f08c87b5084
|
4
|
+
data.tar.gz: caf740b1c4b09e19554c573e8ed128a5707c7588
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a084d94db8a7cef67e4cac7a64c8fde19c09e32d978c9357ec5258efbb85a99de354eb8d025188bf5407f04ea590e39c3cc093131bb1ff595542cbe5fa7261a4
|
7
|
+
data.tar.gz: a4ab80367dbf6500f1b42bde7223499c8e7265da84b54d8005006866a9b84458f2328b109393bb7abae1a7119a0fd449c65412c48df6cd5b98794bcdabb0a739
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Johalf Farina
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/johalf/gigya.svg?branch=master)](https://travis-ci.org/johalf/gigya)
|
2
|
+
|
3
|
+
# Gigya
|
4
|
+
|
5
|
+
Gigya's gem is a lightweight library to connect for multiple social networks using Gigya's REST API. It allows read/write access REST API, as well as support for OAuth.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'gigya'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install gigya
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( http://github.com/johalf/gigya/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/gigya.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'gigya/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "gigya"
|
7
|
+
gem.version = Gigya::VERSION
|
8
|
+
gem.authors = ["Johalf Farina", "Otto Henrique"]
|
9
|
+
gem.email = ["johalffarina@gmail.com", "ottohenrique@gmail.com"]
|
10
|
+
gem.summary = %q{A lightweight library to social integration using Gigya's REST API service.}
|
11
|
+
gem.description = %q{Gigya's gem is a lightweight library to connect for multiple social networks using Gigya's REST API. It allows read/write access REST API, as well as support for OAuth.}
|
12
|
+
gem.homepage = "http://johalf.github.io/gigya"
|
13
|
+
gem.license = "MIT"
|
14
|
+
|
15
|
+
gem.files = `git ls-files -z`.split("\x0")
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_runtime_dependency "faraday"
|
21
|
+
end
|
data/lib/gigya.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'gigya/version'
|
2
|
+
require 'gigya/http_service'
|
3
|
+
require 'gigya/oauth'
|
4
|
+
require 'gigya/rest_api'
|
5
|
+
|
6
|
+
module Gigya
|
7
|
+
BASE_URL = 'https://socialize.gigya.com'
|
8
|
+
|
9
|
+
URIS = {
|
10
|
+
login: '/socialize.login',
|
11
|
+
get_token: '/socialize.getToken',
|
12
|
+
get_user_info: '/socialize.getUserInfo'
|
13
|
+
}
|
14
|
+
|
15
|
+
class << self
|
16
|
+
attr_accessor :connection
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.connection=(service)
|
20
|
+
@connection = service.connection
|
21
|
+
end
|
22
|
+
|
23
|
+
self.connection = HTTPService
|
24
|
+
end
|
25
|
+
|
data/lib/gigya/oauth.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
module Gigya
|
2
|
+
class OAuth
|
3
|
+
attr_reader :client_id, :client_secret, :oauth_callback_url
|
4
|
+
|
5
|
+
def initialize(client_id, client_secret, oauth_callback_url = nil)
|
6
|
+
@client_id = client_id
|
7
|
+
@client_secret = client_secret
|
8
|
+
@oauth_callback_url = oauth_callback_url
|
9
|
+
end
|
10
|
+
|
11
|
+
def login(provider)
|
12
|
+
params = {
|
13
|
+
client_id: @client_id,
|
14
|
+
redirect_uri: @oauth_callback_url,
|
15
|
+
response_type: 'code',
|
16
|
+
x_provider: provider
|
17
|
+
}
|
18
|
+
|
19
|
+
response = Gigya.connection.get(Gigya::URIS[:login], params)
|
20
|
+
|
21
|
+
response['location']
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_token(code)
|
25
|
+
params = {
|
26
|
+
client_id: @client_id,
|
27
|
+
client_secret: @client_secret,
|
28
|
+
redirect_uri: @oauth_callback_url,
|
29
|
+
grant_type: 'authorization_code',
|
30
|
+
code: code
|
31
|
+
}
|
32
|
+
|
33
|
+
response = Gigya.connection.post(Gigya::URIS[:get_token], params)
|
34
|
+
|
35
|
+
JSON.parse response.body
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"post","uri":"https://socialize.gigya.com/socialize.getToken","body":{"encoding":"US-ASCII","base64_string":"Y2xpZW50X2lkPTNfZ0ZjajFmd3NjWTVPQVFSVG05NC1lU0dZQkowWWhrdEIw\nVE9zNlZXNkFodmd2VlhVYndTN1RUWXg2SXpzUFhuZiZjbGllbnRfc2VjcmV0\nPXFGSm1xQ3d3Zm96SWVUaUFtQXdhWTZpN205N3BUQldYRzY1OHQ0b0phdzAl\nM0QmY29kZT1WQzFfRjUwRDg5N0UzMTczMUYxQUY0NEFFMjc3RDgxNjBCNkNf\nNmFKdm5JdnZ1cFREUVk3a0NhZ3pQZGNtWFpFN0VDNElDWGxGb0xUWWRFaXFD\nU2M0bmNCUGY4M09yM1lNdEEwczdDZVlRcWswQk1aRHViYk0tRnVsTWpBYjRO\nZFpKb2U0UERzN010RTM0dTVDRUhrSHZlT2pYYVBvVm9HS1hoWmtyU0NmanUw\nanNpUDF4VURCX2dtTXh6YUlOS00zeXplcVBzNmdDQ0NCeXZlMngyM25OdXp6\nSkJZeE5jb0J2a0RTJmdyYW50X3R5cGU9YXV0aG9yaXphdGlvbl9jb2RlJnJl\nZGlyZWN0X3VyaT1odHRwcyUzQSUyRiUyRmxvY2FsaG9zdCUzQTMwMDAlMkZm\ncmVlLXZpZGVvcw==\n"},"headers":{"User-Agent":["Faraday v0.9.0"],"Content-Type":["application/x-www-form-urlencoded"],"Accept":["*/*"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Cache-Control":["private, no-store"],"Transfer-Encoding":["chunked"],"Content-Type":["text/javascript; charset=utf-8"],"Set-Cookie":["ASP.NET_SessionId=yqmobjt1c0yfusi0rfvrbcoq; path=/; HttpOnly"],"X-Xss-Protection":["0"],"X-Xrds-Location":["https://socialize.gigya.com/Xrds.aspx"],"X-Server":["web504"],"X-Powered-By":["ASP.NET"],"P3p":["CP=\"IDC COR PSA DEV ADM OUR IND ONL\""],"Date":["Wed, 30 Apr 2014 13:49:48 GMT"]},"body":{"encoding":"US-ASCII","base64_string":"eyJhY2Nlc3NfdG9rZW4iOiJBVDNfNkZEMkQ3NUQxNjBFMEQ5Rjc4MTBGMUI5\nNDU3RDQ0MDVfWVkxQU5Tb1BUT191cjM2cnlLSXYzcDNnVDNiOFdCa2ZwRTBZ\nRk1FOHZwcG5VS1MtTzJIOEd0d1NjM1RoQ0ljcFNEcjlIeVdfZnROcGRnakN2\nbnc1dVRPODRCMnBtdVNCQlFvUDZ3OEhfY0MwMElIVW1ILXhmRFdyRXo4cjFi\nYVkifQ==\n"},"http_version":null},"recorded_at":"Wed, 30 Apr 2014 13:49:48 GMT"}],"recorded_with":"VCR 2.8.0"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"get","uri":"https://socialize.gigya.com/socialize.login?client_id=3_gFcj1fwscY5OAQRTm94-eSGYBJ0YhktB0TOs6VW6AhvgvVXUbwS7TTYx6IzsPXnf&redirect_uri=https://localhost:3000/free-videos&response_type=code&x_provider=facebook","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"User-Agent":["Faraday v0.9.0"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"Accept":["*/*"]}},"response":{"status":{"code":302,"message":"Found"},"headers":{"Cache-Control":["private, no-store"],"Transfer-Encoding":["chunked"],"Content-Type":["text/html; charset=utf-8"],"Location":["https://www.facebook.com/dialog/oauth?client_id=64368537493&redirect_uri=https%3a%2f%2fsocialize.gigya.com%2fGS%2fGSLogin.aspx%3fst%3dTWe3E8QKaqrp5ggLdoiXDYCSYMdunNdGTQXXs0fnYrQ.&response_type=code&scope=user_location%2cuser_birthday&display=popup"],"Set-Cookie":["ASP.NET_SessionId=vrpg2spctefujua0r2m0pps2; path=/; HttpOnly","GLEC=0; domain=socialize.gigya.com; expires=Tue, 29-Apr-2014 13:49:00 GMT; path=/; HttpOnly","glnk=stBE2MNNULo5_hU2fjWp-EwnFDhVq8RQp13O954aCCHlEw_PDfavI2cZxj4Tw1mqhy5i8rkVQnnVhNvcuO-JAQDl7gxply-663xHEpUQNqDPRTYPEMW3MJS19Hzg6VQprDiRflxeGWobCiiuxyakFW8aWhkHPK_ut_dWVTt-RhYndhYVb5tG08gNMT3Omu1eLPWyhbpsx6d79jpfDuDssicPv5DaeG_lyJambY3eSsn9w87Ufcsxpxgk6X26eopsLIhLaHt0F8E3ZXRWL124rvsxYn-X7J-LD5iZ-YN06ub0ZbVi4ZD9Kn-RV-IStR_PyJCJD9t9cJw89a8V-t0ylP7Zg; domain=socialize.gigya.com; expires=Wed, 30-Apr-2014 14:19:00 GMT; path=/; secure; HttpOnly","gst=TWe3E8QKaqrp5ggLdoiXDYCSYMdunNdGTQXXs0fnYrQ.; domain=socialize.gigya.com; expires=Wed, 30-Apr-2014 14:19:00 GMT; path=/; secure; HttpOnly","ucid=zXnnpL8WzKLIuZTsI3GUPg==; domain=gigya.com; expires=Tue, 30-Apr-2024 13:49:00 GMT; path=/"],"X-Xss-Protection":["0"],"X-Xrds-Location":["https://socialize.gigya.com/Xrds.aspx"],"P3p":["CP=\"IDC COR PSA DEV ADM OUR IND ONL\"","CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""],"X-Server":["web507"],"X-Powered-By":["ASP.NET"],"Date":["Wed, 30 Apr 2014 13:48:59 GMT"]},"body":{"encoding":"US-ASCII","base64_string":"PGh0bWw+PGhlYWQ+PHRpdGxlPk9iamVjdCBtb3ZlZDwvdGl0bGU+PC9oZWFk\nPjxib2R5Pg0KPGgyPk9iamVjdCBtb3ZlZCB0byA8YSBocmVmPSJodHRwczov\nL3d3dy5mYWNlYm9vay5jb20vZGlhbG9nL29hdXRoP2NsaWVudF9pZD02NDM2\nODUzNzQ5MyZhbXA7cmVkaXJlY3RfdXJpPWh0dHBzJTNhJTJmJTJmc29jaWFs\naXplLmdpZ3lhLmNvbSUyZkdTJTJmR1NMb2dpbi5hc3B4JTNmc3QlM2RUV2Uz\nRThRS2FxcnA1Z2dMZG9pWERZQ1NZTWR1bk5kR1RRWFhzMGZuWXJRLiZhbXA7\ncmVzcG9uc2VfdHlwZT1jb2RlJmFtcDtzY29wZT11c2VyX2xvY2F0aW9uJTJj\ndXNlcl9iaXJ0aGRheSZhbXA7ZGlzcGxheT1wb3B1cCI+aGVyZTwvYT4uPC9o\nMj4NCjwvYm9keT48L2h0bWw+DQo=\n"},"http_version":null},"recorded_at":"Wed, 30 Apr 2014 13:48:59 GMT"}],"recorded_with":"VCR 2.8.0"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"get","uri":"https://socialize.gigya.com/socialize.getUserInfo?format=json&oauth_token=AT3_6FD2D75D160E0D9F7810F1B9457D4405_YY1ANSoPTO_ur36ryKIv3p3gT3b8WBkfpE0YFME8vppnUKS-O2H8GtwSc3ThCIcpSDr9HyW_ftNpdgjCvnw5uTO84B2pmuSBBQoP6w8H_cC00IHUmH-xfDWrEz8r1baY","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"User-Agent":["Faraday v0.9.0"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"Accept":["*/*"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Cache-Control":["private"],"Content-Type":["text/javascript; charset=utf-8"],"Expires":["Wed, 30 Apr 2014 14:12:42 GMT"],"Vary":["Accept-Encoding"],"X-Xss-Protection":["0"],"X-Timing":["cache=15,total=15"],"X-Server":["web509"],"X-Powered-By":["ASP.NET"],"P3p":["CP=\"IDC COR PSA DEV ADM OUR IND ONL\""],"Date":["Wed, 30 Apr 2014 14:13:41 GMT"],"Connection":["close"],"Content-Length":["748"]},"body":{"encoding":"UTF-8","base64_string":"ew0KICAiVUlEIjogIl9ndWlkX29wVTFrUjlHNlpiRjB5MzNqT1V4UGdPdkdh\nUjN2Mm9tY3B2SXRzMzFSczA9IiwNCiAgIlVJRFNpZyI6ICJiSHZaQzVXaTkr\nZ0M4WUZON3QzbzBWdmR2TE09IiwNCiAgInRpbWVzdGFtcCI6ICIyMDE0LTA0\nLTMwIDE0OjEzOjQyIiwNCiAgIlVJRFNpZ25hdHVyZSI6ICJUbEhRUjdYdkJI\nTTFEVjhyODlETnR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2hhbGZkZXZlbG9wbWVu\ndEBnbWFpbC5jb20iLA0KICAicHJvZmlsZVVSTCI6ICJodHRwczovL3d3dy5m\nYWNlYm9vay5jb20vam9oYWxmLmRldmVsb3BtZW50IiwNCiAgInByb3hpZWRF\nbWFpbCI6ICIiLA0KICAiY2FwYWJpbGl0aWVzIjogIkxvZ2luLCBGcmllbmRz\nLCBQaG90b3MsIFBsYWNlcyIsDQogICJwcm92aWRlcnMiOiAiZmFjZWJvb2si\nLA0KICAic3RhdHVzQ29kZSI6IDIwMCwNCiAgImVycm9yQ29kZSI6IDAsDQog\nICJzdGF0dXNSZWFzb24iOiAiT0siLA0KICAiY2FsbElkIjogImYzMzZjOTIy\nMmRiMzQ3Yzc4Mzg3YTViYTkwMTYyMzY3IiwNCiAgIm9sZGVzdERhdGFVcGRh\ndGVkVGltZXN0YW1wIjogMTM5ODg2NTc1MzkzMSwNCiAgIm9sZGVzdERhdGFB\nZ2UiOiAxNDY4DQp9\n"},"http_version":null},"recorded_at":"Wed, 30 Apr 2014 14:13:41 GMT"}],"recorded_with":"VCR 2.8.0"}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gigya::OAuth, :vcr do
|
4
|
+
# My personal Gigya's account credencials
|
5
|
+
#
|
6
|
+
let(:client_id) { '3_gFcj1fwscY5OAQRTm94-eSGYBJ0YhktB0TOs6VW6AhvgvVXUbwS7TTYx6IzsPXnf' }
|
7
|
+
let(:client_secret) { 'qFJmqCwwfozIeTiAmAwaY6i7m97pTBWXG658t4oJaw0=' }
|
8
|
+
let(:oauth_callback_url) { 'https://localhost:3000/free-videos' }
|
9
|
+
|
10
|
+
subject(:oauth) { Gigya::OAuth.new(client_id, client_secret, oauth_callback_url) }
|
11
|
+
|
12
|
+
describe 'login' do
|
13
|
+
let(:provider) { 'facebook' }
|
14
|
+
|
15
|
+
subject(:login) { oauth.login(provider) }
|
16
|
+
|
17
|
+
it 'returns the code in response location' do
|
18
|
+
expect(login).to_not be_nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'get_token' do
|
23
|
+
let(:code) { 'VC1_F50D897E31731F1AF44AE277D8160B6C_6aJvnIvvupTDQY7kCagzPdcmXZE7EC4ICXlFoLTYdEiqCSc4ncBPf83Or3YMtA0s7CeYQqk0BMZDubbM-FulMjAb4NdZJoe4PDs7MtE34u5CEHkHveOjXaPoVoGKXhZkrSCfju0jsiP1xUDB_gmMxzaINKM3yzeqPs6gCCCByve2x23nNuzzJBYxNcoBvkDS' }
|
24
|
+
|
25
|
+
subject(:get_token) { oauth.get_token(code) }
|
26
|
+
|
27
|
+
it 'returns the oauth access token' do
|
28
|
+
expect(get_token['access_token']).to_not be_nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gigya::RestAPI, :vcr do
|
4
|
+
describe 'get_user_info' do
|
5
|
+
let(:access_token) { 'AT3_6FD2D75D160E0D9F7810F1B9457D4405_YY1ANSoPTO_ur36ryKIv3p3gT3b8WBkfpE0YFME8vppnUKS-O2H8GtwSc3ThCIcpSDr9HyW_ftNpdgjCvnw5uTO84B2pmuSBBQoP6w8H_cC00IHUmH-xfDWrEz8r1baY' }
|
6
|
+
|
7
|
+
subject(:get_user_info) { Gigya::RestAPI.get_user_info(access_token) }
|
8
|
+
|
9
|
+
it 'returns the user infos' do
|
10
|
+
user = get_user_info
|
11
|
+
|
12
|
+
expect(user['email']).to eq 'johalfdevelopment@gmail.com'
|
13
|
+
expect(user['nickname']).to eq 'Johalf Development'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/spec/support/vcr.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'vcr'
|
2
|
+
|
3
|
+
class VCR::Cassette
|
4
|
+
def sanitized_name
|
5
|
+
name.to_s.gsub(/[^\w\-\/]+/, '_').downcase
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.extend VCR::RSpec::Macros
|
11
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
|
+
end
|
13
|
+
|
14
|
+
VCR.configure do |config|
|
15
|
+
config.hook_into :webmock
|
16
|
+
config.cassette_library_dir = 'spec/cassettes'
|
17
|
+
config.default_cassette_options = {
|
18
|
+
record: :new_episodes,
|
19
|
+
serialize_with: :json,
|
20
|
+
preserve_exact_body_bytes: true
|
21
|
+
}
|
22
|
+
config.configure_rspec_metadata!
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gigya
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Johalf Farina
|
8
|
+
- Otto Henrique
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-04-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: faraday
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
description: Gigya's gem is a lightweight library to connect for multiple social networks
|
29
|
+
using Gigya's REST API. It allows read/write access REST API, as well as support
|
30
|
+
for OAuth.
|
31
|
+
email:
|
32
|
+
- johalffarina@gmail.com
|
33
|
+
- ottohenrique@gmail.com
|
34
|
+
executables: []
|
35
|
+
extensions: []
|
36
|
+
extra_rdoc_files: []
|
37
|
+
files:
|
38
|
+
- ".gitignore"
|
39
|
+
- ".rspec"
|
40
|
+
- ".travis.yml"
|
41
|
+
- Gemfile
|
42
|
+
- LICENSE.txt
|
43
|
+
- README.md
|
44
|
+
- Rakefile
|
45
|
+
- gigya.gemspec
|
46
|
+
- lib/gigya.rb
|
47
|
+
- lib/gigya/http_service.rb
|
48
|
+
- lib/gigya/oauth.rb
|
49
|
+
- lib/gigya/rest_api.rb
|
50
|
+
- lib/gigya/version.rb
|
51
|
+
- spec/cassettes/Gigya_OAuth/get_token/returns_the_oauth_access_token.json
|
52
|
+
- spec/cassettes/Gigya_OAuth/login/returns_the_code_in_response_location.json
|
53
|
+
- spec/cassettes/Gigya_RestAPI/get_user_info/returns_the_user_infos.json
|
54
|
+
- spec/lib/gigya/oauth_spec.rb
|
55
|
+
- spec/lib/gigya/rest_api_spec.rb
|
56
|
+
- spec/lib/gigya_spec.rb
|
57
|
+
- spec/spec_helper.rb
|
58
|
+
- spec/support/vcr.rb
|
59
|
+
homepage: http://johalf.github.io/gigya
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.2.2
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: A lightweight library to social integration using Gigya's REST API service.
|
83
|
+
test_files:
|
84
|
+
- spec/cassettes/Gigya_OAuth/get_token/returns_the_oauth_access_token.json
|
85
|
+
- spec/cassettes/Gigya_OAuth/login/returns_the_code_in_response_location.json
|
86
|
+
- spec/cassettes/Gigya_RestAPI/get_user_info/returns_the_user_infos.json
|
87
|
+
- spec/lib/gigya/oauth_spec.rb
|
88
|
+
- spec/lib/gigya/rest_api_spec.rb
|
89
|
+
- spec/lib/gigya_spec.rb
|
90
|
+
- spec/spec_helper.rb
|
91
|
+
- spec/support/vcr.rb
|