Giter Site home page Giter Site logo

codekit-ruby's Introduction

Att::Codekit

Library for easy access to AT&T's cloud services.

Requirements

Ruby 1.9.3 or higher (Ruby 2.1 recommended)

Installation

Easy install

Add the server host of the gem file:

$ gem sources --add http://lprod.code-api-att.com:8808

Install the gem:

$ gem install att-codekit

Manual install

Compile a gem using:

$ rake build

Then install it locally:

$ gem install -l pkg/att-codekit-version.gem

You can install per user by issuing:

$ gem install --user-install -l pkg/att-codekit-version.gem

Substituting version for the compiled version to install

Documentation

The Codekit contains inline documentation, which can be generated using yard doc via the yard command. Install by running

$ gem install yard

For example, to generate the documentation which can then be viewed via browser run:

$ yard server

Then goto the specified address in your preferred web browser, usually:

http://localhost:8808

Usage

###Require the library

require 'att/codekit'

###Include the namespace (optional)

include Att::Codekit::Auth
include Att::Codekit::Service

###Create oauth service object

You will need to use AuthCode or ClientCred according to which api you wish to use. These immutable objects will perform all steps required for using oauth services.

# Create an authcode oauth service 
authcode = AuthCode.new(fqdn, client_id, client_secret)

# Create a client credential oauth service
client = ClientCred.new(fqdn, client_id, client_secret)

###Create token object

Now that we have an oauth service object we can use it to generate a token.

# Authorization code must first redirect the user to grant authorization
redirect authcode.consentFlow(:redirect => 'http://localhost/auth')

# After consent flow the user will be redirected to the specified url with CODE
authToken = authcode.createToken(CODE)

# Generate a client credential token with SCOPE
clientToken = client.createToken(SCOPE)

###Create api service

Now to create an api service we just pass the oauth token to the api we want to use:

immn = IMMNService.new(fqdn, authToken)
sms = SMSService.new(fqdn, clientToken)

codekit-ruby's People

Watchers

 avatar  avatar

Forkers

digivoc

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.