Coder Social home page Coder Social logo

gandi's Introduction

Gandi

This is a Ruby interface to the Gandi XML-RPC API.

Installation

Add to your Gemfile:

gem 'gandi'

Then bundle install.

Otherwise

gem install gandi

Basic Usage

Every call to the Gandi API is authenticated so sessions are required to have a unique API key. If you don’t have it already, you can retrieve your API key from your Gandi account page.

require 'gandi'

api = Gandi::Session.new("24-character API key") # Endpoint: https://rpc.gandi.net/xmlrpc/

api.domain.list
api.domain.info('mydomain.com')
api.catalog.list(product: {type: 'domains'})
...

Operational Test and Evaluation (OT&E) Endpoint

Alongside the production API, Gandi provides an Operational Test and Evaluation (OT&E) system.

require 'gandi'

api = Gandi::Session.new("24-character API key", env: :test)

api.domain.list
...

For further information see the Gandi API documention at http://doc.rpc.gandi.net/

Fault codes

When the XMLRPC call returns an error, an exception is raised. Gandi::DataError is raised if the error is due to faulty user input and Gandi::ServerError is raised if it is caused by a server-side internal error.

All the possible fault codes can be found in Gandi API manual.

Both exceptions contain a Gandi::FaultCode object which stores the object name and the cause of the error:

fault_code = Gandi::FaultCode.parse(505237)
# => #<Gandi::FaultCode::Data:...>
fault_code.object
# => :object_fqdn
fault_code.cause
# => :cause_badparameter

Contributing

  1. Fork it
  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 new Pull Request

gandi's People

Contributors

bikerduweb avatar createdbypete avatar gdott9 avatar jjmartres avatar robmckinnon avatar timcraft 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.