GithubHelp home page GithubHelp logo

isabella232 / dnsimple-ruby Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dnsimple/dnsimple-ruby

0.0 0.0 0.0 1.41 MB

The DNSimple API client for Ruby.

Home Page: https://developer.dnsimple.com/

License: MIT License

Ruby 100.00%

dnsimple-ruby's Introduction

DNSimple Ruby Client

A Ruby client for the DNSimple API v2.

Build Status Coverage Status

DNSimple provides DNS hosting and domain registration that is simple and friendly. We provide a full API and an easy-to-use web interface so you can get your domain registered and set up with a minimal amount of effort.

Installation

You can install the gem manually:

gem install dnsimple

Or use Bundler and define it as a dependency in your Gemfile:

gem 'dnsimple', '~> 4.0'

Usage

This library is a Ruby client you can use to interact with the DNSimple API v2. Here are some examples.

require 'dnsimple'

client = Dnsimple::Client.new(access_token: "a1b2c3")

# Fetch your details
response = client.identity.whoami   # execute the call
response.data                       # extract the relevant data from the response or
client.identity.whoami.data         # execute the call and get the data in one line

# Define an account ID.
account_id = 1010

# You can also fetch it from the whoami response
# as long as you authenticate with an Account access token
whoami = client.identity.whoami.data
account_id = whoami.account.id

# List your domains
puts client.domains.list_domains(account_id).data                      # => domains from the account 1234, first page
puts client.domains.list_domains(account_id, query: { page: 3 }).data  # => domains from the account 1234, third page
puts client.domains.all_domains(account_id).data                       # => all domains from the account 1234 (use carefully)

# Create a domain
response = client.domains.create_domain(account_id, name: "example.com")
puts response.data

# Get a domain
response = client.domains.domain(account_id, "example.com")
puts response.data

For the full library documentation visit http://rubydoc.info/gems/dnsimple

Sandbox Environment

We highly recommend testing against our sandbox environment before using our production environment. This will allow you to avoid real purchases, live charges on your credit card, and reduce the chance of your running up against rate limits.

The client supports both the production and sandbox environment. To switch to sandbox pass the sandbox API host using the base_url option when you construct the client:

client = Dnsimple::Client.new(base_url: "https://api.sandbox.dnsimple.com", access_token: "a1b2c3")

You will need to ensure that you are using an access token created in the sandbox environment. Production tokens will not work in the sandbox environment.

Setting a custom User-Agent header

You can customize the User-Agent header for the calls made to the DNSimple API:

client = Dnsimple::Client.new(user_agent: "my-app/1.0")

The value you provide will be prepended to the default User-Agent the client uses. For example, if you use my-app/1.0, the final header value will be my-app/1.0 dnsimple-ruby/0.14.0 (note that it will vary depending on the client version).

We recommend to customize the user agent. If you are building a library or integration on top of the official client, customizing the client will help us to understand what is this client used for, and allow to contribute back or get in touch.

License

Copyright (c) 2010-2021 DNSimple Corporation. This is Free Software distributed under the MIT license.

dnsimple-ruby's People

Contributors

3flex avatar aeden avatar alkema avatar benjaminkeeping avatar chorn avatar dependabot-preview[bot] avatar depfu[bot] avatar dje avatar duduribeiro avatar dwradcliffe avatar iseem avatar jacegu avatar jackbot avatar jcaudle avatar jerrycattell avatar jodosha avatar johnbintz avatar martinisoft avatar mattmanning avatar mikeemery avatar mzuneska avatar nickhammond avatar olemchls avatar pat avatar roidrage avatar san983 avatar sbastn avatar weppos 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.