0.0
No commit activity in last 3 years
No release in over 3 years
Enable users to import any analog media format directly into your app with the Analog Bridge API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 0.10.3
~> 10.0
~> 3.0
~> 2.0

Runtime

 Project Readme

Analog Bridge

Build Status Code Climate Gem Version

Analog Bridge is comprised of a JavaScript client and REST API which enables your users to import analog media directly into your app or website.

Installation

Add this line to your application's Gemfile:

gem "analogbridge"

And then execute:

$ bundle install

Or install it yourself as:

$ gem install analogbridge

Configure

Once you have your API Keys from Analog Bridge, you can initialize your configuration with your secret_key as

AnalogBridge.configure do |config|
  config.secret_key = "YOUR_SECRET_KEY"
end

Or

AnalogBridge.configuration.secret_key = "YOUR_SECRET_KEY"

Usage

Customer

Create Customer

To create a new customer using the API, usage

AnalogBridge::Customer.create(
  email: "demo@analogbridge.io",
  shipping: {
    first_name: "John",
    last_name: "Smith",
    address1: "3336 Commercial Ave",
    city: "Northbrook",
    state: "IL",
    zip: "60062",
    phone: "800-557-3508",
    email: "demo@analogbridge.io"
  },
  metadata: {
    user_id: "123456",
  }
)

Retrieve a Customer

We can easily retrieve a customer's details using their customer_id, for example to find a customer with details with id cus_12345678

AnalogBridge::Customer.find("cus_12345678")

Retrieve all customers

Analog Bridge provides an interface to retrieve all your customers very easily. To retrieve all of your customers, you can use

AnalogBridge::Customer.list(limit: 20, offset: 100)

Update a customer

Update an existing customer's information by using the cus_id from customer creation. Any unprovided parameters will have no effect on the customer object. The arguments for this call are mainly the same as for the customer creation call.

AnalogBridge::Customer.update(
  "cus_123456789",
  email: "newemail@analogbridge.io"
)

Delete a customer

If we need to delete a customer, for example id cus_123456789, then we can use

AnalogBridge::Customer.delete("cus_123456789")

Order

List all orders

The Analog Bridge API allow us to retrieve all orders by a specific customer. For example we want to retrieve all orders by customer id cus_12345678, we can use

AnalogBridge::Order.where(customer_id: "cus_12345678")

List order details

If we need to retrieve the details for a specific order then we can use

AnalogBridge::Order.where(
  order_id: "order_12345678",
  customer_id: "cus_12345678"
)

Retrieve import ready orders

Once customer orders have been processed and uploaded to our Cloud, they are import-ready for your system. To retrieve the list of import ready orders, we can use

AnalogBridge::Order.import_ready

Product

Listing products

To retrieve the products simply use the following interface

AnalogBridge::Product.list

Development

We are following Sandi Metz's Rules for this gem, you can read the [description of the rules here] (http://robots.thoughtbot.com/post/50655960596/sandi-metz-rules-for-developers). All new code should follow these rules. If you make changes in a pre-existing file that violates these rules you should fix the violations as part of your contribution.

Setup

Clone the repository.

git clone https://github.com/analogbridge/analog-bridge-ruby

Setup your environment.

bin/setup

Run the test suite

bin/rspec

PlayBox

Setup API keys.

cp .sample.pryrc .pryrc
vim .pryrc

Start your console.

bin/console

Start playing with it.

AnalogBridge::Customer.list

Contributing

First, thank you for contributing! We love pull requests from everyone. By participating in this project, you hereby grant the right to grant or transfer an unlimited number of non exclusive licenses or sub-licenses to third parties, under the copyright covering the contribution to use the contribution by all means.

Here are a few technical guidelines to follow:

  1. Open an issue to discuss a new feature.
  2. Write tests to support your new feature.
  3. Make sure the entire test suite passes locally and on CI.
  4. Open a Pull Request.
  5. Squash your commits after receiving feedback.
  6. Party!

License

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