Socket
Book a DemoInstallSign in
Socket

globe_labs

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

globe_labs

0.0.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

globelabs

Ruby wrapper for GlobeLabs API

Add to Gemfile

gem 'globelabs'

then

$ bundle install

or

$ gem install globelabs

Usage

Initialize

require 'globelabs'

globelabs = GlobeLabs::Client.new(key: 'app_id', secret: 'app_secret', send_address: 'short_code')

Get Access Token

note: skip this part if you already have the access token

globelabs.get_access_token(code)

# =>
#  {
#    "access_token":"1ixLbltjWkzwqLMXT-8UF-UQeKRma0hOOWFA6o91oXw",
#    "subscriber_number":"9171234567"
#  }

Send Message

Send an SMS message to one or more mobile terminals:

globelabs.send_message(token, subscriber_number, message)

# =>
#  {
#   "outboundSMSMessageRequest": {
#     "address": "tel:+639175595283",
#     "deliveryInfoList": {
#       "deliveryInfo": [],
#       "resourceURL": "https://devapi.globelabs.com.ph/smsmessaging/v1/outbound/8011/requests?access_token=3YM8xurK_IPdhvX4OUWXQljcHTIPgQDdTESLXDIes4g"
#     },
#     "senderAddress": "8011",
#     "outboundSMSTextMessage": {
#       "message": "Hello World"
#     },
#     "receiptRequest": {
#       "notifyURL": "http://test-sms1.herokuapp.com/callback",
#       "callbackData": null,
#       "senderName": null,
#       "resourceURL": "https://devapi.globelabs.com.ph/smsmessaging/v1/outbound/8011/requests?access_token=3YM8xurK_IPdhvX4OUWXQljcHTIPgQDdTESLXDIes4g"
#     }
#   }
#  }

Locate

Locate a subscriber’s location:

globelabs.locate(token, subscriber_number)

# =>
#  {
#    "terminalLocationList": {
#      "terminalLocation": {
#        "address": "tel:9171234567",
#        "currentLocation": {
#          "accuracy": 100,
#          "latitude": "14.5609722",
#          "longitude": "121.0193394",
#          "map_url": "http://maps.google.com/maps?z=17&t=m&q=loc:14.5609722+121.0193394",
#          "timestamp": "Fri Jun 06 2014 09:25:15 GMT+0000 (UTC)"
#        },
#        "locationRetrievalStatus": "Retrieved"
#      }
#    }
#  }

Charge

Charge/bill a subscriber:

options = {
  amount: "20",
  description: "sample description",
  endUserId: "915xxxxxxx",
  reference_code: '1234567',
  transactionOperationStatus: 'Charged'
}

globelabs.charge(token, options)

# =>
#  {
#   "amountTransaction":
#   {
#     "endUserId": "9171234567",
#     "paymentAmount":
#     {
#       "chargingInformation":
#       {
#         "amount": "0.00",
#         "currency": "PHP",
#         "description": "my application"
#       },
#       "totalAmountCharged": "0.00"
#     },
#     "referenceCode": "12341000023",
#     "serverReferenceCode": "528f5369b390e16a62000006",
#     "resourceURL": null
#    }
#  }

Last Reference Code

In case you lost of track of your reference code:

globelabs.last_reference_code

# =>
# {
#    "referenceCode": "12341000005",
#    "status": "SUCCESS",
#    "shortcode": "21581234"
#  }

Contributing

  • Fork it ( https://github.com/jaemar/globelabs/fork )
  • Create your feature branch (git checkout -b feature/new_feature)
  • Commit your changes (git commit -am 'Add new feature')
  • Push to the branch (git push origin feature/new_feature)
  • Create a new Pull Request

FAQs

Package last updated on 12 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.