No commit activity in last 3 years
No release in over 3 years
Leaseweb CDN REST API client for Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

 Project Readme

leaseweb-cdn-rest-api

Rubygem to talk to Leaseweb's CDN API

Installation

Add this line to your application's Gemfile:

gem 'leaseweb-cdn-rest-api'

And then execute:

$ bundle

Or install it yourself:

$ gem install leaseweb-cdn-rest-api

Usage

Start by creating a new instance of the LeasewebCDN class, and passing your api token and customer number.

api = LeasewebCDN.new(api_key, customer_number)

All return values are the direct JSON responses from Leaseweb converted into a Hash.

See: documentation

Get all pull|push|pushpull zones:

zones = api.zone('all', 'pull')['success']

Update a zone:

body = zones.first
body['alias'] = (1..10).collect { |n| "#{n}.cdn.example.com" }.join(',')
zone = api.update_zone(body['id'], body, 'pull')

Create a zone:

body = { 'cname' => 'cdn.example.com', 'origin' => "http://origin.example.com", 'active' => 1 }
zone = api.update_zone('new', body, 'push')

Delete a zone:

body = zones.first
zone = api.delete_zone(body['id'], 'pushpull')