idn_sdk_ruby 0.1.7 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb +11 -11
- data/lib/idn_sdk_ruby/com/nbos/capi/modules/ids/v0/ids.rb +2 -2
- data/lib/idn_sdk_ruby/com/nbos/capi/modules/media/v0/media_remote_api.rb +2 -2
- data/lib/idn_sdk_ruby/version.rb +1 -1
- data/spec/api/v0/abstract_api_context_spec.rb +1 -1
- data/spec/api/v0/idn_sdk_spec.rb +1 -1
- data/spec/modules/identity/v0/identity_api_spec.rb +1 -1
- data/spec/modules/ids/v0/ids_spec.rb +1 -1
- data/spec/modules/media/v0/media_api_spec.rb +1 -1
- data/spec/support/webmock_stubs.rb +12 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd81d947e382d29113b408af3f4417de0b34f8f2
|
4
|
+
data.tar.gz: 26f31b7e9e47723e9af7ae8d7c4d89edac50dde0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa8ffdc76202912aa26e51b81686f107c98e517fdb902502dffba20ebd6e3b5f9a8950530c2f7299fbaf6309664a4f621b563cadaf5b3bd29a6a1de2ed324d15
|
7
|
+
data.tar.gz: 883e6da818c1f93070d7474a0ef282e14d20926fcd7d1cc5391352ccd5bb966ed785dd70d13522fe04367a98e6d2ffcd1981379ec6d892bea4dc6d30df688dac
|
data/README.md
CHANGED
@@ -85,7 +85,7 @@ Or install it yourself as:
|
|
85
85
|
if host != nil
|
86
86
|
return host
|
87
87
|
else
|
88
|
-
return "http://api.qa1.nbos.
|
88
|
+
return "http://api.qa1.nbos.io"
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
@@ -95,7 +95,7 @@ Or install it yourself as:
|
|
95
95
|
if moduleName != nil && host != nil
|
96
96
|
super(moduleName, host)
|
97
97
|
else
|
98
|
-
super(moduleName, "http://api.qa1.nbos.
|
98
|
+
super(moduleName, "http://api.qa1.nbos.io")
|
99
99
|
end
|
100
100
|
|
101
101
|
end
|
@@ -44,9 +44,9 @@ module IdnSdkRuby
|
|
44
44
|
|
45
45
|
def getToken(clientId, clientSecret, grantType, scope = nil)
|
46
46
|
scope = scope.nil? ? [] : scope
|
47
|
-
|
48
|
-
@host_url = "http://api.qa1.nbos.
|
49
|
-
response = self.class.send("
|
47
|
+
body = {:client_id => clientId, :client_secret => clientSecret, :grant_type => grantType, :scope => scope}
|
48
|
+
@host_url = "http://api.qa1.nbos.io" if @host_url.nil?
|
49
|
+
response = self.class.send("post", @host_url+@tokenUrl, :body => body, :headers => {"Accept" => "application/json"})
|
50
50
|
return response
|
51
51
|
end
|
52
52
|
|
@@ -54,14 +54,14 @@ module IdnSdkRuby
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def login(authorization, loginModel)
|
57
|
-
@host_url = "http://api.qa1.nbos.
|
57
|
+
@host_url = "http://api.qa1.nbos.io" if @host_url.nil?
|
58
58
|
body = loginModel.to_s
|
59
59
|
response = self.class.send("post", @host_url+@loginUrl, :body => body, :headers => {"Authorization" => "Bearer " + authorization})
|
60
60
|
return response
|
61
61
|
end
|
62
62
|
|
63
63
|
def signup(authorization, memberSignupModel)
|
64
|
-
@host_url = "http://api.qa1.nbos.
|
64
|
+
@host_url = "http://api.qa1.nbos.io" if @host_url.nil?
|
65
65
|
body = memberSignupModel.to_s
|
66
66
|
response = self.class.send("post", @host_url+@signupUrl, :body => body, :headers => {"Authorization" => "Bearer " + authorization})
|
67
67
|
return response
|
@@ -71,7 +71,7 @@ module IdnSdkRuby
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def updateCredentials(authorization,updatePasswordApiModel)
|
74
|
-
@host_url = "http://api.qa1.nbos.
|
74
|
+
@host_url = "http://api.qa1.nbos.io" if @host_url.nil?
|
75
75
|
body = updatePasswordApiModel.to_s
|
76
76
|
response = self.class.send("post", @host_url+@changeUrl, :body => body, :headers => {"Authorization" => "Bearer " + authorization})
|
77
77
|
return response
|
@@ -84,7 +84,7 @@ module IdnSdkRuby
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def connect(authorization, oauth_details, connectService, clientId)
|
87
|
-
@host_url = "http://api.qa1.nbos.
|
87
|
+
@host_url = "http://api.qa1.nbos.io" if @host_url.nil?
|
88
88
|
@connect_service = get_social_login_uri(connectService)
|
89
89
|
body = { :clientId => clientId,
|
90
90
|
:accessToken => oauth_details[:credentials][:token],
|
@@ -95,19 +95,19 @@ module IdnSdkRuby
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def logout(authorization)
|
98
|
-
@host_url = "http://api.qa1.nbos.
|
98
|
+
@host_url = "http://api.qa1.nbos.io" if @host_url.nil? #response= HTTParty.post(@host_url+@loginUrl,{:body => body, :headers => { "Authorization" => "Bearer #{authorization}"}})
|
99
99
|
response = self.class.send("get", @host_url+@logoutUrl, :headers => {"Authorization" => "Bearer " + authorization})
|
100
100
|
return response
|
101
101
|
end
|
102
102
|
|
103
103
|
def getMemberDetails(authorization, uuid)
|
104
|
-
@host_url = "http://api.qa1.nbos.
|
104
|
+
@host_url = "http://api.qa1.nbos.io" if @host_url.nil?
|
105
105
|
response = self.class.send("get", @host_url+@profileUrl+"/#{uuid}", :headers => {"Authorization" => "Bearer " + authorization})
|
106
106
|
return response
|
107
107
|
end
|
108
108
|
|
109
109
|
def updateMemberDetails(authorization, uuid, memberApiModel)
|
110
|
-
@host_url = "http://api.qa1.nbos.
|
110
|
+
@host_url = "http://api.qa1.nbos.io" if @host_url.nil?
|
111
111
|
body = memberApiModel.to_s
|
112
112
|
response = self.class.send("put", @host_url+@profileUrl+"/#{uuid}", :body => body, :headers => {"Authorization" => "Bearer " + authorization})
|
113
113
|
return response
|
@@ -134,7 +134,7 @@ module IdnSdkRuby
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def tokenVerify(authorization, tokenToVerify, module_key)
|
137
|
-
@host_url = "http://api.qa1.nbos.
|
137
|
+
@host_url = "http://api.qa1.nbos.io" if @host_url.nil?
|
138
138
|
response = self.class.send("get", @host_url+@tokenVerifyUrl+"/#{tokenToVerify}", :headers => {"Authorization" => "Bearer " + authorization, "X-N-ModuleKey" => module_key})
|
139
139
|
return response
|
140
140
|
end
|
@@ -26,14 +26,14 @@ module IdnSdkRuby
|
|
26
26
|
api = IdnSdkRuby::Com::Nbos::Capi::Api::V0::NetworkApi.new
|
27
27
|
if (api != nil)
|
28
28
|
api.setApiContext(apiContext)
|
29
|
-
api.setHost("http://api.qa1.nbos.
|
29
|
+
api.setHost("http://api.qa1.nbos.io")
|
30
30
|
return api
|
31
31
|
end
|
32
32
|
else
|
33
33
|
api = apiClass.new
|
34
34
|
if (api != nil)
|
35
35
|
api.setApiContext(apiContext)
|
36
|
-
host = "http://api.qa1.nbos.
|
36
|
+
host = "http://api.qa1.nbos.io" if apiContext.getHost(moduleName).nil?
|
37
37
|
api.setHost(apiContext.getHost(moduleName))
|
38
38
|
return api
|
39
39
|
end
|
@@ -21,14 +21,14 @@ module IdnSdkRuby
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def getMedia(authorization, uuid, mediafor)
|
24
|
-
@host_url = "http://api.qa1.nbos.
|
24
|
+
@host_url = "http://api.qa1.nbos.io" if @host_url.nil?
|
25
25
|
query_params = { :id => uuid, :mediafor => mediafor}
|
26
26
|
response = self.class.send("get", @host_url+@mediaUrl, :query => query_params, :headers => {"Authorization" => "Bearer " + authorization})
|
27
27
|
return response
|
28
28
|
end
|
29
29
|
|
30
30
|
def uploadMedia(authorization, uuid, mediafor, media_file)
|
31
|
-
@host_url = "http://api.qa1.nbos.
|
31
|
+
@host_url = "http://api.qa1.nbos.io" if @host_url.nil?
|
32
32
|
query_params = { :id => uuid, :mediafor => mediafor}
|
33
33
|
body = {:file => media_file}
|
34
34
|
response = self.class.send("post", @host_url+@mediaUrl, :body => body, :query => query_params, :headers => {"Authorization" => "Bearer " + authorization})
|
data/lib/idn_sdk_ruby/version.rb
CHANGED
@@ -9,7 +9,7 @@ describe IdnSdkRuby::Com::Nbos::Capi::Api::V0::AbstractApiContext do
|
|
9
9
|
allow(api_context).to receive(:getName) {'app'}
|
10
10
|
allow(api_context).to receive(:init)
|
11
11
|
allow(api_context).to receive(:name){'app'}
|
12
|
-
allow(api_context).to receive(:getHost).with(anything()){'http://api.qa1.nbos.
|
12
|
+
allow(api_context).to receive(:getHost).with(anything()){'http://api.qa1.nbos.io'}
|
13
13
|
allow(api_context).to receive(:setClientToken).with(anything()){anything()}
|
14
14
|
api_context
|
15
15
|
end
|
data/spec/api/v0/idn_sdk_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe IdnSdkRuby do
|
|
8
8
|
allow(app_context).to receive(:getName) {'app'}
|
9
9
|
allow(app_context).to receive(:init)
|
10
10
|
allow(app_context).to receive(:name){'app'}
|
11
|
-
allow(app_context).to receive(:getHost).with(anything()){'http://api.qa1.nbos.
|
11
|
+
allow(app_context).to receive(:getHost).with(anything()){'http://api.qa1.nbos.io'}
|
12
12
|
allow(app_context).to receive(:setClientToken).with(anything()){anything()}
|
13
13
|
expect(IdnSdkRuby::Com::Nbos::Capi::Api::V0::IdnSDK.init(app_context)).to be_kind_of IdnSdkRuby::Com::Nbos::Capi::Api::V0::TokenApiModel
|
14
14
|
end
|
@@ -10,7 +10,7 @@ describe IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::IdentityApi do
|
|
10
10
|
allow(app_context).to receive(:getName) {'app'}
|
11
11
|
allow(app_context).to receive(:init)
|
12
12
|
allow(app_context).to receive(:name){'app'}
|
13
|
-
allow(app_context).to receive(:getHost).with(anything()){'http://api.qa1.nbos.
|
13
|
+
allow(app_context).to receive(:getHost).with(anything()){'http://api.qa1.nbos.io'}
|
14
14
|
allow(app_context).to receive(:setClientToken).with(anything()){anything()}
|
15
15
|
allow(token_api_model).to receive(:getAccess_token){"access_token"}
|
16
16
|
allow(app_context).to receive(:getClientToken){token_api_model}
|
@@ -9,7 +9,7 @@ describe IdnSdkRuby::Com::Nbos::Capi::Modules::Ids::V0::Ids do
|
|
9
9
|
allow(app_context).to receive(:getName) {'app'}
|
10
10
|
allow(app_context).to receive(:init)
|
11
11
|
allow(app_context).to receive(:name){'app'}
|
12
|
-
allow(app_context).to receive(:getHost).with(anything()){'http://api.qa1.nbos.
|
12
|
+
allow(app_context).to receive(:getHost).with(anything()){'http://api.qa1.nbos.io'}
|
13
13
|
allow(app_context).to receive(:setClientToken).with(anything()){anything()}
|
14
14
|
IdnSdkRuby::Com::Nbos::Capi::Api::V0::IdnSDK.init(app_context)
|
15
15
|
expect(IdnSdkRuby::Com::Nbos::Capi::Modules::Ids::V0::Ids.getModuleApi('app')).to be_a_kind_of IdnSdkRuby::Com::Nbos::Capi::Api::V0::NetworkApi
|
@@ -8,7 +8,7 @@ describe IdnSdkRuby::Com::Nbos::Capi::Modules::Media::V0::MediaApi do
|
|
8
8
|
allow(app_context).to receive(:getName) {'app'}
|
9
9
|
allow(app_context).to receive(:init)
|
10
10
|
allow(app_context).to receive(:name){'app'}
|
11
|
-
allow(app_context).to receive(:getHost).with(anything()){'http://api.qa1.nbos.
|
11
|
+
allow(app_context).to receive(:getHost).with(anything()){'http://api.qa1.nbos.io'}
|
12
12
|
allow(app_context).to receive(:setClientToken).with(anything()){anything()}
|
13
13
|
allow(app_context).to receive(:getUserToken).with("identity"){"identitytoken"}
|
14
14
|
IdnSdkRuby::Com::Nbos::Capi::Api::V0::IdnSDK.init(app_context)
|
@@ -3,17 +3,17 @@ require 'webmock/rspec'
|
|
3
3
|
WebMock.disable_net_connect!(:allow_localhost => true)
|
4
4
|
RSpec.configure do |config|
|
5
5
|
config.before(:each) do
|
6
|
-
WebMock.stub_request(:get, "http://api.qa1.nbos.
|
6
|
+
WebMock.stub_request(:get, "http://api.qa1.nbos.io/oauth/token?client_id=sample-app-client&client_secret=sample-app-secret&grant_type=client_credentials&scope%5B%5D=").
|
7
7
|
with(:headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json'}).
|
8
8
|
to_return(:status => 200, :body => {"access_token": "5d70771a-ee14-42d9-a5fa-e62e8d24a446",
|
9
9
|
"token_type":"bearer","expires_in":272217}.to_s, :headers => {})
|
10
10
|
|
11
11
|
|
12
|
-
media_api_response = {"extension"=>"png", "mediaFileDetailsList"=>[{"mediapath"=>"http://api.qa1.nbos.
|
12
|
+
media_api_response = {"extension"=>"png", "mediaFileDetailsList"=>[{"mediapath"=>"http://api.qa1.nbos.io/Media/default/default-profile_48x48.png",
|
13
13
|
"mediatype"=>"small"},
|
14
|
-
{"mediapath"=>"http://api.qa1.nbos.
|
14
|
+
{"mediapath"=>"http://api.qa1.nbos.io/Media/default/default-profile_300x200.png",
|
15
15
|
"mediatype"=>"medium"},
|
16
|
-
{"mediapath"=>"http://api.qa1.nbos.
|
16
|
+
{"mediapath"=>"http://api.qa1.nbos.io/Media/default/default-profile.png",
|
17
17
|
"mediatype"=>"original"}],
|
18
18
|
"supportedsizes"=>"small:48x48,medium:300x200", "uuid"=>nil}
|
19
19
|
|
@@ -43,43 +43,43 @@ RSpec.configure do |config|
|
|
43
43
|
logout_change_response = {"messageCode"=>"member.logout.success",
|
44
44
|
"message"=>"member.logout.success"}
|
45
45
|
|
46
|
-
WebMock.stub_request(:get, "http://api.qa1.nbos.
|
46
|
+
WebMock.stub_request(:get, "http://api.qa1.nbos.io/api/media/v0/media?id=mrd:123&mediafor=profile").
|
47
47
|
with(:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer identitytoken', 'Content-Type'=>'application/json'}).
|
48
48
|
to_return(:status => 200, :body =>media_api_response.to_json, :headers => {"Content-Type"=> "application/json"})
|
49
49
|
|
50
|
-
WebMock.stub_request(:post, "http://api.qa1.nbos.
|
50
|
+
WebMock.stub_request(:post, "http://api.qa1.nbos.io/api/media/v0/media?id=mrd:123&mediafor=profile").
|
51
51
|
with(:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer identitytoken','Content-Length'=>'14571', 'Content-Type'=>'multipart/form-data; boundary=-----------RubyMultipartPost'}).
|
52
52
|
to_return(:status => 200, :body => media_api_response.to_json, :headers => {"Content-Type"=> "application/json"})
|
53
53
|
|
54
|
-
WebMock.stub_request(:post, "http://api.qa1.nbos.
|
54
|
+
WebMock.stub_request(:post, "http://api.qa1.nbos.io/api/identity/v0/users/signup").
|
55
55
|
with(:body => "{\"username\"=>\"jagadish2\", \"password\"=>\"654321\", \"email\"=>\"jagadishwerb+1@wavelabs.in\", \"firstName\"=>\"jane\", \"lastName\"=>\"doe\"}",
|
56
56
|
:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer access_token', 'Content-Type'=>'application/json'}).
|
57
57
|
to_return(:status => 200, :body => sign_up_response.to_json,
|
58
58
|
:headers => {"Content-Type"=> "application/json"})
|
59
59
|
|
60
|
-
WebMock.stub_request(:post, "http://api.qa1.nbos.
|
60
|
+
WebMock.stub_request(:post, "http://api.qa1.nbos.io/api/identity/v0/auth/login").
|
61
61
|
with(:body => "{\"username\":\"jagadish2\",\"password\":\"123456\",\"messageCode\":null,\"message\":null}",
|
62
62
|
:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer access_token', 'Content-Type'=>'application/json'}).
|
63
63
|
to_return(:status => 200, :body => sign_up_response.to_json, :headers => {"Content-Type"=> "application/json"})
|
64
64
|
|
65
|
-
WebMock.stub_request(:put, "http://api.qa1.nbos.
|
65
|
+
WebMock.stub_request(:put, "http://api.qa1.nbos.io/api/identity/v0/users/MBR:test-uuid").
|
66
66
|
with(:body => "{\"username\"=>\"jagadish2\", \"password\"=>\"654321\", \"email\"=>\"jagadishwerb+1@wavelabs.in\", \"firstName\"=>\"jane\", \"lastName\"=>\"doe\"}",
|
67
67
|
:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer identitytoken', 'Content-Type'=>'application/json'}).
|
68
68
|
to_return(:status => 200, :body => sign_up_response["member"].to_json,
|
69
69
|
:headers => {"Content-Type"=> "application/json"})
|
70
70
|
|
71
|
-
WebMock.stub_request(:post, "http://api.qa1.nbos.
|
71
|
+
WebMock.stub_request(:post, "http://api.qa1.nbos.io/api/identity/v0/auth/changePassword").
|
72
72
|
with(:body => "{\"password\":\"123456\",\"newPassword\":\"654321\",\"message\":null}",
|
73
73
|
:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer identitytoken', 'Content-Type'=>'application/json'}).
|
74
74
|
to_return(:status => 200, :body => password_change_response.to_json,
|
75
75
|
:headers => {"Content-Type"=> "application/json"})
|
76
76
|
|
77
|
-
WebMock.stub_request(:get, "http://api.qa1.nbos.
|
77
|
+
WebMock.stub_request(:get, "http://api.qa1.nbos.io/api/identity/v0/auth/logout").
|
78
78
|
with(:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer identitytoken', 'Content-Type'=>'application/json'}).
|
79
79
|
to_return(:status => 200, :body => logout_change_response.to_json,
|
80
80
|
:headers => {"Content-Type"=> "application/json"})
|
81
81
|
|
82
|
-
WebMock.stub_request(:post, "http://api.qa1.nbos.
|
82
|
+
WebMock.stub_request(:post, "http://api.qa1.nbos.io/api/identity/v0/auth/social/facebook/connect").
|
83
83
|
with(:body => "{\"clientId\":\"sample-app-client\",\"accessToken\":\"test::omniauth::token\",\"expiresIn\":\"1494312526\"}",
|
84
84
|
:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer access_token', 'Content-Type'=>'application/json'}).
|
85
85
|
to_return(:status => 200, :body => fb_connect_response.to_json, :headers => {"Content-Type"=> "application/json"})
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sekhar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httmultiparty
|