Skip to content

creatary/creatary-ruby-sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Creatary Ruby gem

A Ruby wrapper for the Creatary REST APIs

Installation

gem install creatary-sdk

Documentation

https://creatary.com

How to Use

If you are using rails then:

  1. Add the creatary-sdk gem to your Gemfile
	gem 'creatary-sdk'
  1. Create a creatary.yml file in config with following contents:
	development: &defaults
		consumer_key:     # the consumer key generated in creatary.com for you application
		consumer_secret:  # the consumer secret generated in creatary.com for you application
		consumer_handler: # the of the class that implements the creatary handler logic
	test:
		<<: *defaults
	production:
		<<: *defaults
  1. Add following route to your routes.rb
	match '/creatary/(:string)' => Creatary::API 	# you can replace 'creatary' with any other namespace
  1. Implement the Creatary handler logic (e.g.: creatary_handler.rb in helpers)
	class CreataryHandler
	  def authorized(user, session)
		# should return the URL to which Creatary should redirect
	  end

	  def denied(session)
		# should return the URL to which Creatary should redirect
	  end
	
	  def receive_sms(from_user, to_app, body)
	  end
	
	  def lifecycle_notification(channel, invoker, reason, application_name, notification_type, access_tokens)
	  end
	  
	end
  1. The routes exposed by the gem in your rails application are:
	/creatary/authorize           # redirect to this one when you want to initiate the OAUTH authorization flow (pass ?subscription_tariff_name='' parameter to the redirect when performing subscription authorization OAUTH flow)
	/creatary/receive_sms		  # use this one (complement to form absolute path) as SMS URL when registering your application in creatary.com
	/creatary/oauth_callback      # use this one (complement to form absolute path) as OAUTH callback URL when registering your application in creatary.com
	/creatary/lifecycle_callback  # use this one (complement to form absolute path) as subscriber lifecycle callback URL when registering your application in creatary.com

Copyright 2012 Nokia Siemens Networks

About

A Ruby wrapper for the Creatary REST APIs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%