ivapi 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/ivapi/client/account.rb +1 -1
- data/lib/ivapi/client/base.rb +1 -1
- data/lib/ivapi/client/server.rb +9 -13
- data/lib/ivapi/configuration.rb +2 -6
- data/lib/ivapi/default.rb +3 -3
- data/lib/ivapi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c58c39ab0e09863daded145c3d43bf043e7176c
|
4
|
+
data.tar.gz: 9a0e2af3fb2f2686ea5dffac656769ff8ae71c3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd8472f0158d66b617b569656907aa395baf892d77ca6f315828f64e0036cb1a94742d4b319c2293a8a42ff5495da01bab79fe5c0ba28f76cf1bb9aa53758504
|
7
|
+
data.tar.gz: 0aeb01574c5e025eef143a7d3f7d1fae87fb6ada80126128292d1d1508cea5e8b7e992b11940f0d98a9aa2291df4f177a77505eff3b5765706b6d8817a46d177
|
data/README.md
CHANGED
@@ -31,7 +31,7 @@ Create a new account at https://klientams.iv.lt/users.php with description "API"
|
|
31
31
|
|
32
32
|
### Authentication
|
33
33
|
```rb
|
34
|
-
Ivapi::Client.new(username: 'foo', password: 'bar')
|
34
|
+
client = Ivapi::Client.new(username: 'foo', password: 'bar')
|
35
35
|
```
|
36
36
|
|
37
37
|
Or create file under `config/initializers/ivapi.rb`
|
data/lib/ivapi/client/account.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Ivapi
|
2
2
|
class Client
|
3
3
|
class Account < Base
|
4
|
-
|
5
4
|
# Get information about account.
|
6
5
|
#
|
7
6
|
# Returns the Hash of account information.
|
@@ -9,6 +8,7 @@ module Ivapi
|
|
9
8
|
params = { command: 'account_info' }
|
10
9
|
get('/json.php', params)
|
11
10
|
end
|
11
|
+
alias_method :info, :information
|
12
12
|
|
13
13
|
# Get account orders.
|
14
14
|
#
|
data/lib/ivapi/client/base.rb
CHANGED
data/lib/ivapi/client/server.rb
CHANGED
@@ -26,8 +26,9 @@ module Ivapi
|
|
26
26
|
#
|
27
27
|
# Returns the Hash of server tasks.
|
28
28
|
def tasks(count, options = {})
|
29
|
-
params = options.merge(
|
30
|
-
command: 'server_tasks', id: server_id, count: count
|
29
|
+
params = options.merge(
|
30
|
+
command: 'server_tasks', id: server_id, count: count
|
31
|
+
)
|
31
32
|
|
32
33
|
get('/json.php', params)
|
33
34
|
end
|
@@ -74,11 +75,9 @@ module Ivapi
|
|
74
75
|
#
|
75
76
|
# Returns the Integer of task id.
|
76
77
|
def recreate(os, options = {})
|
77
|
-
params = options.merge(
|
78
|
-
command: 'server_recreate',
|
79
|
-
|
80
|
-
os: os
|
81
|
-
})
|
78
|
+
params = options.merge(
|
79
|
+
command: 'server_recreate', id: server_id, os: os
|
80
|
+
)
|
82
81
|
|
83
82
|
get('/json.php', params)
|
84
83
|
end
|
@@ -91,10 +90,7 @@ module Ivapi
|
|
91
90
|
#
|
92
91
|
# Returns the Integer of task id.
|
93
92
|
def reset_password(options = {})
|
94
|
-
params = options.merge(
|
95
|
-
command: 'server_reset_password',
|
96
|
-
id: server_id
|
97
|
-
})
|
93
|
+
params = options.merge(command: 'server_reset_password', id: server_id)
|
98
94
|
|
99
95
|
get('/json.php', params)
|
100
96
|
end
|
@@ -123,7 +119,7 @@ module Ivapi
|
|
123
119
|
#
|
124
120
|
# Returns the Hash of new firewall settings.
|
125
121
|
def firewall(options = {})
|
126
|
-
params = options.merge(
|
122
|
+
params = options.merge(command: 'server_firewall', id: server_id)
|
127
123
|
get('/json.php', params)
|
128
124
|
end
|
129
125
|
|
@@ -137,7 +133,7 @@ module Ivapi
|
|
137
133
|
#
|
138
134
|
# Returns the Integer of task id.
|
139
135
|
def change(options = {})
|
140
|
-
params = options.merge(
|
136
|
+
params = options.merge(command: 'server_change', id: server_id)
|
141
137
|
get('/json.php', params)
|
142
138
|
end
|
143
139
|
|
data/lib/ivapi/configuration.rb
CHANGED
@@ -4,8 +4,7 @@ require 'ivapi/version'
|
|
4
4
|
module Ivapi
|
5
5
|
module Configuration
|
6
6
|
attr_accessor :server_id, :user_agent, :connection_options,
|
7
|
-
:web_endpoint, :api_endpoint
|
8
|
-
attr_writer :username, :password
|
7
|
+
:web_endpoint, :api_endpoint, :username, :password
|
9
8
|
|
10
9
|
def self.keys
|
11
10
|
@keys ||= [
|
@@ -21,6 +20,7 @@ module Ivapi
|
|
21
20
|
|
22
21
|
def configure
|
23
22
|
yield self
|
23
|
+
true
|
24
24
|
end
|
25
25
|
|
26
26
|
# Reset configuration options to default values
|
@@ -32,10 +32,6 @@ module Ivapi
|
|
32
32
|
end
|
33
33
|
alias_method :setup, :reset!
|
34
34
|
|
35
|
-
def configure
|
36
|
-
yield self
|
37
|
-
end
|
38
|
-
|
39
35
|
private
|
40
36
|
|
41
37
|
def options
|
data/lib/ivapi/default.rb
CHANGED
@@ -23,11 +23,11 @@ module Ivapi
|
|
23
23
|
MIDDLEWARE = RACK_BUILDER_CLASS.new do |builder|
|
24
24
|
builder.request :json
|
25
25
|
|
26
|
-
builder.use Ivapi::Response::RaiseError
|
27
26
|
builder.use FaradayMiddleware::FollowRedirects
|
28
27
|
builder.use FaradayMiddleware::Mashify
|
29
28
|
builder.use Ivapi::Response::RenameKeys
|
30
29
|
builder.use FaradayMiddleware::ParseJson
|
30
|
+
builder.use Ivapi::Response::RaiseError
|
31
31
|
|
32
32
|
builder.adapter Faraday.default_adapter
|
33
33
|
end
|
@@ -39,7 +39,7 @@ module Ivapi
|
|
39
39
|
Hash[Ivapi::Configuration.keys.map { |key| [key, send(key)] }]
|
40
40
|
end
|
41
41
|
|
42
|
-
# Default
|
42
|
+
# Default Ivapi username for Basic Auth from ENV
|
43
43
|
# @return [String]
|
44
44
|
def username
|
45
45
|
ENV['IVAPI_USERNAME']
|
@@ -56,7 +56,7 @@ module Ivapi
|
|
56
56
|
MIDDLEWARE
|
57
57
|
end
|
58
58
|
|
59
|
-
# Default
|
59
|
+
# Default Ivapi password for Basic Auth from ENV
|
60
60
|
# @return [String]
|
61
61
|
def password
|
62
62
|
ENV['IVAPI_PASSWORD']
|
data/lib/ivapi/version.rb
CHANGED
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.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justas Palumickas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|