wavelabs_client_api 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +8 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +140 -0
- data/Rakefile +12 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/generators/templates/wavelabs_client_api_initializer.rb +13 -0
- data/lib/generators/wavelabs_client_api/install_generator.rb +17 -0
- data/lib/wavelabs_client_api.rb +34 -0
- data/lib/wavelabs_client_api/client/api/core/auth_api.rb +179 -0
- data/lib/wavelabs_client_api/client/api/core/base_api.rb +92 -0
- data/lib/wavelabs_client_api/client/api/core/media_api.rb +48 -0
- data/lib/wavelabs_client_api/client/api/core/social_api.rb +78 -0
- data/lib/wavelabs_client_api/client/api/core/users_api.rb +90 -0
- data/lib/wavelabs_client_api/client/api/data_models/base_api_model.rb +40 -0
- data/lib/wavelabs_client_api/client/api/data_models/login_api_model.rb +41 -0
- data/lib/wavelabs_client_api/client/api/data_models/media_api_model.rb +26 -0
- data/lib/wavelabs_client_api/client/api/data_models/member_api_model.rb +55 -0
- data/lib/wavelabs_client_api/client/api/data_models/message_api_model.rb +19 -0
- data/lib/wavelabs_client_api/client/api/data_models/social_accounts_api_model.rb +41 -0
- data/lib/wavelabs_client_api/client/api/data_models/token_api_model.rb +37 -0
- data/lib/wavelabs_client_api/client/api/data_models/token_details_api_model.rb +51 -0
- data/lib/wavelabs_client_api/version.rb +3 -0
- data/spec/core_api_specs/auth_api_spec.rb +90 -0
- data/spec/core_api_specs/media_api_spec.rb +38 -0
- data/spec/core_api_specs/social_api_spec.rb +32 -0
- data/spec/core_api_specs/users_api_spec.rb +65 -0
- data/spec/data_model_specs/login_api_model_spec.rb +27 -0
- data/spec/data_model_specs/media_api_model_spec.rb +21 -0
- data/spec/data_model_specs/member_api_model_spec.rb +38 -0
- data/spec/data_model_specs/message_api_model_spec.rb +19 -0
- data/spec/data_model_specs/social_accounts_api_model_spec.rb +25 -0
- data/spec/data_model_specs/token_api_model_spec.rb +21 -0
- data/spec/spec_helper.rb +28 -0
- data/spec/support/temp_user.doc +0 -0
- data/spec/support/temp_user.png +0 -0
- data/spec/support/user_sign_up.rb +20 -0
- data/wavelabs_client_api.gemspec +41 -0
- metadata +183 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
# This class is a virtual Model for MessageApi model.
|
2
|
+
# It have required attributes to create the MessageApi model object.
|
3
|
+
# The purpose of this class is to create MessageApi model object
|
4
|
+
# to send back the API Server response.
|
5
|
+
|
6
|
+
|
7
|
+
class WavelabsClientApi::Client::Api::DataModels::MessageApiModel
|
8
|
+
|
9
|
+
attr_accessor :status, :messgeCode, :message
|
10
|
+
|
11
|
+
def initialize(json_response = nil)
|
12
|
+
if json_response.present?
|
13
|
+
@status = json_response.code
|
14
|
+
@messageCode = json_response.parsed_response[:messageCode]
|
15
|
+
@message = json_response.parsed_response[:message]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# This class is a virtual Model for SocialAccountsApiModel.
|
2
|
+
# It have required attributes to create the SocialAccountsApiModel object.
|
3
|
+
# And also it included the Rails ActiveModel::Validations to
|
4
|
+
# add errors which will populate on views. Based on the response from
|
5
|
+
# Wavelabs API server 'add_errors' or 'add_messages' methods add appropriate
|
6
|
+
# messages to SocialAccountsApiModel object.
|
7
|
+
|
8
|
+
class WavelabsClientApi::Client::Api::DataModels::SocialAccountsApiModel < WavelabsClientApi::Client::Api::DataModels::BaseApiModel
|
9
|
+
|
10
|
+
attr_accessor :id, :email, :social_type, :image_url
|
11
|
+
|
12
|
+
def initialize(social_params = nil)
|
13
|
+
if social_params.present?
|
14
|
+
@id = social_params["id"]
|
15
|
+
@email = social_params["email"]
|
16
|
+
@social_type = social_params["socialType"]
|
17
|
+
@image_url = social_params["imageUrl"]
|
18
|
+
else
|
19
|
+
@id, @email, @social_type, @image_url = nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def add_errors(json_response)
|
25
|
+
json_response["errors"].each do |e|
|
26
|
+
property_name = e['propertyName']
|
27
|
+
msg = e['message']
|
28
|
+
self.errors[property_name] << msg
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def add_messages(json_response)
|
33
|
+
if json_response["message"].present?
|
34
|
+
@message = json_response["message"]
|
35
|
+
elsif json_response["error"].present?
|
36
|
+
@message = json_response["error"]
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# This class is a virtual Model for TokenApiModel.
|
2
|
+
# It have required attributes to create the TokenApiModel object.
|
3
|
+
|
4
|
+
|
5
|
+
class WavelabsClientApi::Client::Api::DataModels::TokenApiModel < WavelabsClientApi::Client::Api::DataModels::BaseApiModel
|
6
|
+
attr_accessor :value, :expires_in, :refresh_token, :scope, :token_type, :message
|
7
|
+
|
8
|
+
def initialize(token_params = nil)
|
9
|
+
if token_params.present?
|
10
|
+
@value = token_params["access_token"]
|
11
|
+
@expires_in = token_params["expires_in"]
|
12
|
+
@refresh_token = token_params["refresh_token"]
|
13
|
+
@scope = token_params["scope"]
|
14
|
+
@token_type = token_params["token_type"]
|
15
|
+
else
|
16
|
+
@value , @expires_in, @refresh_token, @scope, @token_type, @message = nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def add_errors(json_response)
|
21
|
+
json_response["errors"].each do |e|
|
22
|
+
property_name = e['propertyName']
|
23
|
+
msg = e['message']
|
24
|
+
self.errors[property_name] << msg
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_messages(json_response)
|
29
|
+
if json_response["message"].present?
|
30
|
+
@message = json_response["message"]
|
31
|
+
elsif json_response["error"].present?
|
32
|
+
@message = json_response["error"]
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# This class is a virtual Model for TokenApiModel.
|
2
|
+
# It have required attributes to create the TokenApiModel object.
|
3
|
+
|
4
|
+
|
5
|
+
class WavelabsClientApi::Client::Api::DataModels::TokenDetailsApiModel < WavelabsClientApi::Client::Api::DataModels::BaseApiModel
|
6
|
+
attr_accessor :username, :clientId, :tokenType, :token, :expiration, :expired, :authorities, :uuid, :tenantId, :message
|
7
|
+
|
8
|
+
def initialize(token_details_params = nil)
|
9
|
+
if token_details_params.present?
|
10
|
+
@username = token_details_params["username"]
|
11
|
+
@expiration = token_details_params["expiration"]
|
12
|
+
@clientId = token_details_params["clientId"]
|
13
|
+
@token = token_details_params["token"]
|
14
|
+
@tokenType = token_details_params["tokenType"]
|
15
|
+
@expired = token_details_params["expired"]
|
16
|
+
if token_details_params["member"].present?
|
17
|
+
@uuid = token_details_params["member"]["uuid"]
|
18
|
+
else
|
19
|
+
@uuid = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
if token_details_params["authorities"].present?
|
23
|
+
@authorities = token_details_params["authorities"]
|
24
|
+
else
|
25
|
+
@authorities = nil
|
26
|
+
end
|
27
|
+
|
28
|
+
@tenantId = token_details_params["tenantId"]
|
29
|
+
else
|
30
|
+
@username, @expiration, @clientId, @token, @tokenType, @expired, @authorities, @uuid, @tenantId= nil
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def add_errors(json_response)
|
35
|
+
json_response["errors"].each do |e|
|
36
|
+
property_name = e['propertyName']
|
37
|
+
msg = e['message']
|
38
|
+
self.errors[property_name] << msg
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def add_messages(json_response)
|
43
|
+
if json_response["message"].present?
|
44
|
+
@message = json_response["message"]
|
45
|
+
elsif json_response["error"].present?
|
46
|
+
@message = json_response["error"]
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WavelabsClientApi::Client::Api::Core::AuthApi do
|
4
|
+
|
5
|
+
user_params = {:username => "wavlelabstest",
|
6
|
+
:password => "test123",
|
7
|
+
:email => "test@wavelabs.com",
|
8
|
+
:firstName => "w",
|
9
|
+
:lastName => "L"}
|
10
|
+
|
11
|
+
let(:signup_user) {UserSignUp.sign_up_user(user_params)}
|
12
|
+
let(:login_user) {UserSignUp.login_user}
|
13
|
+
let(:get_initial_token) {UserSignUp.get_token}
|
14
|
+
|
15
|
+
let (:auth_api_obj) { WavelabsClientApi::Client::Api::Core::AuthApi.new}
|
16
|
+
let (:auth_api) { WavelabsClientApi::Client::Api::Core::AuthApi}
|
17
|
+
|
18
|
+
it "#check_connection?" do
|
19
|
+
expect(auth_api.check_connection?).to be true
|
20
|
+
end
|
21
|
+
|
22
|
+
it "#Check Constants of Auth API URIS" do
|
23
|
+
expect(auth_api::AUTH_TOKEN_URI).to eq '/oauth/token'
|
24
|
+
expect(auth_api::TOKEN_VALIDATION_URI).to eq '/api/oauth/v0/tokens'
|
25
|
+
expect(auth_api::LOGIN_URI).to eq '/api/identity/v0/auth/login'
|
26
|
+
expect(auth_api::LOGOUT_URI).to eq '/api/identity/v0/auth/logout'
|
27
|
+
expect(auth_api::CHANGE_PASSWORD_URI).to eq '/api/identity/v0/auth/changePassword'
|
28
|
+
expect(auth_api::FORGOT_PASSWORD_URI).to eq '/api/identity/v0/auth/forgotPassword'
|
29
|
+
end
|
30
|
+
|
31
|
+
it "#get_auth_token with client details" do
|
32
|
+
res = auth_api_obj.get_auth_token("client_credentials", "scope:oauth.token.verify")
|
33
|
+
expect(res[:status]).to eq 200
|
34
|
+
end
|
35
|
+
|
36
|
+
it "#is_token_valid with valid tokens" do
|
37
|
+
signup_user
|
38
|
+
res = auth_api_obj.login({:username => "wavlelabstest", :password => "test123"}, get_initial_token)
|
39
|
+
expect(res[:status]).to eq 200
|
40
|
+
user_token = res[:member].token.value
|
41
|
+
final_res = auth_api_obj.is_token_valid(user_token, get_initial_token)
|
42
|
+
#expect(final_res[:token].token).not_to be_empty
|
43
|
+
expect(final_res[:status]).to eq 403
|
44
|
+
end
|
45
|
+
|
46
|
+
it "#login method without login details" do
|
47
|
+
res = auth_api_obj.login
|
48
|
+
expect(res[:status]).to eq 500
|
49
|
+
expect(res[:login].message).to eq "Invalid login parameters"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "#login method with unregistered login details" do
|
53
|
+
res = auth_api_obj.login({:username => "test", :password => "pas"}, get_initial_token)
|
54
|
+
expect(res[:status]).to eq 400
|
55
|
+
end
|
56
|
+
|
57
|
+
it "#login method with registered login details" do
|
58
|
+
signup_user
|
59
|
+
res = auth_api_obj.login({:username => "wavlelabstest", :password => "test123"}, get_initial_token)
|
60
|
+
expect(res[:status]).to eq 200
|
61
|
+
end
|
62
|
+
|
63
|
+
it "Check Forgot Password with valid email#forgot_password" do
|
64
|
+
res = auth_api_obj.forgot_password({:email => "test@wavelabs.com"}, get_initial_token)
|
65
|
+
expect(res[:status]).to eq 200
|
66
|
+
end
|
67
|
+
|
68
|
+
it "Check Forgot Password with invalid email(#forgot_password)" do
|
69
|
+
res = auth_api_obj.forgot_password({:email => "test@labs.com"}, get_initial_token)
|
70
|
+
expect(res[:status]).to eq 400
|
71
|
+
end
|
72
|
+
|
73
|
+
it "Check Forgot Password with empty email(#forgot_password)" do
|
74
|
+
res = auth_api_obj.forgot_password({:email => " "}, get_initial_token)
|
75
|
+
expect(res[:status]).to eq 400
|
76
|
+
end
|
77
|
+
|
78
|
+
it "Check Change Password with invalid details(#change_password)" do
|
79
|
+
l_req = login_user
|
80
|
+
res = auth_api_obj.change_password({:password => "", :newPassword => " "},l_req[:member].token.value)
|
81
|
+
expect(res[:status]).to eq 400
|
82
|
+
end
|
83
|
+
|
84
|
+
it "Check Logout(#logout)" do
|
85
|
+
l_req = login_user
|
86
|
+
res = auth_api_obj.logout(l_req[:member].token.value)
|
87
|
+
expect(res[:status]).to eq 200
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WavelabsClientApi::Client::Api::Core::MediaApi do
|
4
|
+
let(:login_user) {UserSignUp.login_user}
|
5
|
+
|
6
|
+
let (:media_api_obj) { WavelabsClientApi::Client::Api::Core::MediaApi.new}
|
7
|
+
let (:media_api) { WavelabsClientApi::Client::Api::Core::MediaApi}
|
8
|
+
|
9
|
+
it "#check_connection?" do
|
10
|
+
expect(media_api.check_connection?).to be true
|
11
|
+
end
|
12
|
+
|
13
|
+
it "#Check Constants of Media API URIS" do
|
14
|
+
expect(media_api::MEDIA_URI).to eq '/api/media/v0/media'
|
15
|
+
end
|
16
|
+
|
17
|
+
it "#get_media with user details after login" do
|
18
|
+
l_req = login_user
|
19
|
+
res = media_api_obj.get_media(l_req[:member].id, "profile", l_req[:member].token.value)
|
20
|
+
expect(res[:status]).to eq 200
|
21
|
+
end
|
22
|
+
|
23
|
+
it "#update_media with user details after login" do
|
24
|
+
l_req = login_user
|
25
|
+
file_path = Dir.pwd + "/spec/support/temp_user.png"
|
26
|
+
res = media_api_obj.upload_media(file_path, "profile", l_req[:member].token.value, l_req[:member].id)
|
27
|
+
expect(res[:status]).to eq 200
|
28
|
+
end
|
29
|
+
|
30
|
+
it "#update_media with invalide file type after login" do
|
31
|
+
l_req = login_user
|
32
|
+
file_path = Dir.pwd + "/spec/support/temp_user.doc"
|
33
|
+
res = media_api_obj.upload_media(file_path, "profile", l_req[:member].token.value, l_req[:member].id)
|
34
|
+
expect(res[:status]).to eq 200
|
35
|
+
expect(res[:media].message).to eq "media.upload.error"
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WavelabsClientApi::Client::Api::Core::SocialApi do
|
4
|
+
let (:social_api_obj) { WavelabsClientApi::Client::Api::Core::SocialApi.new}
|
5
|
+
let (:social_api) { WavelabsClientApi::Client::Api::Core::SocialApi}
|
6
|
+
|
7
|
+
it "#check_connection?" do
|
8
|
+
expect(social_api.check_connection?).to be true
|
9
|
+
end
|
10
|
+
|
11
|
+
it "#Check Constants of Social API URIS" do
|
12
|
+
expect(social_api::FACEBOOK_LOGIN_URI).to eq '/api/identity/v0/auth/social/facebook/connect'
|
13
|
+
expect(social_api::GOOGLE_LOGIN_URI).to eq '/api/identity/v0/auth/social/googlePlus/connect'
|
14
|
+
expect(social_api::GITHUB_LOGIN_URI).to eq '/api/identity/v0/auth/social/gitHub/connect'
|
15
|
+
expect(social_api::LINKEDIN_LOGIN_URI).to eq '/api/identity/v0/auth/social/linkedIn/connect'
|
16
|
+
expect(social_api::INSTAGRAM_LOGIN_URI).to eq '/api/identity/v0/auth/social/instagram/connect'
|
17
|
+
expect(social_api::TWITER_LOGIN_URI).to eq '/api/identity/v0/auth/social/twitter/connect'
|
18
|
+
expect(social_api::INVALID_SOCIAL_URI).to eq '/api/identity/v0/auth/social/invalid/connect'
|
19
|
+
end
|
20
|
+
|
21
|
+
it "#get_scoial_login_uri" do
|
22
|
+
expect(social_api_obj.get_scoial_login_uri("facebook")).to eq '/api/identity/v0/auth/social/facebook/connect'
|
23
|
+
expect(social_api_obj.get_scoial_login_uri("google_oauth2")).to eq '/api/identity/v0/auth/social/googlePlus/connect'
|
24
|
+
expect(social_api_obj.get_scoial_login_uri("linkedin")).to eq '/api/identity/v0/auth/social/linkedIn/connect'
|
25
|
+
expect(social_api_obj.get_scoial_login_uri("instagram")).to eq '/api/identity/v0/auth/social/instagram/connect'
|
26
|
+
expect(social_api_obj.get_scoial_login_uri("twitter")).to eq '/api/identity/v0/auth/social/twitter/connect'
|
27
|
+
expect(social_api_obj.get_scoial_login_uri("github")).to eq '/api/identity/v0/auth/social/gitHub/connect'
|
28
|
+
expect(social_api_obj.get_scoial_login_uri("abcdef")).to eq '/api/identity/v0/auth/social/invalid/connect'
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WavelabsClientApi::Client::Api::Core::UsersApi do
|
4
|
+
|
5
|
+
let (:user_api_obj) { WavelabsClientApi::Client::Api::Core::UsersApi.new}
|
6
|
+
let (:user_api) { WavelabsClientApi::Client::Api::Core::UsersApi}
|
7
|
+
let(:get_initial_token) {UserSignUp.get_token}
|
8
|
+
|
9
|
+
let(:login_user) {UserSignUp.login_user}
|
10
|
+
|
11
|
+
it "check server connection" do
|
12
|
+
expect(user_api.check_connection?).to be true
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
it "#Check Constants of Users API URIS" do
|
17
|
+
expect(user_api::SIGNUP_URI).to eq '/api/identity/v0/users/signup'
|
18
|
+
expect(user_api::USER_URI).to eq '/api/identity/v0/users'
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
it "Signup with existing user details(#sign_up)" do
|
23
|
+
user_params = {:username => "wavlelabstest",
|
24
|
+
:password => "test123",
|
25
|
+
:email => "test@wavelabs.com",
|
26
|
+
:firstName => "w",
|
27
|
+
:lastName => "L"}
|
28
|
+
|
29
|
+
res = user_api_obj.sign_up(user_params, get_initial_token)
|
30
|
+
expect(res[:status]).to eq 400
|
31
|
+
expect(res[:member].errors.size).to eq 2
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
it "Signup with valid details(#sign_up)" do
|
36
|
+
random_number = rand(0..100)
|
37
|
+
user_params = {:username => "wavlelabstest#{random_number}",
|
38
|
+
:password => "test1234",
|
39
|
+
:email => "test@wavelabs#{random_number}.com",
|
40
|
+
:firstName => "L",
|
41
|
+
:lastName => "W"}
|
42
|
+
|
43
|
+
res = user_api_obj.sign_up(user_params, get_initial_token)
|
44
|
+
expect([200,400].include?res[:status]).to eq true
|
45
|
+
end
|
46
|
+
|
47
|
+
it "After Login user can view his profile(#show)" do
|
48
|
+
l_req = login_user
|
49
|
+
res = user_api_obj.show({:id => l_req[:member].id},l_req[:member].token.value)
|
50
|
+
expect(res[:status]).to eq 200
|
51
|
+
end
|
52
|
+
|
53
|
+
it "After Login user can update his profile(#update)" do
|
54
|
+
l_req = login_user
|
55
|
+
edit_user_params = {:id => l_req[:member].id,
|
56
|
+
:description => "test wavelabs",
|
57
|
+
:email => "test@wavelabs.com",
|
58
|
+
:firstName => "W",
|
59
|
+
:lastName => "L"
|
60
|
+
}
|
61
|
+
res = user_api_obj.update(edit_user_params,l_req[:member].token.value)
|
62
|
+
expect(res[:status]).to eq 200
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WavelabsClientApi::Client::Api::DataModels::LoginApiModel do
|
4
|
+
|
5
|
+
let (:login_api_model_obj) { WavelabsClientApi::Client::Api::DataModels::LoginApiModel.new}
|
6
|
+
let (:login_api_model) { WavelabsClientApi::Client::Api::DataModels::LoginApiModel}
|
7
|
+
|
8
|
+
it "#check all model properties" do
|
9
|
+
expect(login_api_model_obj.respond_to?(:username)).to eq true
|
10
|
+
expect(login_api_model_obj.respond_to?(:email)).to eq true
|
11
|
+
expect(login_api_model_obj.respond_to?(:firstName)).to eq true
|
12
|
+
expect(login_api_model_obj.respond_to?(:lastName)).to eq true
|
13
|
+
expect(login_api_model_obj.respond_to?(:phone)).to eq true
|
14
|
+
expect(login_api_model_obj.respond_to?(:newPassword)).to eq true
|
15
|
+
expect(login_api_model_obj.respond_to?(:message)).to eq true
|
16
|
+
end
|
17
|
+
|
18
|
+
it "#check all instance methods" do
|
19
|
+
expect(login_api_model_obj.respond_to?(:add_errors)).to eq true
|
20
|
+
expect(login_api_model_obj.respond_to?(:add_messages)).to eq true
|
21
|
+
end
|
22
|
+
|
23
|
+
it "#check undefined instance/properties methods" do
|
24
|
+
expect(login_api_model_obj.respond_to?(:description)).to eq false
|
25
|
+
expect(login_api_model_obj.respond_to?(:add_message)).to eq false
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WavelabsClientApi::Client::Api::DataModels::MediaApiModel do
|
4
|
+
|
5
|
+
let (:media_api_model_obj) { WavelabsClientApi::Client::Api::DataModels::MediaApiModel.new()}
|
6
|
+
let (:media_api_model) { WavelabsClientApi::Client::Api::DataModels::MediaApiModel}
|
7
|
+
|
8
|
+
it "#check all model properties" do
|
9
|
+
expect(media_api_model_obj.respond_to?(:extension)).to eq true
|
10
|
+
expect(media_api_model_obj.respond_to?(:mediaFileDetailsList)).to eq true
|
11
|
+
expect(media_api_model_obj.respond_to?(:newMedia)).to eq true
|
12
|
+
expect(media_api_model_obj.respond_to?(:supportedsizes)).to eq true
|
13
|
+
expect(media_api_model_obj.respond_to?(:message)).to eq true
|
14
|
+
end
|
15
|
+
|
16
|
+
it "#check undefined instance/properties methods" do
|
17
|
+
expect(media_api_model_obj.respond_to?(:password)).to eq false
|
18
|
+
expect(media_api_model_obj.respond_to?(:add_message)).to eq false
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WavelabsClientApi::Client::Api::DataModels::MemberApiModel do
|
4
|
+
|
5
|
+
let (:member_api_model_obj) { WavelabsClientApi::Client::Api::DataModels::MemberApiModel.new(nil, true)}
|
6
|
+
let (:member_api_model_obj_with_associates) { WavelabsClientApi::Client::Api::DataModels::MemberApiModel.new(nil, false)}
|
7
|
+
let (:member_api_model) { WavelabsClientApi::Client::Api::DataModels::MemberApiModel}
|
8
|
+
|
9
|
+
it "#check all model properties" do
|
10
|
+
expect(member_api_model_obj.respond_to?(:username)).to eq true
|
11
|
+
expect(member_api_model_obj.respond_to?(:email)).to eq true
|
12
|
+
expect(member_api_model_obj.respond_to?(:firstName)).to eq true
|
13
|
+
expect(member_api_model_obj.respond_to?(:lastName)).to eq true
|
14
|
+
expect(member_api_model_obj.respond_to?(:phone)).to eq true
|
15
|
+
expect(member_api_model_obj.respond_to?(:id)).to eq true
|
16
|
+
expect(member_api_model_obj.respond_to?(:description)).to eq true
|
17
|
+
expect(member_api_model_obj.respond_to?(:message)).to eq true
|
18
|
+
end
|
19
|
+
|
20
|
+
it "#check all instance methods" do
|
21
|
+
expect(member_api_model_obj.respond_to?(:add_errors)).to eq true
|
22
|
+
expect(member_api_model_obj.respond_to?(:add_messages)).to eq true
|
23
|
+
end
|
24
|
+
|
25
|
+
it "#check undefined instance/properties methods" do
|
26
|
+
expect(member_api_model_obj.respond_to?(:password)).to eq false
|
27
|
+
expect(member_api_model_obj.respond_to?(:add_message)).to eq false
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
it "#check assoicated models of member" do
|
32
|
+
m_model = member_api_model_obj_with_associates
|
33
|
+
|
34
|
+
expect(m_model.respond_to?(:social_accounts)).to eq true
|
35
|
+
expect(m_model.respond_to?(:token)).to eq true
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|