rubyflare 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +62 -11
- data/lib/rubyflare/connect.rb +1 -0
- data/lib/rubyflare/version.rb +1 -1
- data/rubyflare.gemspec +6 -7
- metadata +15 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c4282051f85736049fbb8fbb74cb71dcca93238
|
4
|
+
data.tar.gz: 44ebe3916a714eea2f39d4fa505deaa417829d73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfa5d09a294f76b210a280e66657a91ad5806b16e0f43645b31df6bff87fa062601c087c6dc2615ee0e2da3a045e52f5338a522146e63d7011b05617fa74e22e
|
7
|
+
data.tar.gz: 2514368093139440cb17e6450bccceaf87486303fb1857fced53ce8c99543d9980d7f48b209afc75dc2bb948977c1063c6302505c2dd1923a7c7038e8d9b1613
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![Code Climate](https://codeclimate.com/github/trev/rubyflare/badges/gpa.svg)](https://codeclimate.com/github/trev/rubyflare) [![Test Coverage](https://codeclimate.com/github/trev/rubyflare/badges/coverage.svg)](https://codeclimate.com/github/trev/rubyflare/coverage) [![Build Status](https://travis-ci.org/trev/rubyflare.svg?branch=master)](https://travis-ci.org/trev/rubyflare)
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/rubyflare.svg)](https://badge.fury.io/rb/rubyflare) [![Code Climate](https://codeclimate.com/github/trev/rubyflare/badges/gpa.svg)](https://codeclimate.com/github/trev/rubyflare) [![Test Coverage](https://codeclimate.com/github/trev/rubyflare/badges/coverage.svg)](https://codeclimate.com/github/trev/rubyflare/coverage) [![Build Status](https://travis-ci.org/trev/rubyflare.svg?branch=master)](https://travis-ci.org/trev/rubyflare)
|
2
2
|
# Rubyflare
|
3
3
|
|
4
4
|
Super thin Ruby wrapper for Cloudflare's V4 API.
|
@@ -21,38 +21,89 @@ Or install it yourself as:
|
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
-
First off, open https://api.cloudflare.com/ to see all the
|
24
|
+
First off, open https://api.cloudflare.com/ to see all the available endpoints
|
25
25
|
|
26
26
|
### Quick start
|
27
27
|
|
28
|
+
#### Setup connection
|
29
|
+
|
28
30
|
```
|
29
31
|
require 'rubyflare'
|
30
32
|
|
31
33
|
connection = Rubyflare.connect_with('bear@dog.com', 'supersecretapikey')
|
32
|
-
|
33
|
-
|
34
|
+
```
|
35
|
+
|
36
|
+
#### GET your user account details
|
37
|
+
|
38
|
+
```
|
34
39
|
user = connection.get('user')
|
35
40
|
|
36
|
-
#
|
41
|
+
# Read the first result
|
37
42
|
p user.result
|
38
43
|
|
39
|
-
#
|
44
|
+
# Read your first name
|
40
45
|
p user.result[:first_name]
|
46
|
+
```
|
47
|
+
|
48
|
+
#### Update(PATCH) your user account
|
49
|
+
|
50
|
+
```
|
51
|
+
user = connection.patch('user', { first_name: 'Bear' })
|
52
|
+
|
53
|
+
# Read the first result
|
54
|
+
p user.result
|
55
|
+
```
|
56
|
+
|
57
|
+
#### GET all your zones
|
58
|
+
|
59
|
+
```
|
60
|
+
zones = connection.get('zones')
|
61
|
+
|
62
|
+
# Read the first zone
|
63
|
+
p zones.result
|
64
|
+
|
65
|
+
# Read the array of zones. Pluralize #result
|
66
|
+
p zones.results
|
67
|
+
```
|
68
|
+
|
69
|
+
#### Create(POST) a new zone (domain)
|
41
70
|
|
42
|
-
|
71
|
+
```
|
43
72
|
zone = connection.post('zones', { name: 'supercooldomain.com' })
|
44
73
|
|
45
74
|
# Check it out
|
46
75
|
p zone.result
|
76
|
+
```
|
47
77
|
|
48
|
-
|
49
|
-
|
78
|
+
#### Add(POST) an A Record to the zone
|
79
|
+
|
80
|
+
```
|
81
|
+
dns_record = connection.post('zones/{#zone.result[:id]}/dns_records', {
|
82
|
+
type: 'A",
|
83
|
+
name: 'supercooldomain.com',
|
84
|
+
content: '127.0.0.1'
|
85
|
+
})
|
86
|
+
|
87
|
+
# Check it out
|
88
|
+
p dns_record.result
|
89
|
+
```
|
90
|
+
|
91
|
+
#### DELETE a zone
|
50
92
|
|
51
|
-
|
93
|
+
```
|
94
|
+
deleted_zone = connection.delete('zones/#{zone.result[:id]}')
|
95
|
+
|
96
|
+
# Check out the response
|
97
|
+
p deleted_zone
|
98
|
+
```
|
99
|
+
|
100
|
+
#### Catch errors
|
101
|
+
|
102
|
+
```
|
52
103
|
begin
|
53
104
|
connection.get('user')
|
54
105
|
rescue => e
|
55
|
-
# Inspect
|
106
|
+
# Inspect e.reponse for more details
|
56
107
|
p e.response
|
57
108
|
end
|
58
109
|
```
|
data/lib/rubyflare/connect.rb
CHANGED
@@ -17,6 +17,7 @@ module Rubyflare
|
|
17
17
|
http.headers['X-Auth-Email'] = @email
|
18
18
|
http.headers['X-Auth-Key'] = @api_key
|
19
19
|
http.headers['Content-Type'] = 'application/json'
|
20
|
+
http.headers['User-Agent'] = "Rubyflare/#{Rubyflare::VERSION}"
|
20
21
|
end
|
21
22
|
@response = Rubyflare::Response.new(method_name, endpoint, response.body_str)
|
22
23
|
end
|
data/lib/rubyflare/version.rb
CHANGED
data/rubyflare.gemspec
CHANGED
@@ -21,12 +21,11 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.required_ruby_version = '>= 2.0'
|
23
23
|
|
24
|
-
spec.add_development_dependency "bundler", "~> 1.
|
25
|
-
spec.add_development_dependency "rake", "~>
|
26
|
-
spec.add_development_dependency "rspec", "~> 3.
|
27
|
-
spec.add_development_dependency "webmock", "~> 1
|
28
|
-
spec.add_development_dependency "
|
29
|
-
spec.add_development_dependency "codeclimate-test-reporter", "~> 0.4.8"
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
25
|
+
spec.add_development_dependency "rake", "~> 11.3"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.5"
|
27
|
+
spec.add_development_dependency "webmock", "~> 2.1"
|
28
|
+
spec.add_development_dependency "codeclimate-test-reporter", "~> 0.6.0"
|
30
29
|
|
31
|
-
spec.add_runtime_dependency "curb", "~> 0.
|
30
|
+
spec.add_runtime_dependency "curb", "~> 0.9.3"
|
32
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyflare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trevor Wistaff
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,98 +16,84 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.11'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.11'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '11.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '11.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.5'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.5'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: webmock
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1
|
61
|
+
version: '2.1'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: vcr
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '2.9'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '2.9'
|
68
|
+
version: '2.1'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: codeclimate-test-reporter
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
73
|
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
75
|
+
version: 0.6.0
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
82
|
+
version: 0.6.0
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: curb
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
87
|
- - "~>"
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
89
|
+
version: 0.9.3
|
104
90
|
type: :runtime
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
94
|
- - "~>"
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
96
|
+
version: 0.9.3
|
111
97
|
description: Thin Ruby wrapper around Cloudflare's V4 API for good measure!
|
112
98
|
email:
|
113
99
|
- trev@a07.com.au
|
@@ -152,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
138
|
version: '0'
|
153
139
|
requirements: []
|
154
140
|
rubyforge_project:
|
155
|
-
rubygems_version: 2.
|
141
|
+
rubygems_version: 2.5.1
|
156
142
|
signing_key:
|
157
143
|
specification_version: 4
|
158
144
|
summary: Thin Ruby wrapper around Cloudflare's V4 API.
|