gigya 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 68df57c03b0c57dcc5153ab121f41f08c87b5084
4
- data.tar.gz: caf740b1c4b09e19554c573e8ed128a5707c7588
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NjdkOGFjYTFhZmI5NzU2Yjk0YTlmOGViZDhkYzA1MzBiZjllODkwMw==
5
+ data.tar.gz: !binary |-
6
+ Zjg1MzAyZTM2YzJkMTI5ZWYwM2IxMGM1YTg0MmNkMjUwNDEzNjRhYQ==
5
7
  SHA512:
6
- metadata.gz: a084d94db8a7cef67e4cac7a64c8fde19c09e32d978c9357ec5258efbb85a99de354eb8d025188bf5407f04ea590e39c3cc093131bb1ff595542cbe5fa7261a4
7
- data.tar.gz: a4ab80367dbf6500f1b42bde7223499c8e7265da84b54d8005006866a9b84458f2328b109393bb7abae1a7119a0fd449c65412c48df6cd5b98794bcdabb0a739
8
+ metadata.gz: !binary |-
9
+ OGEwZThhYzcwZGVhZWU5YTUxYTE3YzQxNTc5Y2JkZTk0OGFhODYzNzM4YmVj
10
+ NzVhY2NkMjZkMWI3YTZjZTU5ZDIwNzg2MjFmMDg3Y2UxOTE1ODIzYjExYTFk
11
+ N2Y3NGMyYTc3MjkzMDkyZmQ3ZGIzODMzYzMxYzk2MTAzOThlNDE=
12
+ data.tar.gz: !binary |-
13
+ MWNkZDdiMDcyMWFlMDhmZjgwNGNjYTk1ZDdmNjI2YTJlNDQyZWZjNmE1NDkz
14
+ OWI5ZGJlNGFkZmEwYWJhYjk2NGY1ODQ3YzU1ZjNjNjg1Yzg4YmQzOWIyNzE2
15
+ ZDkzNzVlZDczYjdhZjM5M2YwNWIyYTY5Yzc4M2IyOTliMzcyYmI=
data/.travis.yml CHANGED
@@ -2,4 +2,3 @@ rvm:
2
2
  # MRI
3
3
  - 1.9.3
4
4
  - 2.0.0
5
- - 2.1.0
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem "bundler", "~> 1.5"
4
+ gem "ruby-hmac"
4
5
 
5
6
  group :development, :test do
6
7
  gem "rake"
data/gigya.gemspec CHANGED
@@ -18,4 +18,5 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ["lib"]
19
19
 
20
20
  gem.add_runtime_dependency "faraday"
21
+ gem.add_runtime_dependency "faraday_middleware"
21
22
  end
@@ -1,11 +1,13 @@
1
1
  require 'faraday'
2
+ require 'faraday_middleware'
2
3
 
3
4
  module Gigya
4
5
  module HTTPService
5
6
  def self.connection
6
- Faraday.new(url: Gigya::BASE_URL) do |faraday|
7
+ Faraday.new do |faraday|
7
8
  faraday.request :url_encoded
8
9
  faraday.adapter Faraday.default_adapter
10
+ faraday.response :json, content_type: 'application/json'
9
11
  end
10
12
  end
11
13
  end
@@ -0,0 +1,32 @@
1
+ require 'hmac-sha1'
2
+
3
+ module Gigya
4
+ class IdentityStorage
5
+ attr_reader :client_id, :client_secret
6
+
7
+ def initialize(client_id, client_secret)
8
+ @base_url = Gigya.build_url(Gigya::URLS[:ids], Gigya::URIS[:search])
9
+ @client_id = client_id
10
+ @client_secret = client_secret
11
+ end
12
+
13
+ def search(query)
14
+ params = build_params(@base_url, query)
15
+
16
+ response = Gigya.connection.post do |request|
17
+ request.url @base_url
18
+ request.body = params
19
+ end
20
+
21
+ JSON.parse response.body
22
+ end
23
+
24
+ private
25
+
26
+ def build_params(url, query)
27
+ signature_params = Utils.build_signature_params(@client_id, @client_secret, @base_url, query)
28
+
29
+ signature_params.merge!(query: query)
30
+ end
31
+ end
32
+ end
data/lib/gigya/oauth.rb CHANGED
@@ -16,7 +16,9 @@ module Gigya
16
16
  x_provider: provider
17
17
  }
18
18
 
19
- response = Gigya.connection.get(Gigya::URIS[:login], params)
19
+ url = Gigya.build_url(Gigya::URLS[:socialize], Gigya::URIS[:login])
20
+
21
+ response = Gigya.connection.get(url, params)
20
22
 
21
23
  response['location']
22
24
  end
@@ -30,7 +32,9 @@ module Gigya
30
32
  code: code
31
33
  }
32
34
 
33
- response = Gigya.connection.post(Gigya::URIS[:get_token], params)
35
+ url = Gigya.build_url(Gigya::URLS[:socialize], Gigya::URIS[:get_token])
36
+
37
+ response = Gigya.connection.post(url, params)
34
38
 
35
39
  JSON.parse response.body
36
40
  end
@@ -1,7 +1,9 @@
1
1
  module Gigya
2
2
  module RestAPI
3
3
  def self.get_user_info(oauth_token)
4
- response = Gigya.connection.get(Gigya::URIS[:get_user_info], { oauth_token: oauth_token, format: 'json' })
4
+ url = Gigya.build_url(Gigya::URLS[:socialize], Gigya::URIS[:get_user_info])
5
+
6
+ response = Gigya.connection.get(url, { oauth_token: oauth_token, format: 'json' })
5
7
 
6
8
  JSON.parse response.body
7
9
  end
@@ -0,0 +1,30 @@
1
+ module Gigya
2
+ module Utils
3
+ def self.build_signature_params(client_id, client_secret, base_url, query)
4
+ timestamp = Time.now.gmtime.to_i
5
+ nonce = CGI.escape("#{rand(0..10)}#{timestamp}")
6
+
7
+ query = CGI.escape(query).gsub('+', '%20')
8
+ escaped_url = CGI.escape(base_url)
9
+
10
+ decoded_secret = Base64.decode64(client_secret)
11
+
12
+ params = { apiKey: CGI.escape(client_id), nonce: nonce, query: query, timestamp: timestamp }
13
+
14
+ query_string = CGI.escape(build_query_string(params))
15
+
16
+ base_string = "POST&#{escaped_url}&#{query_string}"
17
+
18
+ hmac_sha1 = HMAC::SHA1.digest(decoded_secret, base_string)
19
+ signature = Base64.encode64(hmac_sha1).chomp.gsub(/\n/,'')
20
+
21
+ params.merge!(sig: signature)
22
+ end
23
+
24
+ private
25
+
26
+ def self.build_query_string(hash)
27
+ hash.to_a.map { |e| "#{e[0]}=#{e[1]}" }.join('&')
28
+ end
29
+ end
30
+ end
data/lib/gigya/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gigya
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/gigya.rb CHANGED
@@ -1,25 +1,34 @@
1
1
  require 'gigya/version'
2
2
  require 'gigya/http_service'
3
+ require 'gigya/identity_storage'
3
4
  require 'gigya/oauth'
4
5
  require 'gigya/rest_api'
6
+ require 'gigya/utils'
5
7
 
6
8
  module Gigya
7
- BASE_URL = 'https://socialize.gigya.com'
9
+ URLS = {
10
+ socialize: 'socialize.gigya.com',
11
+ ids: 'ids.gigya.com'
12
+ }
8
13
 
9
14
  URIS = {
10
15
  login: '/socialize.login',
11
16
  get_token: '/socialize.getToken',
12
- get_user_info: '/socialize.getUserInfo'
17
+ get_user_info: '/socialize.getUserInfo',
18
+ search: '/ids.search'
13
19
  }
14
20
 
15
21
  class << self
16
22
  attr_accessor :connection
17
23
  end
18
24
 
25
+ def self.build_url(url, uri)
26
+ "https://#{url}#{uri}"
27
+ end
28
+
19
29
  def self.connection=(service)
20
30
  @connection = service.connection
21
31
  end
22
32
 
23
33
  self.connection = HTTPService
24
34
  end
25
-
@@ -0,0 +1 @@
1
+ {"http_interactions":[{"request":{"method":"post","uri":"https://ids.gigya.com/ids.search","body":{"encoding":"US-ASCII","base64_string":"YXBpS2V5PTNfZ0ZjajFmd3NjWTVPQVFSVG05NC1lU0dZQkowWWhrdEIwVE9z\nNlZXNkFodmd2VlhVYndTN1RUWXg2SXpzUFhuZiZub25jZT03MTQwMjMzMjAz\nOCZxdWVyeT1zZWxlY3QrJTJBK2Zyb20rYWNjb3VudHMrd2hlcmUrbGFzdFVw\nZGF0ZWQrJTNDKyUyMjIwMTQtMDYtMDlUMTYlM0EyNyUzQTMyWiUyMiZ0aW1l\nc3RhbXA9MTQwMjMzMjAzOCZzaWc9SDVZZ1RnbkhwJTJGVDVZbllMV3YxM3pk\nSVZ5SDAlM0Q=\n"},"headers":{"User-Agent":["Faraday v0.8.9"],"Content-Type":["application/x-www-form-urlencoded"],"Accept":["*/*"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Cache-Control":["private"],"Content-Type":["text/javascript; charset=utf-8"],"Expires":["Mon, 09 Jun 2014 16:39:38 GMT"],"X-Xss-Protection":["0"],"X-Server":["web517"],"X-Powered-By":["ASP.NET"],"P3p":["CP=\"IDC COR PSA DEV ADM OUR IND ONL\""],"Date":["Mon, 09 Jun 2014 16:40:39 GMT"],"Connection":["close"],"Content-Length":["243"]},"body":{"encoding":"US-ASCII","base64_string":"ew0KICAiZXJyb3JNZXNzYWdlIjogIlVuYXV0aG9yaXplZCBwYXJ0bmVyIiwN\nCiAgImVycm9yRGV0YWlscyI6ICJBY2NvdW50cyBhbmQgQXV0byBwcm9maWxl\nIHN0b3JhZ2UgYXJlIGRpc2FibGVkLiIsDQogICJzdGF0dXNDb2RlIjogNDAz\nLA0KICAiZXJyb3JDb2RlIjogNDAzMDM2LA0KICAic3RhdHVzUmVhc29uIjog\nIkZvcmJpZGRlbiIsDQogICJjYWxsSWQiOiAiMGM1ZmNlMzgwNzZkNGE4ZDhh\nYTUyNTI2NDdlZDQ4MTUiDQp9\n"},"http_version":null},"recorded_at":"Mon, 09 Jun 2014 16:40:39 GMT"}],"recorded_with":"VCR 2.8.0"}
@@ -1 +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\nTTFEVjhyODlETnRUdU10SzQ9IiwNCiAgInNpZ25hdHVyZVRpbWVzdGFtcCI6\nICIxMzk4ODY3MjIyIiwNCiAgImlzU2l0ZVVzZXIiOiB0cnVlLA0KICAiaXND\nb25uZWN0ZWQiOiB0cnVlLA0KICAiaXNMb2dnZWRJbiI6IHRydWUsDQogICJp\nc1RlbXBVc2VyIjogZmFsc2UsDQogICJsb2dpblByb3ZpZGVyIjogImZhY2Vi\nb29rIiwNCiAgImxvZ2luUHJvdmlkZXJVSUQiOiAiMTAwMDAzNTY5MDE4NjE3\nIiwNCiAgImlzU2l0ZVVJRCI6IGZhbHNlLA0KICAiaWRlbnRpdGllcyI6IFsN\nCiAgICB7DQogICAgICAicHJvdmlkZXIiOiAiZmFjZWJvb2siLA0KICAgICAg\nInByb3ZpZGVyVUlEIjogIjEwMDAwMzU2OTAxODYxNyIsDQogICAgICAiaXNM\nb2dpbklkZW50aXR5IjogdHJ1ZSwNCiAgICAgICJuaWNrbmFtZSI6ICJKb2hh\nbGYgRGV2ZWxvcG1lbnQiLA0KICAgICAgInBob3RvVVJMIjogImh0dHA6Ly9n\ncmFwaC5mYWNlYm9vay5jb20vMTAwMDAzNTY5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UkwiOiAiaHR0cDovL2dyYXBoLmZhY2Vi\nb29rLmNvbS8xMDAwMDM1NjkwMTg2MTcvcGljdHVyZT90eXBlPWxhcmdlIiwN\nCiAgInRodW1ibmFpbFVSTCI6ICJodHRwOi8vZ3JhcGguZmFjZWJvb2suY29t\nLzEwMDAwMzU2OTAxODYxNy9waWN0dXJlP3R5cGU9c3F1YXJlIiwNCiAgImZp\ncnN0TmFtZSI6ICJKb2hhbGYiLA0KICAibGFzdE5hbWUiOiAiRGV2ZWxvcG1l\nbnQiLA0KICAiZ2VuZGVyIjogIm0iLA0KICAiYWdlIjogIjI4IiwNCiAgImJp\ncnRoRGF5IjogIjE4IiwNCiAgImJpcnRoTW9udGgiOiAiMSIsDQogICJiaXJ0\naFllYXIiOiAiMTk4NiIsDQogICJlbWFpbCI6ICJqb2hhbGZkZXZlbG9wbWVu\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"}
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\nTTFEVjhyODlETnRUdU10SzQ9IiwNCiAgInNpZ25hdHVyZVRpbWVzdGFtcCI6\nICIxMzk4ODY3MjIyIiwNCiAgImlzU2l0ZVVzZXIiOiB0cnVlLA0KICAiaXND\nb25uZWN0ZWQiOiB0cnVlLA0KICAiaXNMb2dnZWRJbiI6IHRydWUsDQogICJp\nc1RlbXBVc2VyIjogZmFsc2UsDQogICJsb2dpblByb3ZpZGVyIjogImZ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IsDQogICJwcm92aWRlcnMiOiAiZmFjZWJvb2si\nLA0KICAic3RhdHVzQ29kZSI6IDIwMCwNCiAgImVycm9yQ29kZSI6IDAsDQog\nICJzdGF0dXNSZWFzb24iOiAiT0siLA0KICAiY2FsbElkIjogImYzMzZjOTIy\nMmRiMzQ3Yzc4Mzg3YTViYTkwMTYyMzY3IiwNCiAgIm9sZGVzdERhdGFVcGRh\ndGVkVGltZXN0YW1wIjogMTM5ODg2NTc1MzkzMSwNCiAgIm9sZGVzdERhdGFB\nZ2UiOiAxNDY4DQp9\n"},"http_version":null},"recorded_at":"Wed, 30 Apr 2014 14:13:41 GMT"},{"request":{"method":"get","uri":"http://google.com/","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"],"Content-Type":["text/html; charset=UTF-8"],"Location":["http://www.google.com.br/?gfe_rd=cr&ei=HfqNU9rDJ-aU8Qf6goHIBQ"],"Content-Length":["262"],"Date":["Tue, 03 Jun 2014 16:38:53 GMT"],"Server":["GFE/2.0"],"Alternate-Protocol":["80:quic"]},"body":{"encoding":"US-ASCII","base64_string":"PEhUTUw+PEhFQUQ+PG1ldGEgaHR0cC1lcXVpdj0iY29udGVudC10eXBlIiBj\nb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD11dGYtOCI+CjxUSVRMRT4zMDIg\nTW92ZWQ8L1RJVExFPjwvSEVBRD48Qk9EWT4KPEgxPjMwMiBNb3ZlZDwvSDE+\nClRoZSBkb2N1bWVudCBoYXMgbW92ZWQKPEEgSFJFRj0iaHR0cDovL3d3dy5n\nb29nbGUuY29tLmJyLz9nZmVfcmQ9Y3ImYW1wO2VpPUhmcU5VOXJESi1hVThR\nZjZnb0hJQlEiPmhlcmU8L0E+Lg0KPC9CT0RZPjwvSFRNTD4NCg==\n"},"http_version":null},"recorded_at":"Tue, 03 Jun 2014 16:38:53 GMT"}],"recorded_with":"VCR 2.8.0"}
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gigya::IdentityStorage, :vcr do
4
+ let(:client_id) { '3_gFcj1fwscY5OAQRTm94-eSGYBJ0YhktB0TOs6VW6AhvgvVXUbwS7TTYx6IzsPXnf' }
5
+ let(:client_secret) { 'qFJmqCwwfozIeTiAmAwaY6i7m97pTBWXG658t4oJaw0=' }
6
+
7
+ subject(:identity_storage) { Gigya::IdentityStorage.new(client_id, client_secret) }
8
+
9
+ describe 'search' do
10
+ let(:query) { 'select * from accounts where lastUpdated < "2014-06-09T16:27:32Z"' }
11
+
12
+ subject(:search) { identity_storage.search(query) }
13
+
14
+ xit 'returns the identity storage infos'
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gigya::Utils do
4
+ let(:client_id) { 'client_id' }
5
+ let(:client_secret) { 'client_secret' }
6
+
7
+ subject(:utils) { Gigya::Utils }
8
+
9
+ context 'build_signature_params' do
10
+ let(:base_url) { Gigya.build_url(Gigya::URLS[:ids], Gigya::URIS[:search]) }
11
+ let(:query) { 'select count(*) from accounts' }
12
+
13
+ subject(:build_signature_params) { utils.build_signature_params(client_id, client_secret, base_url, query) }
14
+
15
+ it 'returns signature params' do
16
+ expect(build_signature_params.keys).to include(:apiKey, :nonce, :query, :timestamp, :sig)
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gigya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johalf Farina
@@ -9,20 +9,34 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-30 00:00:00.000000000 Z
12
+ date: 2014-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - ! '>='
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - ! '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: faraday_middleware
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ! '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ! '>='
26
40
  - !ruby/object:Gem::Version
27
41
  version: '0'
28
42
  description: Gigya's gem is a lightweight library to connect for multiple social networks
@@ -35,9 +49,9 @@ executables: []
35
49
  extensions: []
36
50
  extra_rdoc_files: []
37
51
  files:
38
- - ".gitignore"
39
- - ".rspec"
40
- - ".travis.yml"
52
+ - .gitignore
53
+ - .rspec
54
+ - .travis.yml
41
55
  - Gemfile
42
56
  - LICENSE.txt
43
57
  - README.md
@@ -45,14 +59,19 @@ files:
45
59
  - gigya.gemspec
46
60
  - lib/gigya.rb
47
61
  - lib/gigya/http_service.rb
62
+ - lib/gigya/identity_storage.rb
48
63
  - lib/gigya/oauth.rb
49
64
  - lib/gigya/rest_api.rb
65
+ - lib/gigya/utils.rb
50
66
  - lib/gigya/version.rb
67
+ - spec/cassettes/Gigya_IdentityStorage/search/returns_the_identity_storage_infos.json
51
68
  - spec/cassettes/Gigya_OAuth/get_token/returns_the_oauth_access_token.json
52
69
  - spec/cassettes/Gigya_OAuth/login/returns_the_code_in_response_location.json
53
70
  - spec/cassettes/Gigya_RestAPI/get_user_info/returns_the_user_infos.json
71
+ - spec/lib/gigya/identity_storage_spec.rb
54
72
  - spec/lib/gigya/oauth_spec.rb
55
73
  - spec/lib/gigya/rest_api_spec.rb
74
+ - spec/lib/gigya/utils_spec.rb
56
75
  - spec/lib/gigya_spec.rb
57
76
  - spec/spec_helper.rb
58
77
  - spec/support/vcr.rb
@@ -66,26 +85,29 @@ require_paths:
66
85
  - lib
67
86
  required_ruby_version: !ruby/object:Gem::Requirement
68
87
  requirements:
69
- - - ">="
88
+ - - ! '>='
70
89
  - !ruby/object:Gem::Version
71
90
  version: '0'
72
91
  required_rubygems_version: !ruby/object:Gem::Requirement
73
92
  requirements:
74
- - - ">="
93
+ - - ! '>='
75
94
  - !ruby/object:Gem::Version
76
95
  version: '0'
77
96
  requirements: []
78
97
  rubyforge_project:
79
- rubygems_version: 2.2.2
98
+ rubygems_version: 2.2.1
80
99
  signing_key:
81
100
  specification_version: 4
82
101
  summary: A lightweight library to social integration using Gigya's REST API service.
83
102
  test_files:
103
+ - spec/cassettes/Gigya_IdentityStorage/search/returns_the_identity_storage_infos.json
84
104
  - spec/cassettes/Gigya_OAuth/get_token/returns_the_oauth_access_token.json
85
105
  - spec/cassettes/Gigya_OAuth/login/returns_the_code_in_response_location.json
86
106
  - spec/cassettes/Gigya_RestAPI/get_user_info/returns_the_user_infos.json
107
+ - spec/lib/gigya/identity_storage_spec.rb
87
108
  - spec/lib/gigya/oauth_spec.rb
88
109
  - spec/lib/gigya/rest_api_spec.rb
110
+ - spec/lib/gigya/utils_spec.rb
89
111
  - spec/lib/gigya_spec.rb
90
112
  - spec/spec_helper.rb
91
113
  - spec/support/vcr.rb