Skip to content
Provides resources for developers using Nexmo API platforms
HTML CSS JavaScript Ruby Vue Shell
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Update all actions with trigger conditions Sep 7, 2019
.repos Add Node code snippets for Conversation API (#2188) Nov 20, 2019
_api Add OAS3 pricing API (#2154) Nov 15, 2019
_code Update voice_proxy.js Oct 30, 2018
_documentation/en Delivery receipt clarification (#2185) Nov 21, 2019
_examples Merge branch 'master' into tony-dc-improve Nov 20, 2019
_extend Sammachin lex shutdown (#1700) May 15, 2019
_modals/api Add en-US spell checker Jul 3, 2019
_open_api API Specification Update (#2190) Nov 19, 2019
_partials Linking a Facebook Page to a Nexmo application (#2081) Oct 22, 2019
_tutorials/en Reorganize Client SDK tutorial material into sub-folder (#2199) Nov 21, 2019
_tutorials_tabbed_content/client-sdk iOS ClientSDK - setup page refactoring (#2161) Nov 13, 2019
_use_cases/en I18n v1 (#2046) Nov 20, 2019
app Cache sidenav (#2133) Nov 21, 2019
bin Upgrade webpack, dependencies, binstubs and config. Apr 18, 2019
config Cache sidenav (#2133) Nov 21, 2019
db add migration and initializer files Oct 22, 2019
lib Cache sidenav (#2133) Nov 21, 2019
log Init Feb 6, 2017
public pointing iOS docs to the latest version Nov 20, 2019
spec Cache sidenav (#2133) Nov 21, 2019
tmp Init Feb 6, 2017
vendor/assets Prevent tabs to be focused by default and making the page scroll. Nov 7, 2019
.disallowed_words Add support for a list of disallowed words Oct 28, 2019
.dockerignore Ignore public/packs Oct 5, 2017
.editorconfig created editorconfig Apr 4, 2017
.env.example Update README.md and config/database.yml. (#2147) Nov 12, 2019
.eslintrc.js Add ESLint + Change concatenation tool to understand safe characters Oct 23, 2017
.gitignore Volta (#825) Oct 18, 2018
.gitmodules Remove Client SDK submodules Jun 3, 2019
.nvmrc Upgrades to Node 12 to fix Webpacker error (#2026) Oct 8, 2019
.postcssrc.yml Upgrade webpacker 2.0 -> 3.0 Sep 25, 2017
.pre-commit-config.yaml adding pre-commit hooks Jul 19, 2017
.rspec Add rspec Mar 22, 2017
.rubocop.yml Rubocop: Double negation is allowed when converting return values Jul 3, 2019
.ruby-version Upgrade ruby version to 2.5.7 Oct 3, 2019
.spelling Update JS Release Notes for v6.0.5 (#2192) Nov 21, 2019
.travis.yml I18n v1 (#2046) Nov 20, 2019
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Jun 23, 2017
CONTRIBUTING.md Fix CONTRIBUTING.md nested list rendering (#1169) Oct 30, 2018
Dockerfile Update Dockerfile to match the required node version. Oct 21, 2019
Gemfile I18n v1 (#2046) Nov 20, 2019
Gemfile.lock I18n v1 (#2046) Nov 20, 2019
Guardfile Code Style Fixes (Rubocop) (#902) Aug 22, 2018
LICENSE.md Add CONTRIBUTING and LICENSE files, tidy README Aug 10, 2018
LICENSE.txt Update License Year (#1150) Oct 23, 2018
Procfile Cache sidenav (#2133) Nov 21, 2019
README.md I18n v1 (#2046) Nov 20, 2019
Rakefile Init Feb 6, 2017
app.json Fix docker-compose and update app.json and .env.example with the new Oct 29, 2019
babel.config.js Remove React's config and dependencies. Sep 30, 2019
config.ru Init Feb 6, 2017
docker-compose.yml Fix docker-compose and update app.json and .env.example with the new Oct 29, 2019
github_deploy_key.enc Add key Oct 5, 2017
package.json Upgrades to Node 12 to fix Webpacker error (#2026) Oct 8, 2019
yarn.lock Add fetchmock configs and flushpromises. Sep 30, 2019

README.md

Nexmo Developer

Build Status MIT licensed

This repository is the code and content for https://developer.nexmo.com, which includes the Nexmo documentation, API reference, SDKs, Tools & Community content. To get a Nexmo account, sign up for free at nexmo.com.

Testing · Running Locally · Admin Dashboard · Troubleshooting · Contributing · License

Testing

We use rspec to test Nexmo Developer.

To run all tests:

bundle exec rspec

To generate code coverage, set the COVERAGE environment variable when running the tests.

COVERAGE=1 bundle exec rspec

This will create a folder named coverage. Open index.html in this folder to view coverage statistics.

Spell Checking

We write the docs in US English and enforce this at build time with a CI check. You can run the check locally using the following command:

./node_modules/.bin/mdspell -r -n -a --en-us '_documentation/en/**/*.md' '_partials/*.md' '_partials/**/*.md' '_modals/**/*.md' '_tutorials/**.md'

If there is a word that isn't in the dictionary but is correct to use, add it to the .spelling file (there's a lot of exceptions in there, including Nexmo!)

Running locally

The project can be run on your laptop, either directly or using Docker. These instructions have been tested for Mac.

Setup for running directly on your laptop

Before you start, you need to make sure that you have:

System Setup (OSX)

Install Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install required packages, create database and configure git.

Note: A default database is created for you when you run the db:setup script. If you'd like to create and use a different database or user, use createdb database_name_here or createuser username_here and make sure your .env file is updated accordingly (See .env.example).

brew install postgres rbenv git yarn nvm redis
brew services start postgresql
brew services start redis


git config --global user.name "NAME"
git config --global user.email "user.name@vonage.com"

Generate an SSH key for authentication

ssh-keygen -t rsa
cat .ssh/id_rsa.pub # Add to Github

Clone NDP to your local machine

git clone git@github.com:Nexmo/nexmo-developer.git
cd nexmo-developer
cp .env.example .env

Add to ~/.bash_profile (or equivalent file on your system):

eval "$(rbenv init -)"
export NVM_DIR="$HOME/.nvm"
. "/usr/local/opt/nvm/nvm.sh"

Install the correct versions of ruby and node

rbenv install 2.5.7
rbenv global 2.5.7
gem install bundle
bundle install
nvm install 12
nvm use 12

yarn install

Edit the .env file as appropriate for your platform. Then, run the following:

Install project dependencies, run database migrations and start the server

bundle install
bin/rails db:setup
bin/yarn install
bin/rails s

You should now be able to see the site on http://localhost:3000/

Setting up with Docker

If you don't want to install Ruby & PostgreSQL then you can use docker to sandbox Nexmo Developer into its own containers. After you Install Docker run the following:

$ git clone git@github.com:Nexmo/nexmo-developer.git
$ cd nexmo-developer
$ cp .env.example .env

Edit the .env file as appropriate for your platform. Then, start the web server with this command:

$ docker-compose up

At this point, open your browser to http://localhost:3000/ ... and wait (it takes about 30 seconds for the first load).

To stop the server cleanly run:

$ docker-compose down

Admin dashboard

You can access the admin dashboard by visiting /admin. If you've populated data via rake db:seed you will have an admin user with the username of admin@nexmo.com and password of development.

The following is an example if you are running Nexmo Developer within a Docker container:

docker exec -it <container_id> rake db:seed

New admin users can be created by visiting /admin/users or by accessing the rails console and creating a new User like so:

User.create!(email: 'example@example.com', password: 'password', admin: true)

Working with submodules

Some of the contents of NDP are brought in via git submodules, such as the Open API Specification (OAS) documents. A submodule is a separate repository used within the main repository (in this case NDP) as a dependency. The main repository holds information about the location of the remote repository and which commit to reference. So to make a change within a submodule, you need to commit to the submodule and the main repository and crucially remember to push both sets of changes to GitHub.

Here are some tips for working with submodules:

When cloning the repo or starting to work with submodules

git submodule init
git submodule update

When pulling in changes to a branch e.g. updating master

git pull
git submodule update

When making changes inside the submodule within NDP

Make sure you are inside the directory that is a submodule.

  • make your changes
  • commit your changes
  • push your changes from here (this is the bit that normally trips us up)
  • open a pull request on the submodule's repository - we can't open the PR on the main repo until this is merged

You are not done, keep reading! A second pull request is needed to update the main repo, including any other changes to that repo and an update to the submodule pointing to the new (merged) commit to use.

  • open your PR for this change including any changes to the main project (so we don't lose it) but label it "don't merge" and add the URL of the submodule PR we're waiting for
  • once the submodule has the change you need on its master branch, change into the subdirectory and git pull
  • change directory back up to the root of the project
  • commit the submodules changes
  • push these changes too
  • Now we can review your PR

Bringing submodule changes into NDP

If you made changes on the repo outside of NDP, then you will need to come and make a commit on NDP to update which commit in the submodule the NDP repository is pointing to.

Make a branch, change into the submodule directory and git pull or do whatever you need to do to get HEAD pointing to the correct commit. In the top level of the project, add the change to the submodules file and commit and push. Then open the pull request as you would with any other changes.

Further advice and resources for successful submodule usage

Never git add . this is lazy practice anyway but will make bad things happen with submodules. Try git add -p instead. You're welcome.

If you're not sure what to do, ask for help. It's easier to lend a hand along the way than to rescue it later!

Git docs for submodules: https://git-scm.com/book/en/v2/Git-Tools-Submodules

A flow chart on surviving submodules from @lornajane: https://lornajane.net/posts/2016/surviving-git-submodules

Troubleshooting

I'm having issues with my Docker container

The image may have changed, try rebuilding it with the following command:

$ docker-compose up --build

I get an exception PG::ConnectionBad - could not connect to server: Connection refused when I try to run the app.

This error indicates that PostgreSQL is not running. If you installed PostgreSQL using brew you can get information about how to start it by running:

$ brew info postgresql

Once PostgreSQL is running you'll need to create and migrate the database. See Setup for instructions.

Upgrading Volta

Volta is the Vonage design system, and is used to style Nexmo Developer. To upgrade the version of Volta used:

  • Clone Volta on to your local machine
  • Remove the app/assets/volta/scss folder in Nexmo Developer
  • Copy the scss folder from the Volta repo in to app/assets/volta
  • Commit and push. Rails will take care of compilation etc

Contributing

We ❤️ contributions from everyone! It is a good idea to talk to us first if you plan to add any new functionality. Otherwise, bug reports, bug fixes and feedback on the library is always appreciated. Look at the Contributor Guidelines for more information and please follow the GitHub Flow.

contributions welcome GitHub contributors

License

This library is released under the MIT License

You can’t perform that action at this time.