Getting Started

Getting Started with Ruby

Contents

Introduction

Verizon Personal Cloud Storage SDK for Ruby allows you to develop apps for Ruby platform which can access Verizon Personal Cloud Storage user content (subject to the user’s prior approval).

Before You Begin

Before you can start coding, you will need to:

  1. Obtain Key, Secret, and Callback URL.
  2. Install and configure Personal Cloud Storage SDK for Ruby.

1. Obtain Key, Secret, and Callback URL

Key, Secret, and Callback URL are established during registration. If you have not yet registered, follow the steps on the Getting Credentials to Use the Personal Cloud Storage APIs page in the API Developer Guide to register.

2. Install and Configure Personal Cloud Storage SDK for Ruby

In order to download Verizon Personal Cloud Storage SDK for Ruby, you must log on to ThingSpace Developer Portal and accept Verizon terms and conditions. If you start downloading the file without logging on, the download will stop and you will be redirected to the log on screen. Download will resume after a successful log on.

Installation on MAC

Ruby Version Manager, RVM is a command-line tool which allows you to install, work with, and manage Ruby environments. If you already have RVM installed, update it to the latest version using the following code. Otherwise, follow the steps below to instll RVM.

$ rvm get stable --autolibs=enable

1. Install Ruby Version Manager.

  1. Ensure that your Mac user name does not contain spaces. If does, you must change your account name to remove spaces.
  2. Install RVM:

    $ \curl -L https://get.rvm.io | bash -s stable
    

    NOTES:

    • The backslash character before the word curl prevents potential version conflicts.
    • RVM includes an autolibs option to identify and install components needed for your operating system. RVM will update your system and install all required dependencies for installing Ruby on Mac OS X.
  3. Enter your Mac password if you see the following message during the installation:

    mkdir: /etc/openssl: Permission denied
    mkdir -p "/etc/openssl" failed, retrying with sudo
    your password required for 'mkdir -p /etc/openssl':
    
  4. If prompted, install Java SE 6 runtime for javac Java compiler.

  5. After installing RVM, close and reopen the Terminal window or enter the following command to refresh the terminal environment:

    $ source ~/.rvm/scripts/rvm
    
  6. If you have trouble installing RVM, you can use rvm implode command to remove all traces of RVM from your system (with exception of the changes RVM makes to your shell files such as .bash_profile). You can also contact RVM team for support using IRC, Internet Relay Chat. You will have to register before you will be able to acces the chat.

2. Install Ruby.

RVM does not update system Ruby. It uses your shell to intercept all calls to Ruby. There’s no need to remove the system Ruby because the RVM version takes precedence.

  1. Download recommended version of Ruby.
  2. To install the newest stable version, specify the version number as in the following example:

    $ rvm install ruby-2.3.1
    
  3. If prompted, enter your password.
    NOTE: Type carefully, as you will not see the characters you enter.

  4. Verify that the new version of Ruby is installed:

``` $ ruby -v ruby 2.3.1…


**3. Install ROR SDK.**

1. Place the code in the directory of your choice.
2. Verify that the directory structure looks like this:

    ```
    /mydirectory
  --examples
      -- web_file_browser.rb
  --lib
       -- client.rb
  -- changelog
--Gemfile
--Gemfile.lock
--License
--Readme
--api-sdk.gemspec
--connection.yml (Configuration or connection variables)
cd /opt/mydirectory
    ```

3. Enter the following command from the terminal root:

    ```
    gem install sinatra
  1. Perform the installation.

    gem install bundler
    
  2. Browse to the code directory and enter the following command:

    bundle install
    
  3. Change the directory to the example folder.

  4. Start the server:

    ruby web_file_browser.rb
    
  5. After the server has been started, you can access the app with the following:

    http://localhost:5000
    

SEE ALSO:

Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.