idn_sdk_ruby 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/idn_sdk_ruby.gemspec +6 -4
- data/lib/idn_sdk_ruby/version.rb +1 -1
- data/spec/api/v0/abstract_api_context_spec.rb +32 -0
- data/spec/api/v0/idn_sdk_spec.rb +15 -0
- data/spec/api/v0/in_memory_api_context_spec.rb +40 -0
- data/spec/api/v0/token_api_model_spec.rb +35 -0
- data/spec/fixtures/temp_user.png +0 -0
- data/spec/idn_sdk_ruby_spec.rb +8 -0
- data/spec/modules/identity/v0/identity_api_spec.rb +73 -0
- data/spec/modules/ids/v0/ids_api_spec.rb +23 -0
- data/spec/modules/ids/v0/ids_spec.rb +19 -0
- data/spec/modules/media/v0/media_api_spec.rb +31 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/support/webmock_stubs.rb +88 -0
- metadata +40 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bffa73a9d30e03c3f09f94789c09133dc4fb410b
|
4
|
+
data.tar.gz: ca701c62e022ff8b5907db966495ae9fc21512aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c427ceebb89ca0319bc5595804d068e35bb95788f72e3b02e8afd7cb17632f51b3f6e126b57448739f4483795cbba6a05831fcaeb8c56fd091bb336aa9e0479
|
7
|
+
data.tar.gz: 53a091b626f231b95014a5080b6a1e251ddb130cb8cd786b0c7a1b8489685b0803f411f344fb446c2606ff62e69b472270f926de899e4c2456542969de49c063
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
idn-sdk-ruby
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.2.2
|
data/idn_sdk_ruby.gemspec
CHANGED
@@ -20,12 +20,14 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_dependency 'httmultiparty', "0.3.16"
|
23
|
-
spec.add_dependency 'activemodel',
|
24
|
-
|
23
|
+
spec.add_dependency 'activemodel', '~> 5.0', '>= 5.0.2'
|
24
|
+
spec.add_dependency "byebug"
|
25
25
|
spec.add_development_dependency "pry"
|
26
|
-
|
27
|
-
|
26
|
+
|
27
|
+
|
28
|
+
# spec.add_development_dependency "minitest"
|
28
29
|
spec.add_development_dependency "rspec"
|
30
|
+
spec.add_development_dependency "webmock", '~> 2.3', '>= 2.3.2'
|
29
31
|
|
30
32
|
spec.add_development_dependency "bundler", "~> 1.10"
|
31
33
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/idn_sdk_ruby/version.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe IdnSdkRuby::Com::Nbos::Capi::Api::V0::AbstractApiContext do
|
4
|
+
|
5
|
+
let(:name){'app'}
|
6
|
+
let(:api_context) do
|
7
|
+
api_context = double('IdsRailsApiContext')
|
8
|
+
allow(api_context).to receive(:getClientCredentials) { {"client_id"=>"sample-app-client", "client_secret"=>"sample-app-secret"}}
|
9
|
+
allow(api_context).to receive(:getName) {'app'}
|
10
|
+
allow(api_context).to receive(:init)
|
11
|
+
allow(api_context).to receive(:name){'app'}
|
12
|
+
allow(api_context).to receive(:getHost).with(anything()){'http://api.qa1.nbos.in'}
|
13
|
+
allow(api_context).to receive(:setClientToken).with(anything()){anything()}
|
14
|
+
api_context
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should return Name of the Context as one specified during initialization' do
|
18
|
+
abstract_api_context = IdnSdkRuby::Com::Nbos::Capi::Api::V0::AbstractApiContext.new(name)
|
19
|
+
expect(abstract_api_context.name).to be name
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should return Default Name for a Context, if no name is givem' do
|
23
|
+
abstract_api_context = IdnSdkRuby::Com::Nbos::Capi::Api::V0::AbstractApiContext.new()
|
24
|
+
expect(abstract_api_context.name).to eq 'app'
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should register api context' do
|
28
|
+
IdnSdkRuby::Com::Nbos::Capi::Api::V0::AbstractApiContext.registerApiContext(api_context)
|
29
|
+
expect(IdnSdkRuby::Com::Nbos::Capi::Api::V0::AbstractApiContext.get(name)).to be api_context
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe IdnSdkRuby do
|
4
|
+
|
5
|
+
it 'should returns token object for given App Context' do
|
6
|
+
app_context = double('IdsRailsApiContext')
|
7
|
+
allow(app_context).to receive(:getClientCredentials) { {"client_id"=>"sample-app-client", "client_secret"=>"sample-app-secret"}}
|
8
|
+
allow(app_context).to receive(:getName) {'app'}
|
9
|
+
allow(app_context).to receive(:init)
|
10
|
+
allow(app_context).to receive(:name){'app'}
|
11
|
+
allow(app_context).to receive(:getHost).with(anything()){'http://api.qa1.nbos.in'}
|
12
|
+
allow(app_context).to receive(:setClientToken).with(anything()){anything()}
|
13
|
+
expect(IdnSdkRuby::Com::Nbos::Capi::Api::V0::IdnSDK.init(app_context)).to be_kind_of IdnSdkRuby::Com::Nbos::Capi::Api::V0::TokenApiModel
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe IdnSdkRuby::Com::Nbos::Capi::Api::V0::InMemoryApiContext do
|
4
|
+
|
5
|
+
let(:module_name){'app'}
|
6
|
+
let(:in_memory_api_context){IdnSdkRuby::Com::Nbos::Capi::Api::V0::InMemoryApiContext.new(module_name)}
|
7
|
+
let(:credential_map){{"client_id"=>"sample-app-client", "client_secret"=>"sample-app-secret"}}
|
8
|
+
let(:tokenApiModel){ double('TokenApiModel')}
|
9
|
+
let(:host){ "http://api.qa.nbos.io"}
|
10
|
+
|
11
|
+
it 'should be a sub class of IdnSdkRuby::Com::Nbos::Capi::Api::V0::AbstractApiContext' do
|
12
|
+
expect(in_memory_api_context.kind_of?(IdnSdkRuby::Com::Nbos::Capi::Api::V0::AbstractApiContext)).to be true
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should respond to getname methods' do
|
16
|
+
expect(in_memory_api_context.getName).to be module_name
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should respond to getClientCredentials methods' do
|
20
|
+
in_memory_api_context.setClientCredentials(credential_map)
|
21
|
+
expect(in_memory_api_context.getClientCredentials).to be credential_map
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should respond to getClientToken methods' do
|
25
|
+
in_memory_api_context.setClientToken(tokenApiModel)
|
26
|
+
expect(in_memory_api_context.getClientToken).to be tokenApiModel
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should respond to getUserToken methods' do
|
30
|
+
in_memory_api_context.setUserToken(module_name, tokenApiModel)
|
31
|
+
expect(in_memory_api_context.getUserToken(module_name)).to be tokenApiModel
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should respond to getHost methods' do
|
36
|
+
in_memory_api_context.setHost(module_name, host)
|
37
|
+
expect(in_memory_api_context.getHost(module_name)).to be host
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe IdnSdkRuby::Com::Nbos::Capi::Api::V0::TokenApiModel do
|
4
|
+
let(:parsed_json){{"access_token"=> "5d70771a-ee14-42d9-a5fa-e62e8d24a446",
|
5
|
+
"refresh_token"=> "5d70771a-ee14-42d9-a5fa-e62e8d24a447",
|
6
|
+
"token_type"=> "bearer",
|
7
|
+
"scope"=> "test",
|
8
|
+
"expires_in"=> "272217"}}
|
9
|
+
|
10
|
+
let(:token){IdnSdkRuby::Com::Nbos::Capi::Api::V0::TokenApiModel.new(parsed_json)}
|
11
|
+
|
12
|
+
it 'should return Token expiration time' do
|
13
|
+
expect(token.getExpires_in).to be parsed_json["expires_in"]
|
14
|
+
end
|
15
|
+
it 'should return Token Scope' do
|
16
|
+
expect(token.getScope).to be parsed_json["scope"]
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should return Access Token' do
|
20
|
+
expect(token.getToken_type).to be parsed_json["token_type"]
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should return Access Token'do
|
24
|
+
expect(token.getAccess_token).to be parsed_json["access_token"]
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should return refresh Token' do
|
28
|
+
expect(token.getRefresh_token).to be parsed_json["refresh_token"]
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should return as Json Object' do
|
32
|
+
expect(token.as_json.class).to be Hash
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
Binary file
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::IdentityApi do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
app_context = double('IdsRailsApiContext')
|
7
|
+
token_api_model = double('TokenApiModel')
|
8
|
+
allow(app_context).to receive(:getClientCredentials){{"client_id"=>"sample-app-client",
|
9
|
+
"client_secret"=>"sample-app-secret"}}
|
10
|
+
allow(app_context).to receive(:getName) {'app'}
|
11
|
+
allow(app_context).to receive(:init)
|
12
|
+
allow(app_context).to receive(:name){'app'}
|
13
|
+
allow(app_context).to receive(:getHost).with(anything()){'http://api.qa1.nbos.in'}
|
14
|
+
allow(app_context).to receive(:setClientToken).with(anything()){anything()}
|
15
|
+
allow(token_api_model).to receive(:getAccess_token){"access_token"}
|
16
|
+
allow(app_context).to receive(:getClientToken){token_api_model}
|
17
|
+
allow(app_context).to receive(:getUserToken).with("identity"){"identitytoken"}
|
18
|
+
allow(app_context).to receive(:setUserToken).with("identity", anything()){"identitytoken"}
|
19
|
+
IdnSdkRuby::Com::Nbos::Capi::Api::V0::IdnSDK.init(app_context)
|
20
|
+
end
|
21
|
+
|
22
|
+
let(:args){{"username"=>"jagadish2","password"=>"654321","email"=>"jagadishwerb+1@wavelabs.in",
|
23
|
+
"firstName"=>"jane", "lastName"=>"doe"}}
|
24
|
+
let(:member_api_model_class){IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::MemberApiModel}
|
25
|
+
let(:identity_api){IdnSdkRuby::Com::Nbos::Capi::Modules::Ids::V0::Ids.getModuleApi("identity")}
|
26
|
+
let(:test_uuid){"MBR:test-uuid"}
|
27
|
+
let(:login_model){IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::LoginModel.new("jagadish2", "123456")}
|
28
|
+
let(:password_api_model){IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::UpdatePasswordApiModel.new("123456","654321")}
|
29
|
+
|
30
|
+
it 'should allow User to signup' do
|
31
|
+
response = identity_api.signup(args)
|
32
|
+
expect(response[:data]).to be_a_kind_of(member_api_model_class)
|
33
|
+
expect(response[:data].email).to eq(args["email"])
|
34
|
+
expect(response[:data].firstName).to eq(args["firstName"])
|
35
|
+
expect(response[:data].lastName).to eq(args["lastName"])
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should allow User to Login' do
|
39
|
+
response = identity_api.login(login_model)
|
40
|
+
expect(response[:data]).to be_a_kind_of(member_api_model_class)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should allow User to update Details' do
|
44
|
+
response = identity_api.updateMemberDetails(test_uuid, args)
|
45
|
+
expect(response[:data]).to be_a_kind_of(member_api_model_class)
|
46
|
+
expect(response[:data].email).to eq(args["email"])
|
47
|
+
expect(response[:data].firstName).to eq(args["firstName"])
|
48
|
+
expect(response[:data].lastName).to eq(args["lastName"])
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should allow User to update Password' do
|
52
|
+
response = identity_api.updateCredentials(password_api_model)
|
53
|
+
expect(response[:data]).to be_a_kind_of(password_api_model.class)
|
54
|
+
expect(response[:data].message).to eq("password.changed")
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should allow User to logout' do
|
59
|
+
response = identity_api.logout
|
60
|
+
expect(response[:data]).to be_a_kind_of(login_model.class)
|
61
|
+
expect(response[:data].message).to eq("member.logout.success")
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
it 'should allow User to Connect Through social logins' do
|
66
|
+
omni_hash = {credentials:{expires_at: 1494312526, token:"test::omniauth::token"}}
|
67
|
+
response = identity_api.connect(omni_hash,'facebook')
|
68
|
+
expect(response[:data]).to be_a_kind_of(member_api_model_class)
|
69
|
+
expect(response[:data].isExternal).to be(true)
|
70
|
+
expect(response[:data].socialAccounts.present?).to be true
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require "idn_sdk_ruby/com/nbos/capi/modules/ids/v0/ids_api"
|
3
|
+
require "idn_sdk_ruby/com/nbos/capi/modules/ids/v0/ids_remote_api"
|
4
|
+
|
5
|
+
describe IdnSdkRuby::Com::Nbos::Capi::Modules::Ids::V0::IdsApi do
|
6
|
+
let(:host){"http://api.nbos.io"}
|
7
|
+
let(:ids_api){IdnSdkRuby::Com::Nbos::Capi::Modules::Ids::V0::IdsApi.new(host)}
|
8
|
+
|
9
|
+
it 'should be the subclass of NetworkApi' do
|
10
|
+
expect(ids_api).to be_a_kind_of(IdnSdkRuby::Com::Nbos::Capi::Api::V0::NetworkApi)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should set host' do
|
14
|
+
expect(ids_api.getHost).not_to be_nil
|
15
|
+
expect(ids_api.getHost).to eq(host)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should set remote Api class as IdnSdkRuby::Com::Nbos::Capi::Modules::Ids::V0::IdsRemoteApi' do
|
19
|
+
expect(ids_api.getRemoteApiClass).to be IdnSdkRuby::Com::Nbos::Capi::Modules::Ids::V0::IdsRemoteApi
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe IdnSdkRuby::Com::Nbos::Capi::Modules::Ids::V0::Ids do
|
4
|
+
|
5
|
+
it 'should Register Module Api' do
|
6
|
+
app_context = double('IdsRailsApiContext')
|
7
|
+
allow(app_context).to receive(:getClientCredentials){{"client_id"=>"sample-app-client",
|
8
|
+
"client_secret"=>"sample-app-secret"}}
|
9
|
+
allow(app_context).to receive(:getName) {'app'}
|
10
|
+
allow(app_context).to receive(:init)
|
11
|
+
allow(app_context).to receive(:name){'app'}
|
12
|
+
allow(app_context).to receive(:getHost).with(anything()){'http://api.qa1.nbos.in'}
|
13
|
+
allow(app_context).to receive(:setClientToken).with(anything()){anything()}
|
14
|
+
IdnSdkRuby::Com::Nbos::Capi::Api::V0::IdnSDK.init(app_context)
|
15
|
+
expect(IdnSdkRuby::Com::Nbos::Capi::Modules::Ids::V0::Ids.getModuleApi('app')).to be_a_kind_of IdnSdkRuby::Com::Nbos::Capi::Api::V0::NetworkApi
|
16
|
+
end
|
17
|
+
# for media
|
18
|
+
#IdnSdkRuby::Com::Nbos::Capi::Modules::Media::V0::MediaApi
|
19
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe IdnSdkRuby::Com::Nbos::Capi::Modules::Media::V0::MediaApi do
|
4
|
+
before(:each) do
|
5
|
+
app_context = double('IdsRailsApiContext')
|
6
|
+
allow(app_context).to receive(:getClientCredentials){{"client_id"=>"sample-app-client",
|
7
|
+
"client_secret"=>"sample-app-secret"}}
|
8
|
+
allow(app_context).to receive(:getName) {'app'}
|
9
|
+
allow(app_context).to receive(:init)
|
10
|
+
allow(app_context).to receive(:name){'app'}
|
11
|
+
allow(app_context).to receive(:getHost).with(anything()){'http://api.qa1.nbos.in'}
|
12
|
+
allow(app_context).to receive(:setClientToken).with(anything()){anything()}
|
13
|
+
allow(app_context).to receive(:getUserToken).with("identity"){"identitytoken"}
|
14
|
+
IdnSdkRuby::Com::Nbos::Capi::Api::V0::IdnSDK.init(app_context)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should fetch Profile Picture from NBOS Server' do
|
18
|
+
media_api = IdnSdkRuby::Com::Nbos::Capi::Modules::Ids::V0::Ids.getModuleApi("media")
|
19
|
+
response = media_api.getMedia("mrd:123", "profile")
|
20
|
+
expect(response[:status]).to eq(200)
|
21
|
+
expect(response[:data]).to be_a_kind_of(IdnSdkRuby::Com::Nbos::Capi::Modules::Media::V0::MediaApiModel)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should upload Picture from NBOS Server' do
|
25
|
+
media_api = IdnSdkRuby::Com::Nbos::Capi::Modules::Ids::V0::Ids.getModuleApi("media")
|
26
|
+
media_path = File.expand_path('./', 'spec/fixtures/temp_user.png')
|
27
|
+
response = media_api.uploadMedia("mrd:123", "profile", media_path)
|
28
|
+
expect(response[:status]).to eq(200)
|
29
|
+
expect(response[:data]).to be_a_kind_of(IdnSdkRuby::Com::Nbos::Capi::Modules::Media::V0::MediaApiModel)
|
30
|
+
end
|
31
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'webmock/rspec'
|
2
|
+
|
3
|
+
WebMock.disable_net_connect!(:allow_localhost => true)
|
4
|
+
RSpec.configure do |config|
|
5
|
+
config.before(:each) do
|
6
|
+
WebMock.stub_request(:get, "http://api.qa1.nbos.in/oauth/token?client_id=sample-app-client&client_secret=sample-app-secret&grant_type=client_credentials&scope%5B%5D=").
|
7
|
+
with(:headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json'}).
|
8
|
+
to_return(:status => 200, :body => {"access_token": "5d70771a-ee14-42d9-a5fa-e62e8d24a446",
|
9
|
+
"token_type":"bearer","expires_in":272217}.to_s, :headers => {})
|
10
|
+
|
11
|
+
|
12
|
+
media_api_response = {"extension"=>"png", "mediaFileDetailsList"=>[{"mediapath"=>"http://api.qa1.nbos.in/Media/default/default-profile_48x48.png",
|
13
|
+
"mediatype"=>"small"},
|
14
|
+
{"mediapath"=>"http://api.qa1.nbos.in/Media/default/default-profile_300x200.png",
|
15
|
+
"mediatype"=>"medium"},
|
16
|
+
{"mediapath"=>"http://api.qa1.nbos.in/Media/default/default-profile.png",
|
17
|
+
"mediatype"=>"original"}],
|
18
|
+
"supportedsizes"=>"small:48x48,medium:300x200", "uuid"=>nil}
|
19
|
+
|
20
|
+
sign_up_response = {"member"=>{"description"=>"", "email"=>"jagadishwerb+1@wavelabs.in",
|
21
|
+
"emailConnects"=>[], "firstName"=>"jane", "id"=>462,
|
22
|
+
"isExternal"=>false, "jsonAttributes"=>"",
|
23
|
+
"lastName"=>"doe", "phone"=>"", "socialAccounts"=>[],
|
24
|
+
"uuid"=>"MBR:test-uuid"},
|
25
|
+
"token"=>{"access_token"=>"5be2373e-497c-4db8-be26-1b208d2b77c2",
|
26
|
+
"expires_in"=>7775999,
|
27
|
+
"refresh_token"=>"36edfbd7-796a-4582-b871-4af741e50e92",
|
28
|
+
"scope"=>"", "token_type"=>"bearer"}}
|
29
|
+
fb_connect_response = {"member"=>{"description"=>"", "email"=>"", "emailConnects"=>[],
|
30
|
+
"firstName"=>"jane doe", "id"=>461,
|
31
|
+
"isExternal"=>true, "jsonAttributes"=>"",
|
32
|
+
"lastName"=>"", "phone"=>"",
|
33
|
+
"socialAccounts"=>[{"accessToken"=>"Test::AccessToken",
|
34
|
+
"email"=>nil, "id"=>130, "imageUrl"=>"https://scontent.xx.fbcdn.net/v/t1.0-1/p200x200/13707769_1790378461192849_5526286606336782680_n.jpg?oh=0769cf07b5b54c1b5bd2d78eb35986bd&oe=592A9FD7",
|
35
|
+
"socialType"=>"facebook"}], "uuid"=>"MBR:test-uuid"},
|
36
|
+
"token"=>{"access_token"=>"Test::AccessToken", "expires_in"=>7775999,
|
37
|
+
"refresh_token"=>"Test::RefreshToken", "scope"=>"",
|
38
|
+
"token_type"=>"bearer"}}
|
39
|
+
|
40
|
+
password_change_response = {"messageCode"=>"password.changed",
|
41
|
+
"message"=>"password.changed"}
|
42
|
+
|
43
|
+
logout_change_response = {"messageCode"=>"member.logout.success",
|
44
|
+
"message"=>"member.logout.success"}
|
45
|
+
|
46
|
+
WebMock.stub_request(:get, "http://api.qa1.nbos.in/api/media/v0/media?id=mrd:123&mediafor=profile").
|
47
|
+
with(:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer identitytoken', 'Content-Type'=>'application/json'}).
|
48
|
+
to_return(:status => 200, :body =>media_api_response.to_json, :headers => {"Content-Type"=> "application/json"})
|
49
|
+
|
50
|
+
WebMock.stub_request(:post, "http://api.qa1.nbos.in/api/media/v0/media?id=mrd:123&mediafor=profile").
|
51
|
+
with(:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer identitytoken','Content-Length'=>'14571', 'Content-Type'=>'multipart/form-data; boundary=-----------RubyMultipartPost'}).
|
52
|
+
to_return(:status => 200, :body => media_api_response.to_json, :headers => {"Content-Type"=> "application/json"})
|
53
|
+
|
54
|
+
WebMock.stub_request(:post, "http://api.qa1.nbos.in/api/identity/v0/users/signup").
|
55
|
+
with(:body => "{\"username\"=>\"jagadish2\", \"password\"=>\"654321\", \"email\"=>\"jagadishwerb+1@wavelabs.in\", \"firstName\"=>\"jane\", \"lastName\"=>\"doe\"}",
|
56
|
+
:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer access_token', 'Content-Type'=>'application/json'}).
|
57
|
+
to_return(:status => 200, :body => sign_up_response.to_json,
|
58
|
+
:headers => {"Content-Type"=> "application/json"})
|
59
|
+
|
60
|
+
WebMock.stub_request(:post, "http://api.qa1.nbos.in/api/identity/v0/auth/login").
|
61
|
+
with(:body => "{\"username\":\"jagadish2\",\"password\":\"123456\",\"messageCode\":null,\"message\":null}",
|
62
|
+
:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer access_token', 'Content-Type'=>'application/json'}).
|
63
|
+
to_return(:status => 200, :body => sign_up_response.to_json, :headers => {"Content-Type"=> "application/json"})
|
64
|
+
|
65
|
+
WebMock.stub_request(:put, "http://api.qa1.nbos.in/api/identity/v0/users/MBR:test-uuid").
|
66
|
+
with(:body => "{\"username\"=>\"jagadish2\", \"password\"=>\"654321\", \"email\"=>\"jagadishwerb+1@wavelabs.in\", \"firstName\"=>\"jane\", \"lastName\"=>\"doe\"}",
|
67
|
+
:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer identitytoken', 'Content-Type'=>'application/json'}).
|
68
|
+
to_return(:status => 200, :body => sign_up_response["member"].to_json,
|
69
|
+
:headers => {"Content-Type"=> "application/json"})
|
70
|
+
|
71
|
+
WebMock.stub_request(:post, "http://api.qa1.nbos.in/api/identity/v0/auth/changePassword").
|
72
|
+
with(:body => "{\"password\":\"123456\",\"newPassword\":\"654321\",\"message\":null}",
|
73
|
+
:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer identitytoken', 'Content-Type'=>'application/json'}).
|
74
|
+
to_return(:status => 200, :body => password_change_response.to_json,
|
75
|
+
:headers => {"Content-Type"=> "application/json"})
|
76
|
+
|
77
|
+
WebMock.stub_request(:get, "http://api.qa1.nbos.in/api/identity/v0/auth/logout").
|
78
|
+
with(:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer identitytoken', 'Content-Type'=>'application/json'}).
|
79
|
+
to_return(:status => 200, :body => logout_change_response.to_json,
|
80
|
+
:headers => {"Content-Type"=> "application/json"})
|
81
|
+
|
82
|
+
WebMock.stub_request(:post, "http://api.qa1.nbos.in/api/identity/v0/auth/social/facebook/connect").
|
83
|
+
with(:body => "{\"clientId\":\"sample-app-client\",\"accessToken\":\"test::omniauth::token\",\"expiresIn\":\"1494312526\"}",
|
84
|
+
:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer access_token', 'Content-Type'=>'application/json'}).
|
85
|
+
to_return(:status => 200, :body => fb_connect_response.to_json, :headers => {"Content-Type"=> "application/json"})
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: idn_sdk_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sekhar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httmultiparty
|
@@ -28,24 +28,30 @@ dependencies:
|
|
28
28
|
name: activemodel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
- - ">="
|
32
35
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
36
|
+
version: 5.0.2
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- -
|
41
|
+
- - "~>"
|
39
42
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
43
|
+
version: '5.0'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 5.0.2
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
48
|
+
name: byebug
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - ">="
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '0'
|
48
|
-
type: :
|
54
|
+
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
@@ -53,7 +59,7 @@ dependencies:
|
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: '0'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
62
|
+
name: pry
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - ">="
|
@@ -67,7 +73,7 @@ dependencies:
|
|
67
73
|
- !ruby/object:Gem::Version
|
68
74
|
version: '0'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
76
|
+
name: rspec
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
72
78
|
requirements:
|
73
79
|
- - ">="
|
@@ -81,19 +87,25 @@ dependencies:
|
|
81
87
|
- !ruby/object:Gem::Version
|
82
88
|
version: '0'
|
83
89
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
90
|
+
name: webmock
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
86
92
|
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '2.3'
|
87
96
|
- - ">="
|
88
97
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
98
|
+
version: 2.3.2
|
90
99
|
type: :development
|
91
100
|
prerelease: false
|
92
101
|
version_requirements: !ruby/object:Gem::Requirement
|
93
102
|
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '2.3'
|
94
106
|
- - ">="
|
95
107
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
108
|
+
version: 2.3.2
|
97
109
|
- !ruby/object:Gem::Dependency
|
98
110
|
name: bundler
|
99
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,6 +142,9 @@ extensions: []
|
|
130
142
|
extra_rdoc_files: []
|
131
143
|
files:
|
132
144
|
- ".gitignore"
|
145
|
+
- ".rspec"
|
146
|
+
- ".ruby-gemset"
|
147
|
+
- ".ruby-version"
|
133
148
|
- ".travis.yml"
|
134
149
|
- CODE_OF_CONDUCT.md
|
135
150
|
- Gemfile
|
@@ -176,6 +191,18 @@ files:
|
|
176
191
|
- lib/idn_sdk_ruby/com/nbos/capi/modules/media/v0/media_info.rb
|
177
192
|
- lib/idn_sdk_ruby/com/nbos/capi/modules/media/v0/media_remote_api.rb
|
178
193
|
- lib/idn_sdk_ruby/version.rb
|
194
|
+
- spec/api/v0/abstract_api_context_spec.rb
|
195
|
+
- spec/api/v0/idn_sdk_spec.rb
|
196
|
+
- spec/api/v0/in_memory_api_context_spec.rb
|
197
|
+
- spec/api/v0/token_api_model_spec.rb
|
198
|
+
- spec/fixtures/temp_user.png
|
199
|
+
- spec/idn_sdk_ruby_spec.rb
|
200
|
+
- spec/modules/identity/v0/identity_api_spec.rb
|
201
|
+
- spec/modules/ids/v0/ids_api_spec.rb
|
202
|
+
- spec/modules/ids/v0/ids_spec.rb
|
203
|
+
- spec/modules/media/v0/media_api_spec.rb
|
204
|
+
- spec/spec_helper.rb
|
205
|
+
- spec/support/webmock_stubs.rb
|
179
206
|
homepage: http://wavelabs.in
|
180
207
|
licenses:
|
181
208
|
- MIT
|