Coder Social home page Coder Social logo

mini_stitch's Introduction

Ruby Wrapper for Stitch Data's Import API

The Stitch Import API is a REST API that allows you to push arbitrary data into your data warehouse. Once the data enters the Import API, it’ll be processed and sent through Stitch like data from any other integration.

Setup

α) include the gem

Rails:

gem 'stitch_data', github: 'theminijohn/mini_stitch'
β) Authentication

Authentication with the Import API is done with a single API access token placed in the Authorization header of your request and your client ID, which will be used in the request body.

# initializers/mini_stitch.rb
MiniStitch.configure do |config|
  config.token = "your-api-token"
  config.client_id = "your-client-id"
end

Usage

I recommend you take a look at the Stitch Data Import Api Doc to get the gist of what the upsert, validate & status methods do. Yes, this gem has only 3 methods ☀️

!! For the Wrapper to successfully accept and process your data, your call must contain all of the request fields listed below:

  • table_name | String This field contains the name of the destination table

  • sequence | String This property tells the Import API the order in which data points in the request body should be considered. See Defining Sequence for more info. The most straightforward way is to use Time.now.to_i to get the current time in posix format.

  • key_names | Array | 🔑 This field defines the Primary Key and will contain an array of field names that uniquely identify the row that the record belongs to. Primary Keys identify unique rows within a table and ensure that only the most recently updated version of that record appears in your data warehouse.

  • data | Array of Hashes This field contains the data to be upserted into your data warehouse.

  1. Status

The status endpoint can be used to determine if the Import API is operating correctly.

MiniStitch.status
  1. Validate

The validate endpoint can be used to validate requests but will not persist them to Stitch

MiniStitch::Api.new(table_name, sequence, [key_names], [data]).validate!
  1. Upsert

The upsert endpoint is used to push data into your data warehouse.

MiniStitch::Api.new(table_name, sequence, [key_names], [data]).upsert!

mini_stitch's People

Contributors

danishmughal avatar theminijohn avatar

Watchers

 avatar  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.