CloudRail


Source link: https://github.com/CloudRail/cloudrail-si-android-sdk

CloudRail SI for Android

Integrate Multiple Services With Just One API

CloudRail is an API integration solution which abstracts multiple APIs from different providers into a single and universal interface.

Current Interfaces:



Full documentation can be found at our website.

Learn more about CloudRail on https://cloudrail.com



With CloudRail, you can easily integrate external APIs into your application. CloudRail is an abstracted interface that takes several services and then gives a developer-friendly API that uses common functions between all providers. This means that, for example, upload() works in exactly the same way for Dropbox as it does for Google Drive, OneDrive, and other Cloud Storage Services, and getEmail() works similarly the same way across all social networks.

Download

Just add the dependency to your project build.gradle file:

dependencies {

  compile 'com.cloudrail:cloudrail-si-android:2.21.1' 
}

via Maven Central

Current Interfaces

Interface Included Services
Cloud Storage Dropbox, Google Drive, OneDrive, Box, Egnyte, OneDrive Business
Business Cloud Storage AmazonS3, Microsoft Azure, Rackspace, Backblaze, Google Cloud Platform
Social Profiles Facebook, GitHub, Google+, LinkedIn, Slack, Twitter, Windows Live, Yahoo, Instagram, Heroku
Social Interaction Facebook, FacebookPage, Twitter
Payment PayPal, Stripe
Email Maljet, Sendgrid
SMS Twilio, Nexmo
Point of Interest Google Places, Foursquare, Yelp
Video YouTube, Twitch, Vimeo
Messaging Facebook Messenger, Telegram, Line, Viber

Cloud Storage Interface:

  • Dropbox
  • Box
  • Google Drive
  • Microsoft OneDrive
  • Egnyte
  • OneDrive Business

Features:

  • Download files from Cloud Storage.
  • Upload files to Cloud Storage.
  • Get Meta Data of files, folders and perform all standard operations (copy, move, etc) with them.
  • Retrieve user and quota information.
  • Generate share links for files and folders.

Full Documentation

Code Example:

CloudRail.setAppKey("[CloudRail License Key]");
  // CloudStorage cs = new Box(context, "[clientIdentifier]", "[clientSecret]");
 // CloudStorage cs = new OneDrive(context, "[clientIdentifier]", "[clientSecret]");
 // CloudStorage cs = new GoogleDrive(context, "[clientIdentifier]", "", "[redirectUri]", "[state]");
 CloudStorage cs = new Dropbox(context, "[clientIdentifier]", "[clientSecret]");
 new Thread() {

  @Override
  public void run() {

cs.createFolder("/TestFolder");
 // <---

InputStream stream = null;

try {

 AssetManager assetManager = getAssets();

 stream = assetManager.open("UserData.csv");

 long size = assetManager.openFd("UserData.csv").getLength();

 cs.upload("/TestFolder/Data.csv", stream, size, false);
 // <---

}
 catch (Exception e) {

 // TODO: handle error

}
 finally {

 // TODO: close stream

}

  
}
 
}
.start();

Business Cloud Storage Interface:

  • Amazon S3
  • Microsoft Azure
  • Rackspace
  • Backblaze
  • Google Cloud Platform

Features:

  • Create, delete and list buckets
  • Upload files
  • Download files
  • List files in a bucket and delete files
  • Get file metadata (last modified, size, etc.)

Full Documentation

Code Sample

CloudRail.setAppKey("[CloudRail License Key]");

// BusinessCloudStorage cs = new MicrosoftAzure(context, "[accountName]", "[accessKey]");
 // BusinessCloudStorage cs = new Rackspace(context, "[username]", "[apiKey]", "[region]");
 // BusinessCloudStorage cs = new Backblaze(context, "[accountId]", "[appKey]");
 // BusinessCloudStorage cs = new GoogleCloudPlatform(context, "[clientEmail]", "[privateKey]", "[projectId]");
 BusinessCloudStorage cs = new AmazonS3(context, "[accessKeyId]", "[secretAccessKey]", "[region]");
  new Thread() {

  @Override
  public void run() {

Bucket bucket cs.createBucket("testbucket");

// Loads a file from the application's assets and uploads it  AssetManager assetManager = getAssets();
  InputStream stream = assetManager.open("UserData.csv");
  long size = assetManager.openFd("UserData.csv").getLength();
  storage.uploadFile(bucket, "Data.csv", stream, size);
  Log.i("info", "Upload successfully finished");

  
}
 
}
.start();

Social Media Profiles Interface:

  • Facebook
  • Github
  • Google Plus
  • LinkedIn
  • Slack
  • Twitter
  • Windows Live
  • Yahoo
  • Instagram
  • Heroku

Features

  • Get profile information, including full names, emails, genders, date of birth, and locales.
  • Retrieve profile pictures.
  • Login using the Social Network.

Full Documentation

Code Example:

CloudRail.setAppKey("[CloudRail License Key]");

// final Profile profile = new GooglePlus(this, "[clientIdentifier]", "[clientSecret]");
 // final Profile profile = new GitHub(this, "[clientIdentifier]", "[clientSecret]");
 // final Profile profile = new Slack(this, "[clientIdentifier]", "[clientSecret]");
 // final Profile profile = new Instagram(this, "[clientIdentifier]", "[clientSecret]");
 // ... final Profile profile = new Facebook(this, "[clientIdentifier]", "[clientSecret]");
 new Thread() {

  @Override
  public void run() {

String fullName = profile.getFullName();

String email = profile.getEmail();

// ...
  
}
 
}
.start();

Social Media Interaction Interface:

  • Facebook
  • FacebookPage
  • Twitter

Features

  • Get a list of connections.
  • Make a post for the user.
  • Post images and videos.

Full Documentation

Code Example:

CloudRail.setAppKey("[CloudRail License Key]");

// final Social social = new Twitter(this, "[clientID]", "[clientSecret]");
 // final Social social = new FacebookPage(this, "[pageName]", "[clientID]", "[clientSecret]");
 final Social social = new Facebook(this, "[clientID]", "[clientSecret]");
 new Thread() {

  @Override
  public void run() {

social.postUpdate("Hey there! I'm using CloudRail.");

List<String> connections = social.getConnections();

// ...
  
}
 
}
.start();

Payment Interface:

  • PayPal
  • Stripe

Features

  • Perform charges
  • Refund previously made charges
  • Manage subscriptions

Full Documentation

Code Example

CloudRail.setAppKey("[CloudRail License Key]");

// final Payment payment = new Stripe(this, "[secretKey]");
 final Payment payment = new PayPal(this, true, "[clientIdentifier]", "[clientSecret]");
 new Thread() {

  @Override
  public void run() {

CreditCard source = new CreditCard(null, 6L, 2021L, "xxxxxxxxxxxxxxxx", "visa", "<FirstName>", "<LastName>", null);

Charge charge = payment.createCharge(500L, "USD", source);

Log.i("info", "Charge: " + charge.toString());

}
 
}
.start();

Email Interface:

  • Mailjet
  • Sendgrid

Features

  • Send Email

Full Documentation

Code Example

CloudRail.setAppKey("[CloudRail License Key]");

// final Email email = new Mailjet(this, "[clientID]", "[clientSecret]");
 final Email email = new Sendgrid(this, "[username]", "[password]");
 new Thread() {

  @Override
  public void run() {

email.sendEmail("[email protected]", "CloudRail", Arrays.asList("[email protected]", "[email protected]"), "Welcome", "Hello from CloudRail", null, null, null);

  
}
 
}
.start();

SMS Interface:

  • Twilio
  • Nexmo
  • Twizo

Features

  • Send SMS

Full Documentation

Code Example

CloudRail.setAppKey("[CloudRail License Key]");

// final SMS sms = new Nexmo(this, "[clientIdentifier]", "[clientSecret]");
 final SMS sms = new Twilio(this, "[clientIdentifier]", "[clientSecret]");
 new Thread() {
 @Override
  public void run() {

sms.sendSMS("CloudRail", "+4912345678", "Hello from CloudRail");

  
}
 
}
.start();

Points of Interest Interface:

  • Google Places
  • Foursquare
  • Yelp

Features

  • Get a list of POIs nearby
  • Filter by categories or search term

Full Documentation

Code Example

CloudRail.setAppKey("[CloudRail License Key]");

// final PointsOfInteres poi = new Foursquare(this, "[clientID]", "[clientSecret]");
 // final PointsOfInteres poi = new Yelp(this, "[consumerKey]", "[consumerSecret]", "[token]", "[tokenSecret]");
 final PointsOfInteres poi = new GooglePlaces(this, "[apiKey]");
 new Thread() {

  @Override
  public void run() {

List<POI> res = poi.getNearbyPOIs(49.4557091, 8.5279138, 1000L, "restaurant", null);

Log.i("info", "POIs: " + res.toString());

}
 
}
.start();

Video Interface:

  • YouTube
  • Twitch
  • Vimeo

Features

  • Get channel metadata
  • List videos for a channel
  • Get video metadata
  • Search for videos
  • Upload a video

Full Documentation

Code Example

CloudRail.setAppKey("[CloudRail License Key]");

// final Video video = new Twitch(this, "[clientID]", "[clientSecret]");
 // final Video video = new Vimeo(this, "[clientID]", "[clientSecret]");
 final Video video = new YouTube(this, "[clientID]", "", "com.cloudrail.example:/auth", "state");
 new Thread() {

  @Override
  public void run() {

List<VideoMetaData> res = video.searchVideos("CloudRail", 0L, 50L);

Log.i("info", "Videos: " + res.toString());

}
 
}
.start();

Messaging Interface:

  • Facebook Messenger
  • Telegram
  • Line
  • Viber

Features

  • Send text messages
  • Send files, images, videos and audios
  • Parse a message received on your webhook
  • Download the content of an attachment sent to your webhook

Full Documentation

Code Example

CloudRail.setAppKey("[CloudRail License Key]");

// final Messaging messaging = new Line(this, "[BotToken]");
 // final Messaging messaging = new Telegram(this, "[BotToken]", "[WebhookUrl]");
 // final Messaging messaging = new Viber(this, "[BotToken]", "[WebhookUrl]", "[BotName]");
 final Messaging messaging = new FacebookMessenger(this, "[BotToken]");
 new Thread() {

  @Override
  public void run() {

Message res = messaging.sendMessage("92hf2f83f9", "Greetings from CloudRail!");

Log.i("info", "Message: " + res.toString());

}
 
}
.start();

More interfaces are coming soon.

Advantages of Using CloudRail

  • Consistent Interfaces: As functions work the same across all services, you can perform tasks between services simply.

  • Easy Authentication: CloudRail includes easy ways to authenticate, to remove one of the biggest hassles of coding for external APIs.

  • Switch services instantly: One line of code is needed to set up the service you are using. Changing which service is as simple as changing the name to the one you wish to use.

  • Simple Documentation: There is no searching around Stack Overflow for the answer. The CloudRail documentation at https://cloudrail.com/integrations is regularly updated, clean, and simple to use.

  • No Maintenance Times: The CloudRail Libraries are updated when a provider changes their API.

  • Direct Data: Everything happens directly in the Library. No data ever passes a CloudRail server.

Maven

You can find the dependency for the latest version on Maven Central

Sample Applications

If you don't know how to start or just want to have a look at how to use our SDK in a real use case, we created a few sample application which you can try out:

License Key

CloudRail provides a developer portal which offers usage insights for the SDKs and allows you to generate license keys.

It's free to sign up and generate a key.

Head over to https://cloudrail.com/signup

Pricing

Learn more about our pricing on https://cloudrail.com/pricing

Other Platforms

CloudRail is also available for other platforms like iOS, Java and NodeJS. You can find all libraries on https://cloudrail.com

Questions?

Get in touch at any time by emailing us: [email protected]

or

Tag a question with cloudrail on StackOverflow

Resources

Simplest way to get all images based on date, name, id, and other customizations.

A Magic library to take photos and select pictures in Android. In a simple way and if you need it also save the pictures in device.

A simple wrapper around most Firebase functions with RxJava.

Fluent mockito.

Gradle Plugin to check library licenses and generate license pages.

A sweeter Espresso. Never write your own IdlingResource again. Never manually turn off system animations again.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes