Using App42 Backend as a Service SDK in Ruby On Rails Project

App42 Ruby gem can be plugged in to Rails web application to give the power of App42 Backend as a Service.6 Using App42 Backend as a Service SDK in Ruby On Rails Project
To install the Ruby gem in to your Rails web application here are the steps to perform.

  • Download the latest App42_RUBY_SDK gem from App42 Cloud API Download Page
  • Install the Ruby gem using command
    1
    
     gem install App42_RUBY_SDK
  • Insert
    1
    
    gem 'App42_RUBY_SDK'

    line into your Rails project GemFile to include the App42 Gem into your project.

  • Run
    1
    
     bundle install

    in to your Rails project root directory to install the gem into your project.

After completing above configuration, your rails project is ready to use the App42 Ruby SDK.
To use various modules one needs to just inject the respective service. For e.g.
- To use the User Management Service and creating a new user you can do the following
// Initialize the Service with your API Key and Secret Key First
1
2
3
4
5
6
 $sp = App42::ServiceAPI.new("<API_KEY>","<SECRET_KEY>")
user = $sp.buildUserService()
userName = "app42"
email = "app42@shephertz.com"
password = "xyz"
createUserObj = user.create_user(userName, password, email)

Thats it!! Your user will be created in the cloud with just above snippet. - Using CDN File Upload

1
2
3
4
5
 upload = $sp.buildUploadService()
name = "<File_Name>"
type = App42::Upload::UploadFileType.new
targetFile = File.open('C://J.jpg', 'rb')
uploadObj = upload.upload_file(name,targetFile,type.enum("IMAGE"),"description")

The above code snippet will upload the File into App42 CDN network and will return the http url of uploaded file. When your user will access this uploaded file they will get served from nearby data center from there location. - Using Storage Service to save JSON Document in the cloud

1
2
3
4
5
storage = $sp.buildStorageService()
dbName = ""
collectionName = ""
jsonDocToBeSaved = "{'name':'app42','age':2, 'department':'xyz'}" // Json Doc which has to be saved in Cloud
storageObj = storage.insert_json_document(dbName, collectionName, jsonDocToBeSaved);

The above snippet will insert the JSON document in the cloud, you can do the CRUD operation on saved JSON document and can use Query Interface for Reading/Writing the target JSON document.

Checkout our 18+ modules ranging from Technical Services to Business Service i.e. File Upload User Session Management Email Message/Queue Gallery Storage Logging Recommendation Geo Spatial Gaming Review/Rating Shopping Cart/E-commerce Catalogue Image Processor Social You can read further about detail usage of each service on App42 Ruby Cloud SDK Page

more on pricing Using App42 Backend as a Service SDK in Ruby On Rails Projectget started Using App42 Backend as a Service SDK in Ruby On Rails Project
twitter Using App42 Backend as a Service SDK in Ruby On Rails Projectfacebook Using App42 Backend as a Service SDK in Ruby On Rails Projectgoogle Using App42 Backend as a Service SDK in Ruby On Rails Projectlinkedin Using App42 Backend as a Service SDK in Ruby On Rails Projectpinterest Using App42 Backend as a Service SDK in Ruby On Rails Projectreddit Using App42 Backend as a Service SDK in Ruby On Rails Projectstumbleupon Using App42 Backend as a Service SDK in Ruby On Rails Projecttumblr Using App42 Backend as a Service SDK in Ruby On Rails Project

Leave a Reply

Your email address will not be published. Required fields are marked *


seven − 3 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>