idn_sdk_ruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +4 -0
  4. data/CODE_OF_CONDUCT.md +13 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +41 -0
  8. data/Rakefile +1 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +7 -0
  11. data/idn_sdk_ruby.gemspec +32 -0
  12. data/lib/idn_sdk_ruby/com/nbos/capi/api/v0/abstract_api_context.rb +25 -0
  13. data/lib/idn_sdk_ruby/com/nbos/capi/api/v0/api_context.rb +50 -0
  14. data/lib/idn_sdk_ruby/com/nbos/capi/api/v0/idn_sdk.rb +26 -0
  15. data/lib/idn_sdk_ruby/com/nbos/capi/api/v0/in_memory_api_context.rb +57 -0
  16. data/lib/idn_sdk_ruby/com/nbos/capi/api/v0/network_api.rb +73 -0
  17. data/lib/idn_sdk_ruby/com/nbos/capi/api/v0/network_callback.rb +4 -0
  18. data/lib/idn_sdk_ruby/com/nbos/capi/api/v0/token_api_model.rb +54 -0
  19. data/lib/idn_sdk_ruby/com/nbos/capi/modules/core/v0/module_api_model.rb +27 -0
  20. data/lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/basic_active_model.rb +20 -0
  21. data/lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/email_connect_api_model.rb +43 -0
  22. data/lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_api.rb +168 -0
  23. data/lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_ids_registry.rb +21 -0
  24. data/lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/identity_remote_api.rb +146 -0
  25. data/lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/login_model.rb +57 -0
  26. data/lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_api_model.rb +95 -0
  27. data/lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/member_signup_model.rb +60 -0
  28. data/lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/new_member_api_model.rb +36 -0
  29. data/lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/reset_password_model.rb +17 -0
  30. data/lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/social_account_api_model.rb +47 -0
  31. data/lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/social_connect_api_model.rb +18 -0
  32. data/lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/update_password_api_model.rb +54 -0
  33. data/lib/idn_sdk_ruby/com/nbos/capi/modules/ids/v0/ids.rb +56 -0
  34. data/lib/idn_sdk_ruby/com/nbos/capi/modules/ids/v0/ids_api.rb +48 -0
  35. data/lib/idn_sdk_ruby/com/nbos/capi/modules/ids/v0/ids_api_model.rb +26 -0
  36. data/lib/idn_sdk_ruby/com/nbos/capi/modules/ids/v0/ids_client.rb +19 -0
  37. data/lib/idn_sdk_ruby/com/nbos/capi/modules/ids/v0/ids_remote_api.rb +42 -0
  38. data/lib/idn_sdk_ruby/com/nbos/capi/modules/media/v0/media_api.rb +62 -0
  39. data/lib/idn_sdk_ruby/com/nbos/capi/modules/media/v0/media_api_model.rb +63 -0
  40. data/lib/idn_sdk_ruby/com/nbos/capi/modules/media/v0/media_details.rb +17 -0
  41. data/lib/idn_sdk_ruby/com/nbos/capi/modules/media/v0/media_file_details.rb +39 -0
  42. data/lib/idn_sdk_ruby/com/nbos/capi/modules/media/v0/media_ids_registry.rb +20 -0
  43. data/lib/idn_sdk_ruby/com/nbos/capi/modules/media/v0/media_info.rb +17 -0
  44. data/lib/idn_sdk_ruby/com/nbos/capi/modules/media/v0/media_remote_api.rb +47 -0
  45. data/lib/idn_sdk_ruby/version.rb +3 -0
  46. data/lib/idn_sdk_ruby.rb +33 -0
  47. metadata +201 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1b73222d0947191d5e3222d6c2268c7100e625cf
4
+ data.tar.gz: ebe42f6b336772af6e8a7245baf4b98a905f0cce
5
+ SHA512:
6
+ metadata.gz: a4ca1f8224bc1948fa062b57e9b945a54e3085419f91a7573956f736fe563c589810999c23367bc1ddfcda3873967d0ec945f46950b692ef216dc4330e114376
7
+ data.tar.gz: a34b584e4662f8e8aece9648cbe6b5b6663ba316f7190077551e229e25e0e225958060671f1515fe9351d6183ced4fdedf344093c20fe72eb14379d334e2e0ff
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /.idea/
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in idn_sdk_ruby.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 sekhar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # IdnSdkRuby
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/idn_sdk_ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'idn_sdk_ruby'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install idn_sdk_ruby
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/idn_sdk_ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "idn_sdk_ruby"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'idn_sdk_ruby/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "idn_sdk_ruby"
8
+ spec.version = IdnSdkRuby::VERSION
9
+ spec.authors = ["sekhar"]
10
+ spec.email = ["sekhar@nbostech.com"]
11
+
12
+ spec.summary = %q{Ruby Wrapper to Connect Wavelabs IDN API Server.}
13
+ spec.description = %q{This gem is to communicate with registered modules API in IDN server.}
14
+ spec.homepage = "http://wavelabs.in"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = Dir.glob("{bin,lib,spec}/**/*") + %w(LICENSE.txt README.md) + `git ls-files -z`.split("\x0")
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency 'httmultiparty', "0.3.16"
23
+ spec.add_dependency 'activemodel', "4.2.4"
24
+
25
+ spec.add_development_dependency "pry"
26
+ spec.add_development_dependency "byebug"
27
+ spec.add_development_dependency "minitest"
28
+ spec.add_development_dependency "rspec"
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.10"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ end
@@ -0,0 +1,25 @@
1
+ class IdnSdkRuby::Com::Nbos::Capi::Api::V0::AbstractApiContext < IdnSdkRuby::Com::Nbos::Capi::Api::V0::ApiContext
2
+ attr_accessor :name
3
+
4
+ @@apiContexts = {}
5
+
6
+ def initialize(name = nil)
7
+ @name = (name != nil && !name.empty?) ? name : "app"
8
+ end
9
+
10
+ def self.registerApiContext(apiContext)
11
+ @@apiContexts[apiContext.getName()] = apiContext
12
+ puts "Registered Contexts with API Context = >#{@@apiContexts}"
13
+ end
14
+
15
+ def self.get(name)
16
+ ctx = @@apiContexts[name]
17
+ if (ctx == nil)
18
+ ctx = IdnSdkRuby::Com::Nbos::Capi::Api::V0::InMemoryApiContext.new(name)
19
+ IdnSdkRuby::Com::Nbos::Capi::Api::V0::AbstractApiContext.registerApiContext(ctx)
20
+ end
21
+ return ctx
22
+ end
23
+
24
+ end #end of class
25
+
@@ -0,0 +1,50 @@
1
+ module IdnSdkRuby
2
+ module Com
3
+ module Nbos
4
+ module Capi
5
+ module Api
6
+ module V0
7
+ class ApiContext
8
+ # context name, this should give the ability to have as many contexts as possible
9
+ # 'app' context, 'api' context, etc..
10
+ def getName
11
+ end
12
+
13
+ #
14
+ #opportunity for the context to initialize itself, if it needs to read any properties from
15
+ #config files etc..
16
+ #
17
+ def init
18
+ end
19
+
20
+ def setHost(moduleName, host)
21
+ end
22
+
23
+ def getHost(moduleName)
24
+ end
25
+
26
+ def setClientCredentials(map)
27
+ end
28
+
29
+ def setClientToken(tokenApiModel)
30
+ end
31
+
32
+ def getClientCredentials
33
+ end
34
+
35
+ def getClientToken
36
+ end
37
+
38
+ def setUserToken(moduleName, tokenApiModel)
39
+ end
40
+
41
+ def getUserToken(moduleName)
42
+ end
43
+
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,26 @@
1
+
2
+ class IdnSdkRuby::Com::Nbos::Capi::Api::V0::IdnSDK
3
+
4
+ def self.init(apiContext)
5
+ IdnSdkRuby::Com::Nbos::Capi::Api::V0::AbstractApiContext.registerApiContext(apiContext)
6
+ if apiContext != nil
7
+ apiContext.init
8
+ puts "From IDN SDK Init => #{apiContext}"
9
+ end
10
+
11
+ begin
12
+ IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::IdentityIdsRegistry.new
13
+ IdnSdkRuby::Com::Nbos::Capi::Modules::Media::V0::MediaIdsRegistry.new
14
+ rescue Exception => e
15
+ puts "#{e.message}"
16
+ puts "#{e.backtrace}"
17
+ end
18
+
19
+ tokenApiModel = apiContext.getClientToken
20
+ if tokenApiModel == nil
21
+ identityApi = IdnSdkRuby::Com::Nbos::Capi::Modules::Ids::V0::Ids.getModuleApi("identity", apiContext.name)
22
+ identityApi.getClientToken
23
+ end
24
+ end
25
+
26
+ end
@@ -0,0 +1,57 @@
1
+
2
+ class IdnSdkRuby::Com::Nbos::Capi::Api::V0::InMemoryApiContext < IdnSdkRuby::Com::Nbos::Capi::Api::V0::AbstractApiContext
3
+ @@store = Hash.new
4
+ @@hosts = Hash.new
5
+ @@tokens = Hash.new
6
+
7
+ def initialize(name)
8
+ super(name)
9
+ end
10
+
11
+ def getName
12
+ return name
13
+ end
14
+
15
+
16
+ def getClientCredentials
17
+ return @@store["client.credentials"]
18
+ end
19
+
20
+ def setClientCredentials(map)
21
+ @@store["client.credentials"] = map
22
+ end
23
+
24
+ def setClientToken(tokenApiModel)
25
+ @@store["token.client"]=tokenApiModel
26
+ end
27
+
28
+ def getClientToken()
29
+ return @@store["token.client"]
30
+ end
31
+
32
+ def setUserToken(moduleName, tokenApiModel)
33
+ @@tokens[moduleName] = tokenApiModel
34
+ if (@@tokens.size == 0)
35
+ @@tokens["."]=tokenApiModel
36
+ end
37
+ end
38
+
39
+ def getUserToken(moduleName)
40
+ tokenApiModel = @@tokens[moduleName]
41
+ if (tokenApiModel == nil)
42
+ tokenApiModel = @@tokens["."]
43
+ end
44
+ return tokenApiModel
45
+ end
46
+
47
+
48
+ def setHost(moduleName, host)
49
+ @@hosts[moduleName] = host
50
+ end
51
+
52
+
53
+ def getHost(moduleName)
54
+ return @@hosts[moduleName]
55
+ end
56
+
57
+ end #end of class
@@ -0,0 +1,73 @@
1
+ class IdnSdkRuby::Com::Nbos::Capi::Api::V0::NetworkApi
2
+ attr_accessor :moduleName, :host, :sw, :apiContext, :remoteApiClass, :remoteApi
3
+
4
+ def initialize(host = nil, remoteApiClass = nil)
5
+ @host = host
6
+ @remoteApiClass = remoteApiClass
7
+ end
8
+
9
+ def getRemoteApi
10
+ end
11
+
12
+ def setApiContext(apiContext)
13
+ @apiContext = apiContext
14
+ end
15
+
16
+ def setHost(host)
17
+ @host = host
18
+ if host.end_with?("/")
19
+ @host = host.chomp("/")
20
+ end
21
+ end
22
+
23
+ def getModuleName
24
+ return @moduleName
25
+ end
26
+
27
+ def setModuleName(moduleName)
28
+ @moduleName = moduleName
29
+ end
30
+
31
+ def getHost()
32
+ return @host
33
+ end
34
+
35
+ def getSw()
36
+ return @sw
37
+ end
38
+
39
+ def setSw(sw)
40
+ @sw = sw
41
+ end
42
+
43
+ def getRemoteApiClass()
44
+ return @remoteApiClass
45
+ end
46
+
47
+ def setRemoteApiClass(remoteApiClass)
48
+ @remoteApiClass = remoteApiClass
49
+ end
50
+
51
+ def newRequest(api)
52
+
53
+ end
54
+
55
+ def get(request, callback)
56
+ end
57
+
58
+ def getRetrofitClient()
59
+ end
60
+
61
+ def getOkHttpClient()
62
+ end
63
+
64
+
65
+ def post(request)
66
+ return nil
67
+ end
68
+
69
+ def put(request)
70
+ return nil
71
+ end
72
+ end
73
+
@@ -0,0 +1,4 @@
1
+
2
+ class IdnSdkRuby::Com::Nbos::Capi::Api::V0::NetworkCallback
3
+ end
4
+
@@ -0,0 +1,54 @@
1
+ require 'json'
2
+
3
+ class IdnSdkRuby::Com::Nbos::Capi::Api::V0::TokenApiModel
4
+ attr_accessor :scope, :expires_in, :token_type, :refresh_token, :access_token
5
+
6
+ def initialize(parsed_response = nil)
7
+ if !parsed_response.nil?
8
+ @access_token = parsed_response["access_token"]
9
+ @token_type = parsed_response["token_type"]
10
+ @expires_in = parsed_response["expires_in"]
11
+ @scope = parsed_response["scope"]
12
+ @refresh_token = parsed_response["refresh_token"]
13
+ end
14
+ end
15
+
16
+ def getExpires_in()
17
+ return @expires_in
18
+ end
19
+
20
+ def getScope()
21
+ return @scope;
22
+ end
23
+
24
+ def getToken_type()
25
+ return @token_type
26
+ end
27
+
28
+ def getRefresh_token()
29
+ return @refresh_token
30
+ end
31
+
32
+ def getAccess_token()
33
+ return @access_token
34
+ end
35
+
36
+ def as_json(options={})
37
+ {
38
+ scope: @scope,
39
+ expires_in: @expires_in,
40
+ token_type: @token_type,
41
+ refresh_token: @refresh_token,
42
+ access_token: @access_token,
43
+ }
44
+ end
45
+
46
+ def to_json(*options)
47
+ as_json(*options).to_json(*options)
48
+ end
49
+
50
+ def to_s
51
+ to_json
52
+ end
53
+
54
+ end #end of class
@@ -0,0 +1,27 @@
1
+ module IdnSdkRuby
2
+ module Com
3
+ module Nbos
4
+ module Capi
5
+ module Modules
6
+ module Core
7
+ module V0
8
+ class ModuleApiModel
9
+ attr_accessor :uuid, :name
10
+
11
+ def getUuid()
12
+ return @uuid
13
+ end
14
+
15
+ def getName()
16
+ return @name
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,20 @@
1
+ require 'active_model'
2
+ module IdnSdkRuby
3
+ module Com
4
+ module Nbos
5
+ module Capi
6
+ module Modules
7
+ module Identity
8
+ module V0
9
+ class BasicActiveModel
10
+ include ActiveModel::Validations
11
+ include ActiveModel::Conversion
12
+ extend ActiveModel::Naming
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,43 @@
1
+ module IdnSdkRuby
2
+ module Com
3
+ module Nbos
4
+ module Capi
5
+ module Modules
6
+ module Identity
7
+ module V0
8
+ class EmailConnectApiModel
9
+ attr_accessor :id, :email, :primaryEmail, :verified
10
+
11
+ def initialize(parsed_response = nil)
12
+ if !parsed_response.nil?
13
+ @id = parsed_response["id"]
14
+ @email = parsed_response["email"]
15
+ @verified = parsed_response["verified"]
16
+ @primaryEmail = parsed_response["primaryEmail"]
17
+ end
18
+ end
19
+
20
+ def as_json(options={})
21
+ {
22
+ id: @id,
23
+ email: @email,
24
+ verified: @verified,
25
+ primaryEmail: @primaryEmail
26
+ }
27
+ end
28
+
29
+ def to_json(*options)
30
+ as_json(*options).to_json(*options)
31
+ end
32
+
33
+ def to_s
34
+ to_json
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end