Project

moceansdk

0.0
No commit activity in last 3 years
No release in over 3 years
Mocean SDK for Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0.1.10
~> 5.0
~> 13.0
~> 3.6

Runtime

~> 2.4
>= 3, < 5
 Project Readme

MoceanAPI Client Library for Ruby

Gem Version build status Github build status codecov codacy MIT license total downloads

This is the Ruby client library for use Mocean's API. To use this, you'll need a Mocean account. Sign up for free at moceanapi.com.

  • Installation
  • Usage
  • Example

Installation

To use the client library you'll need to have created a Mocean account.

To install the Ruby client library using Gem.

gem install moceansdk

Usage

Create a client with your API key and secret:

require 'moceansdk'

credential = Moceansdk::Auth::Basic.new("API_KEY_HERE", "API_SECRET_HERE")
mocean = Moceansdk::Client.new(credential)

Example

To use Mocean's SMS API to send an SMS message, call the mocean.sms.send() method.

The API can be called directly, using a simple array of parameters, the keys match the parameters of the API.

res = mocean.sms.send({
    "mocean-text": 'Hello World',
    "mocean-from": 'MOCEAN',
    "mocean-to": '60123456789'
})

puts res

Responses

For your convenient, the API response has been parsed to Hash using hash_dot package.

puts res           # show full response string
puts res.status    # show response status, '0' in this case
puts res['status'] # same as above

Documentation

Kindly visit MoceanApi Docs for more usage

License

This library is released under the MIT License