ivapi 1.1.8 → 1.2.0
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 +4 -4
- data/.hound.yml +2 -0
- data/.travis.yml +5 -4
- data/Gemfile +13 -5
- data/README.md +0 -1
- data/lib/ivapi/client/account.rb +1 -1
- data/lib/ivapi/client/hosting.rb +18 -0
- data/lib/ivapi/client/server.rb +14 -2
- data/lib/ivapi/client.rb +5 -0
- data/lib/ivapi/configuration.rb +6 -5
- data/lib/ivapi/default.rb +4 -0
- data/lib/ivapi/version.rb +1 -1
- data/lib/ivapi.rb +4 -0
- data/spec/fixtures/hosting_info.json +3 -0
- data/spec/fixtures/server_ptr.json +4 -0
- data/spec/ivapi/client/account_spec.rb +4 -0
- data/spec/ivapi/client/hosting_spec.rb +32 -0
- data/spec/ivapi/client/server_spec.rb +12 -0
- data/spec/ivapi_spec.rb +4 -5
- data/spec/spec_helper.rb +1 -3
- metadata +11 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d008082f8c773dd3f3f66aa9bb48fd3037e8fe26
|
|
4
|
+
data.tar.gz: 28dc6501628a7791fc3fea617454ed3b2daf4024
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aa22c23d0d8e6208626d83d90325d1d55f4db7f01e09652cb442cee9a3962f3a2a8bfd97f3f8b42004c4b63e8750a4a8cb4ed9e3ac177419a2c876d4ebb70378
|
|
7
|
+
data.tar.gz: d1ef174c626c1469cb8c39238d1e64b14624c531b824df48215fb576a43e6da1275f7a39f71206aa539fe4932dd01de96a1a0271ee867c5092489f7a5893fce7
|
data/.hound.yml
ADDED
data/.travis.yml
CHANGED
|
@@ -3,23 +3,24 @@ sudo: false
|
|
|
3
3
|
before_install:
|
|
4
4
|
- gem install bundler
|
|
5
5
|
|
|
6
|
+
after_success:
|
|
7
|
+
- bundle exec codeclimate-test-reporter
|
|
8
|
+
|
|
6
9
|
bundler_args: --without development
|
|
7
10
|
|
|
8
11
|
language: ruby
|
|
9
12
|
|
|
10
13
|
rvm:
|
|
11
|
-
- 1.9.3
|
|
12
14
|
- 2.0.0
|
|
13
15
|
- 2.1.0
|
|
14
16
|
- 2.2.0
|
|
15
17
|
- 2.3.0
|
|
16
18
|
- ruby-head
|
|
17
|
-
- jruby-19mode
|
|
18
19
|
- jruby-head
|
|
19
|
-
- rbx
|
|
20
|
+
- rbx-2
|
|
20
21
|
|
|
21
22
|
matrix:
|
|
22
23
|
allow_failures:
|
|
23
24
|
- rvm: ruby-head
|
|
24
25
|
- rvm: jruby-head
|
|
25
|
-
- rvm: rbx
|
|
26
|
+
- rvm: rbx-2
|
data/Gemfile
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
|
+
group :development do
|
|
4
|
+
gem 'guard-rspec', '~> 4.7.3'
|
|
5
|
+
end
|
|
6
|
+
|
|
3
7
|
group :test do
|
|
4
8
|
gem 'codeclimate-test-reporter', require: false
|
|
5
|
-
gem 'coveralls',
|
|
6
|
-
gem 'guard-rspec', '~> 4.6.5'
|
|
9
|
+
gem 'coveralls', '~> 0.8.16', require: false
|
|
7
10
|
gem 'rake' # We need a rake gem for Travis CI.
|
|
8
|
-
gem 'rspec',
|
|
9
|
-
gem 'simplecov',
|
|
10
|
-
gem 'webmock',
|
|
11
|
+
gem 'rspec', '~> 3.5.0'
|
|
12
|
+
gem 'simplecov', '~> 0.12', require: false
|
|
13
|
+
gem 'webmock', '~> 2.1.0'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
platforms :rbx do
|
|
17
|
+
gem 'psych'
|
|
18
|
+
gem 'rubysl', '~> 2.0'
|
|
11
19
|
end
|
|
12
20
|
|
|
13
21
|
gemspec
|
data/README.md
CHANGED
data/lib/ivapi/client/account.rb
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Ivapi
|
|
2
|
+
class Client
|
|
3
|
+
class Hosting < Base
|
|
4
|
+
attr_reader :hosting_id
|
|
5
|
+
|
|
6
|
+
def initialize(client, hosting_id)
|
|
7
|
+
super(client)
|
|
8
|
+
@hosting_id = hosting_id
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def information
|
|
12
|
+
params = { command: 'hosting_info', id: hosting_id }
|
|
13
|
+
get('/json.php', params)
|
|
14
|
+
end
|
|
15
|
+
alias info information
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
data/lib/ivapi/client/server.rb
CHANGED
|
@@ -15,7 +15,7 @@ module Ivapi
|
|
|
15
15
|
params = { command: 'server_info', id: server_id }
|
|
16
16
|
get('/json.php', params)
|
|
17
17
|
end
|
|
18
|
-
|
|
18
|
+
alias info information
|
|
19
19
|
|
|
20
20
|
# Get server tasks.
|
|
21
21
|
#
|
|
@@ -123,6 +123,18 @@ module Ivapi
|
|
|
123
123
|
get('/json.php', params)
|
|
124
124
|
end
|
|
125
125
|
|
|
126
|
+
# Reverse PTR record change for additional IP.
|
|
127
|
+
#
|
|
128
|
+
# options - The Hash options (default: {}):
|
|
129
|
+
# :ip - The String of additional IP.
|
|
130
|
+
# :domain - The String of reverse PTR.
|
|
131
|
+
#
|
|
132
|
+
# Returns the Hash of new ptr info.
|
|
133
|
+
def ptr(options = {})
|
|
134
|
+
params = options.merge(command: 'server_ptr', id: server_id)
|
|
135
|
+
get('/json.php', params)
|
|
136
|
+
end
|
|
137
|
+
|
|
126
138
|
# Send command to change server plan.
|
|
127
139
|
#
|
|
128
140
|
# options - The Hash options (default: {}):
|
|
@@ -146,7 +158,7 @@ module Ivapi
|
|
|
146
158
|
params = { command: 'server_domain', id: server_id, domain: domain }
|
|
147
159
|
get('/json.php', params)
|
|
148
160
|
end
|
|
149
|
-
|
|
161
|
+
alias hostname domain
|
|
150
162
|
end
|
|
151
163
|
end
|
|
152
164
|
end
|
data/lib/ivapi/client.rb
CHANGED
|
@@ -3,6 +3,7 @@ require 'ivapi/authentication'
|
|
|
3
3
|
|
|
4
4
|
require 'ivapi/client/base'
|
|
5
5
|
require 'ivapi/client/account'
|
|
6
|
+
require 'ivapi/client/hosting'
|
|
6
7
|
require 'ivapi/client/server'
|
|
7
8
|
|
|
8
9
|
module Ivapi
|
|
@@ -25,6 +26,10 @@ module Ivapi
|
|
|
25
26
|
Ivapi::Client::Account.new(self)
|
|
26
27
|
end
|
|
27
28
|
|
|
29
|
+
def hosting(hosting_id = @hosting_id)
|
|
30
|
+
Ivapi::Client::Hosting.new(self, hosting_id)
|
|
31
|
+
end
|
|
32
|
+
|
|
28
33
|
def server(server_id = @server_id)
|
|
29
34
|
Ivapi::Client::Server.new(self, server_id)
|
|
30
35
|
end
|
data/lib/ivapi/configuration.rb
CHANGED
|
@@ -3,18 +3,19 @@ require 'ivapi/version'
|
|
|
3
3
|
|
|
4
4
|
module Ivapi
|
|
5
5
|
module Configuration
|
|
6
|
-
attr_accessor :
|
|
7
|
-
:web_endpoint, :api_endpoint, :
|
|
6
|
+
attr_accessor :username, :password, :user_agent, :connection_options,
|
|
7
|
+
:web_endpoint, :api_endpoint, :server_id, :hosting_id
|
|
8
8
|
|
|
9
9
|
def self.keys
|
|
10
10
|
@keys ||= [
|
|
11
11
|
:api_endpoint,
|
|
12
|
-
:server_id,
|
|
13
12
|
:username,
|
|
14
13
|
:middleware,
|
|
15
14
|
:password,
|
|
16
15
|
:user_agent,
|
|
17
|
-
:connection_options
|
|
16
|
+
:connection_options,
|
|
17
|
+
:server_id,
|
|
18
|
+
:hosting_id
|
|
18
19
|
]
|
|
19
20
|
end
|
|
20
21
|
|
|
@@ -30,7 +31,7 @@ module Ivapi
|
|
|
30
31
|
end
|
|
31
32
|
self
|
|
32
33
|
end
|
|
33
|
-
|
|
34
|
+
alias setup reset!
|
|
34
35
|
|
|
35
36
|
private
|
|
36
37
|
|
data/lib/ivapi/default.rb
CHANGED
data/lib/ivapi/version.rb
CHANGED
data/lib/ivapi.rb
CHANGED
|
@@ -19,6 +19,10 @@ module Ivapi
|
|
|
19
19
|
return super unless client.respond_to?(method_name)
|
|
20
20
|
client.send(method_name, *args, &block)
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
def respond_to_missing?(method_name, include_private = false)
|
|
24
|
+
client.respond_to?(method_name, include_private)
|
|
25
|
+
end
|
|
22
26
|
end
|
|
23
27
|
end
|
|
24
28
|
|
|
@@ -22,6 +22,10 @@ describe Ivapi::Client::Account do
|
|
|
22
22
|
it 'should return account name' do
|
|
23
23
|
expect(@info.name).to eq('Name Surname')
|
|
24
24
|
end
|
|
25
|
+
|
|
26
|
+
it 'has alias info' do
|
|
27
|
+
expect(Ivapi.account.info).to eq(Ivapi.account.information)
|
|
28
|
+
end
|
|
25
29
|
end
|
|
26
30
|
|
|
27
31
|
describe 'account credits' do
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Ivapi::Client::Server do
|
|
4
|
+
before do
|
|
5
|
+
Ivapi.configure do |config|
|
|
6
|
+
config.username = 'foo'
|
|
7
|
+
config.password = 'bar'
|
|
8
|
+
config.hosting_id = 1
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
after do
|
|
13
|
+
Ivapi.reset!
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe '#information' do
|
|
17
|
+
let(:info) { Ivapi.hosting.information }
|
|
18
|
+
|
|
19
|
+
before do
|
|
20
|
+
stub_command('hosting_info', id: 1)
|
|
21
|
+
.to_return(json_response('hosting_info.json'))
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'has alias info method' do
|
|
25
|
+
expect(Ivapi.hosting.info).to eq(info)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'has correct id' do
|
|
29
|
+
expect(info.id).to eq('1')
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -137,6 +137,18 @@ describe Ivapi::Client::Server do
|
|
|
137
137
|
end
|
|
138
138
|
end
|
|
139
139
|
|
|
140
|
+
describe '#ptr' do
|
|
141
|
+
let(:ptr) { Ivapi.server.ptr(ip: '1.2.3.4', domain: 'example.com') }
|
|
142
|
+
before do
|
|
143
|
+
stub_command('server_ptr', id: 3, ip: '1.2.3.4', domain: 'example.com')
|
|
144
|
+
.to_return(json_response('server_ptr.json'))
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
it 'has correct domain' do
|
|
148
|
+
expect(ptr.domain).to eq('example.com')
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
140
152
|
describe 'change server plan' do
|
|
141
153
|
before(:each) do
|
|
142
154
|
stub_command('server_change', id: 3)
|
data/spec/ivapi_spec.rb
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
|
+
|
|
2
3
|
describe Ivapi do
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
# end
|
|
7
|
-
# end
|
|
4
|
+
it 'responds to config' do
|
|
5
|
+
expect(Ivapi.respond_to?(:configure)).to be_truthy
|
|
6
|
+
end
|
|
8
7
|
|
|
9
8
|
# describe '.new' do
|
|
10
9
|
# it 'is a Ivapi::Client' do
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
require 'simplecov'
|
|
2
2
|
require 'coveralls'
|
|
3
|
-
require 'codeclimate-test-reporter'
|
|
4
3
|
|
|
5
4
|
SimpleCov.formatters = [
|
|
6
5
|
SimpleCov::Formatter::HTMLFormatter,
|
|
7
|
-
Coveralls::SimpleCov::Formatter
|
|
8
|
-
CodeClimate::TestReporter::Formatter
|
|
6
|
+
Coveralls::SimpleCov::Formatter
|
|
9
7
|
]
|
|
10
8
|
|
|
11
9
|
SimpleCov.start
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ivapi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justas Palumickas
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-11-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -115,6 +115,7 @@ extensions: []
|
|
|
115
115
|
extra_rdoc_files: []
|
|
116
116
|
files:
|
|
117
117
|
- ".gitignore"
|
|
118
|
+
- ".hound.yml"
|
|
118
119
|
- ".rspec"
|
|
119
120
|
- ".rubocop.yml"
|
|
120
121
|
- ".travis.yml"
|
|
@@ -130,6 +131,7 @@ files:
|
|
|
130
131
|
- lib/ivapi/client.rb
|
|
131
132
|
- lib/ivapi/client/account.rb
|
|
132
133
|
- lib/ivapi/client/base.rb
|
|
134
|
+
- lib/ivapi/client/hosting.rb
|
|
133
135
|
- lib/ivapi/client/server.rb
|
|
134
136
|
- lib/ivapi/configuration.rb
|
|
135
137
|
- lib/ivapi/default.rb
|
|
@@ -142,6 +144,7 @@ files:
|
|
|
142
144
|
- spec/fixtures/account_info.json
|
|
143
145
|
- spec/fixtures/account_orders.json
|
|
144
146
|
- spec/fixtures/account_services.json
|
|
147
|
+
- spec/fixtures/hosting_info.json
|
|
145
148
|
- spec/fixtures/server_change.json
|
|
146
149
|
- spec/fixtures/server_domain.json
|
|
147
150
|
- spec/fixtures/server_firewall.json
|
|
@@ -149,12 +152,14 @@ files:
|
|
|
149
152
|
- spec/fixtures/server_graphs.json
|
|
150
153
|
- spec/fixtures/server_info.json
|
|
151
154
|
- spec/fixtures/server_os.json
|
|
155
|
+
- spec/fixtures/server_ptr.json
|
|
152
156
|
- spec/fixtures/server_reboot.json
|
|
153
157
|
- spec/fixtures/server_recreate.json
|
|
154
158
|
- spec/fixtures/server_reset_password.json
|
|
155
159
|
- spec/fixtures/server_tasks.json
|
|
156
160
|
- spec/fixtures/version.json
|
|
157
161
|
- spec/ivapi/client/account_spec.rb
|
|
162
|
+
- spec/ivapi/client/hosting_spec.rb
|
|
158
163
|
- spec/ivapi/client/server_spec.rb
|
|
159
164
|
- spec/ivapi/client_spec.rb
|
|
160
165
|
- spec/ivapi/error_spec.rb
|
|
@@ -181,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
181
186
|
requirements:
|
|
182
187
|
- Interneto Vizija allow to use API only on them servers.
|
|
183
188
|
rubyforge_project:
|
|
184
|
-
rubygems_version: 2.
|
|
189
|
+
rubygems_version: 2.5.2
|
|
185
190
|
signing_key:
|
|
186
191
|
specification_version: 4
|
|
187
192
|
summary: Ruby wrapper for working with Interneto Vizija API.
|
|
@@ -191,6 +196,7 @@ test_files:
|
|
|
191
196
|
- spec/fixtures/account_info.json
|
|
192
197
|
- spec/fixtures/account_orders.json
|
|
193
198
|
- spec/fixtures/account_services.json
|
|
199
|
+
- spec/fixtures/hosting_info.json
|
|
194
200
|
- spec/fixtures/server_change.json
|
|
195
201
|
- spec/fixtures/server_domain.json
|
|
196
202
|
- spec/fixtures/server_firewall.json
|
|
@@ -198,12 +204,14 @@ test_files:
|
|
|
198
204
|
- spec/fixtures/server_graphs.json
|
|
199
205
|
- spec/fixtures/server_info.json
|
|
200
206
|
- spec/fixtures/server_os.json
|
|
207
|
+
- spec/fixtures/server_ptr.json
|
|
201
208
|
- spec/fixtures/server_reboot.json
|
|
202
209
|
- spec/fixtures/server_recreate.json
|
|
203
210
|
- spec/fixtures/server_reset_password.json
|
|
204
211
|
- spec/fixtures/server_tasks.json
|
|
205
212
|
- spec/fixtures/version.json
|
|
206
213
|
- spec/ivapi/client/account_spec.rb
|
|
214
|
+
- spec/ivapi/client/hosting_spec.rb
|
|
207
215
|
- spec/ivapi/client/server_spec.rb
|
|
208
216
|
- spec/ivapi/client_spec.rb
|
|
209
217
|
- spec/ivapi/error_spec.rb
|