Project

statwing

0.0
No commit activity in last 3 years
No release in over 3 years
Provides easy access to the statwing api for Ruby applications
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 0.10
~> 10.0

Runtime

~> 0.7
 Project Readme

Statwing

Build Status

Ruby wrapper for the Statwing Api. This is accomplished using the HER Object Relational Mapper.

Installation

Add this line to your application's Gemfile:

gem 'statwing'

And then execute:

$ bundle

Or install it yourself as:

$ gem install statwing

Configuration

Statwing.configure do |config|
  config.api_key = 'your_api_key'
end

Usage

Creating a User and associating a new dataset:

@user = Statwing::User.create(partner_user_id: 'identifier')
=> #<Statwing::User(users/usr_e9gAmn3WuEeDKjDwELRisB2lNYvAJMZa) partner_user_identity="identifier" id="usr_e9gAmn3WuEeDKjDwELRisB2lNYvAJMZa">

@dataset = Statwing::Dataset.create(name: "real-estate-transactions-sample.csv",fileurl: 'https://gist.githubusercontent.com/MatthewRDodds/5bf959ec16b67fd7c421/raw/52089a06e2fc9f8b74b85f49922f792610f3b6ae/real-estate-transactions-sample.csv', users: {action: 'add', data: [{ object: 'user_id', data: "usr_e9gAmn3WuEeDKjDwELRisB2lNYvAJMZa" }]})
=> #<Statwing::Dataset:0x3fff3d1023c8>

@user.datasets
=> [#<Statwing::Dataset:0x3fff3d5fe0d4>]

@dataset.attributes
=> {"name"=>"real-estate-transactions-sample.csv",
"filesize"=>113183,
"state"=>"processed",
"shared"=>"restricted",
"created_at"=>"2015-04-08T15:07:11Z",
"parse_settings"=>{"parser"=>"csv"},
"url_base"=>
"https://export.statwing.com/p0/datasets/dat_ufz8Ycgo0NiWSjICDYNCfzszXgqUeRrQ",
"users"=>nil}

@user.datasets.first.id
=> "dat_ufz8Ycgo0NiWSjICDYNCfzszXgqUeRrQ"

Statwing::Dataset.find('dat_ufz8Ycgo0NiWSjICDYNCfzszXgqUeRrQ').users
=> [{"id"=>"usr_e9gAmn3WuEeDKjDwELRisB2lNYvAJMZa",
  "partner_user_id"=>"identifier",
  "url"=>
   "https://export.statwing.com/p0/datasets/dat_ufz8Ycgo0NiWSjICDYNCfzszXgqUeRrQ/users/usr_e9gAmn3WuEeDKjDwELRisB2lNYvAJMZa"}]

Contributing

  1. Fork it ( https://github.com/MatthewRDodds/statwing/fork )
  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 a new Pull Request