Code Monkey home page Code Monkey logo

emmaruby's Introduction

Emma API Wrapper (Ruby)

A Ruby wrapper for Emma's API.

Running the tests Build Status

Set the following environment values

export EMMA_ACCOUNT_ID=123456
export EMMA_PUBLIC_KEY=6fbfd5e68d3306e51350
export EMMA_PRIVATE_KEY=53f42aa48e24d44a3362

Run the tests

bundle exec rake run_tests

Installation

Add this line to your application's Gemfile:

gem 'emma'

And then execute:

$ bundle

Or install it yourself as:

$ gem install emma

Usage

Instantiation

require 'emma'
em = Emma::Setup.new 'account_id', 'public_key', 'private_key', 'debug_true_or_false'

You can also set environment variables and the Emma Wrapper will use them when you create an instance

ENV['EMMA_ACCOUNT_ID'] = 'account_id'
ENV['EMMA_PUBLIC_KEY'] = 'public_key'
ENV['EMMA_PRIVATE_KEY'] = 'private_key'
em = Emma::Setup.new

GET Request

req = em.my_members
# Will return a members array
puts req.inspect

Pagination

req = em.my_members count: true
# Will return a count of all of the members tied to your account
puts req.inspect
req = em.my_members start: 0, end: 200
# Will return a members array starting with the specified start param and ending with the specified end param
puts req.inspect

POST Request

req = em.add_member email: "[email protected]", fields: { first_name: 'hello', last_name: 'world' }
# Will return a reference object of the newly added member
puts req.inspect

PUT Request

req = em.update_member 111, status: 'e'
# Will return true if the member was updated
puts req.inspect

DELETE Request

req = em.remove_member 111
# Will return true if the member was deleted
puts req.inspect

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

emmaruby's People

Contributors

jbynum avatar 2lambda123 avatar tsclausing avatar dependabot[bot] avatar brandon-lyons avatar dennismonsewicz avatar ericboehs avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.