Skip to content

A gem for communicating with the CLX Rest API. Made for 7send.

License

Notifications You must be signed in to change notification settings

standout/clx-rest-api

Repository files navigation

CLXRestAPI

Made for creating easy integration with the CLX Rest API. You can find their API documentation here.

Installation

Add this line to your application's Gemfile:

gem 'clx_rest_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install clx_rest_api

Configuration

To use the API you need a service plan id and a token. Use the configuration block to set these.

CLXRestAPI.configure do |config|
  config.service_plan_id = "my_service_plan_id"
  config.api_token = "my_api_token"
end

Usage

To use the API create an instance of the CLXRestAPI::Client class. You can send a request to an endpoint like this:

client = CLXRestAPI::Client.new
client.send_batch_message(params: {})

This returns a CLXRestAPI::Response instance.

# Contains the response body parsed from JSON
response.body

# Contains a Net::HTTP response for further debugging
response.original_response

Available endpoints

As of now these are the available endpoints:

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rspec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

To define a new endpoint for the client you can use the provided DSL:

define_endpoint :my_endpoint, :get, "/my_url/:my_param/

:my_param will be fetched from the arguments provided when doing the method call.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/standout/clx_rest_api.

License

The gem is available as open source under the terms of the MIT License.

About

A gem for communicating with the CLX Rest API. Made for 7send.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published