transip 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/Gemfile +1 -1
- data/README.rdoc +6 -0
- data/lib/transip.rb +3 -3
- data/lib/transip/client.rb +12 -5
- data/lib/transip/version.rb +1 -1
- data/transip.gemspec +1 -1
- metadata +8 -16
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OTZiN2I0MDhiZDFlN2VhYzM1ZmIyYjRjYjk2ZDAxODlmM2JjMzQ3Yw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OTFjZDZiNzMxYTg5NmE3NzM1MTgyMGFjM2RmMzZlNjBhYzY0ZGMxMw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTJlNGE1OTU2OTRjOWFhYmFjMzc5ZGI2ZjhlMDdjMWU1NjYwZDUxZmIyMDJm
|
10
|
+
ZWYyZjk5ZGZjNWRlZTg4ZTY1NjUwZTNhMGQ3Y2Q0YjMxZGIxODQ1ZThkNDhh
|
11
|
+
MjM4YTdlNzM2ZjcyZDYxMDY3MjJkYjI1NjlmNzY3YWQ1NTQ2ZmY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OTIzYjUzNGQ5ZjVjNTdmZjY0Y2JmYTU5ZTFlNWQwOWYyYmY0NmViNTYxNDQ0
|
14
|
+
ZGM4ZTdhMTZmNjA5NmIzNDk0Y2I2YjMwNTY4Y2MyZTcwYjBkNWRiNjhlMDAy
|
15
|
+
NTE5ZTVkNDhlZGI5MzU0MDA3OTFkYzg5YzFkMjk2ZjU0ZGIwZDA=
|
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -46,6 +46,7 @@ Setup the API client:
|
|
46
46
|
# use this in production
|
47
47
|
transip = Transip::DomainClient.new(username: 'your_username', key: 'your_private_rsa_key', ip: '12.34.12.3', mode: :readwrite)
|
48
48
|
|
49
|
+
|
49
50
|
You can use Transip::DomainClient, Transip::VpsClient, Transip::ColocationClient, Transip::WebhostingClient and Transip::ForwardClient.
|
50
51
|
|
51
52
|
In development you can leave out the ip. To test request use :readonly mode.
|
@@ -54,6 +55,11 @@ If you store your private key in a seperate file you can do:
|
|
54
55
|
|
55
56
|
transip = Transip::DomainClient.new(username: 'your_username', key_file: 'path_to_your_private_key_file', ip: '12.34.12.3', mode: :readwrite)
|
56
57
|
|
58
|
+
=== Using a proxy for routing traffic to TransIP
|
59
|
+
transip = Transip::DomainClient.new(username: 'your_username', key: 'your_private_rsa_key', ip: '12.34.12.3', mode: :readwrite, proxy: ENV["QUOTAGUARDSTATIC_URL"])
|
60
|
+
|
61
|
+
If you want to use a proxy through which you want to route the API calls to TransIP, you can supply the proxy parameter. For example, I use QuotaGuard Static (https://addons.heroku.com/quotaguardstatic) on Heroku. First install the addon, you will receive two static IP addresses. Whitelist these in the TransIP API settings page. Next, supply the proxy url. For instance, I use the environment variable QUOTAGUARDSTATIC_URL to supply this URL.
|
62
|
+
|
57
63
|
=== DomainClient
|
58
64
|
|
59
65
|
transip = Transip::DomainClient.new(username: 'your_username', key: 'your_private_rsa_key', ip: '12.34.12.3', mode: :readwrite)
|
data/lib/transip.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
3
|
require 'securerandom'
|
4
4
|
require 'savon'
|
5
5
|
require 'curb'
|
6
|
-
require '
|
6
|
+
require 'active_support/inflector'
|
7
7
|
require 'digest/sha2'
|
8
8
|
require 'base64'
|
9
9
|
require 'ipaddr'
|
data/lib/transip/client.rb
CHANGED
@@ -28,13 +28,15 @@ module Transip
|
|
28
28
|
# * ip - needed in production
|
29
29
|
# * key / key_file - key is one of your private keys (these can be requested via your Controlpanel). key_file is path to file containing key.
|
30
30
|
# * mode - :readonly, :readwrite
|
31
|
+
# * proxy - url of proxy through which you want to route API requests. For example, if you use Quataguard Static on Heroku, use ENV["QUOTAGUARDSTATIC_URL"]. If not used, leave blank or don't supply it as a parameter.
|
31
32
|
#
|
32
33
|
# Example:
|
33
|
-
# transip = Transip.new(:username => 'api_username', :ip => '12.34.12.3', :key => mykey, :mode => 'readwrite') # use this in production
|
34
|
+
# transip = Transip.new(:username => 'api_username', :ip => '12.34.12.3', :key => mykey, :mode => 'readwrite', :proxy => '') # use this in production
|
34
35
|
def initialize(options = {})
|
35
36
|
@key = options[:key] || (options[:key_file] && File.read(options[:key_file]))
|
36
37
|
@username = options[:username]
|
37
38
|
@ip = options[:ip]
|
39
|
+
@proxy = options[:proxy]
|
38
40
|
@api_version = options[:api_version]
|
39
41
|
@api_service = options[:api_service]
|
40
42
|
raise ArgumentError, "The :username, :ip and :key options are required!" if @username.nil? or @key.nil?
|
@@ -44,9 +46,14 @@ module Transip
|
|
44
46
|
if options[:password]
|
45
47
|
@password = options[:password]
|
46
48
|
end
|
47
|
-
|
49
|
+
|
50
|
+
@savon_options = {
|
48
51
|
:wsdl => wsdl
|
49
52
|
}
|
53
|
+
# if proxy is present, use it
|
54
|
+
if @proxy != nil
|
55
|
+
@savon_options[:proxy] = @proxy
|
56
|
+
end
|
50
57
|
# By default we don't want to debug!
|
51
58
|
self.turn_off_debugging!
|
52
59
|
end
|
@@ -119,7 +126,7 @@ module Transip
|
|
119
126
|
# URL encoded
|
120
127
|
# I think the guys at transip were trying to use their entire crypto-toolbox!
|
121
128
|
def signature(method, parameters, time, nonce)
|
122
|
-
formatted_method = method.to_s.
|
129
|
+
formatted_method = method.to_s.camelize(:lower)
|
123
130
|
parameters ||= {}
|
124
131
|
input = convert_array_to_hash(parameters.values)
|
125
132
|
options = {
|
@@ -228,7 +235,7 @@ module Transip
|
|
228
235
|
# throws ApiError
|
229
236
|
# returns response object (can be TransipStruct or Array of TransipStruct)
|
230
237
|
def request(action, options = nil)
|
231
|
-
formatted_action = action.to_s.
|
238
|
+
formatted_action = action.to_s.camelize(:lower)
|
232
239
|
parameters = {
|
233
240
|
# for some reason, the transip server wants the body root tag to be
|
234
241
|
# the name of the action.
|
@@ -282,4 +289,4 @@ module Transip
|
|
282
289
|
API_SERVICE = 'ForwardService'
|
283
290
|
end
|
284
291
|
|
285
|
-
end
|
292
|
+
end
|
data/lib/transip/version.rb
CHANGED
data/transip.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
|
19
19
|
spec.add_dependency('savon', '>= 2.3.0')
|
20
20
|
spec.add_dependency('curb', '>= 0.8.4')
|
21
|
-
spec.add_dependency('
|
21
|
+
spec.add_dependency('activesupport', '>= 3.0.0')
|
22
22
|
|
23
23
|
spec.extra_rdoc_files = [
|
24
24
|
"MIT-LICENSE",
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Joost Hietbrink
|
@@ -10,12 +9,11 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2014-
|
12
|
+
date: 2014-03-05 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: savon
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
18
|
- - ! '>='
|
21
19
|
- !ruby/object:Gem::Version
|
@@ -23,7 +21,6 @@ dependencies:
|
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
25
|
- - ! '>='
|
29
26
|
- !ruby/object:Gem::Version
|
@@ -31,7 +28,6 @@ dependencies:
|
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: curb
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
32
|
- - ! '>='
|
37
33
|
- !ruby/object:Gem::Version
|
@@ -39,27 +35,24 @@ dependencies:
|
|
39
35
|
type: :runtime
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
39
|
- - ! '>='
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: 0.8.4
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
43
|
+
name: activesupport
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
46
|
- - ! '>='
|
53
47
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
48
|
+
version: 3.0.0
|
55
49
|
type: :runtime
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
53
|
- - ! '>='
|
61
54
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
55
|
+
version: 3.0.0
|
63
56
|
description: Ruby gem to use the full TransIP API (v5.0).
|
64
57
|
email:
|
65
58
|
- joost@joopp.com
|
@@ -82,27 +75,26 @@ files:
|
|
82
75
|
homepage: http://github.com/joost/transip
|
83
76
|
licenses:
|
84
77
|
- MIT
|
78
|
+
metadata: {}
|
85
79
|
post_install_message:
|
86
80
|
rdoc_options:
|
87
81
|
- --charset=UTF-8
|
88
82
|
require_paths:
|
89
83
|
- lib
|
90
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
85
|
requirements:
|
93
86
|
- - ! '>='
|
94
87
|
- !ruby/object:Gem::Version
|
95
88
|
version: '0'
|
96
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
90
|
requirements:
|
99
91
|
- - ! '>='
|
100
92
|
- !ruby/object:Gem::Version
|
101
93
|
version: '0'
|
102
94
|
requirements: []
|
103
95
|
rubyforge_project:
|
104
|
-
rubygems_version: 1.
|
96
|
+
rubygems_version: 2.1.1
|
105
97
|
signing_key:
|
106
|
-
specification_version:
|
98
|
+
specification_version: 4
|
107
99
|
summary: Ruby gem to use the full TransIP API (v5.0).
|
108
100
|
test_files: []
|