0.0
No commit activity in last 3 years
No release in over 3 years
Ruby API client and Rails engine for creating applications that integrate with data from the personal genetic testing service 23AndMe
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8.4
~> 3.12
~> 2.8.0
>= 0

Runtime

 Project Readme

twenty3andme¶ ↑

Ruby API client and Rails engine for creating applications that integrate with data from the personal genetic testing service 23AndMe.

api.23andme.com/

Install¶ ↑

Bundler via Gemfile

gem 'twenty3andme'

Use with Rails¶ ↑

Use environment variables to configure:

CLIENT_ID=shdfkjhsdfkj23
CLIENT_SECRET=sadiuyf79238
REDIRECT_URI=http://localhost:5000/callback_listener/
AFTER_REDIRECT_URI=/
SCOPE=basic,rs3094315

Send user to authorize app with 23andme, A URL helper is provided to help with this (url_for_23andme_authorize):

link_to 'authorize', url_for_23andme_authorize

Then implement CallbackHandler#handle to use or store token and redirect user. Example:

module Twenty3AndMe
  class CallbackHandler
    def handle(token, refresh_token)
      User.create(:token => token, :refresh_token => refresh_token)
    end
  end
end

Now requests can be made with the stored token:

user = User.first
client = Twenty3AndMe::Client.new
client.token = user.token
client.genotype('rs3094315')

Use without Rails¶ ↑

First, Authorize and receive the code from 23andme: api.23andme.com/authorize/?redirect_uri=http://localhost:5000/receive_code/&response_type=code&client_id=a8a1f21d3417b70de786daea7e9ce2a8&scope=names basic haplogroups relatives genome

c = Twenty3AndMe::Client.new
c.request_token('client_id', 'client_secret', 'code_from_above', 'http://localhost:5000/receive_code/', ['ancestry', 'basic', 'rs4778241'])

Requests can now be made

c.user

Simple Example App¶ ↑

genohair.herokuapp.com github.com/seeingidog/genohair