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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36b8caa71c8c90b8859c0b4997cf66402b283fa7
4
- data.tar.gz: fe5992ef9ab6d93f82d94b858e7cfdbff8ef8599
3
+ metadata.gz: 6c58c39ab0e09863daded145c3d43bf043e7176c
4
+ data.tar.gz: 9a0e2af3fb2f2686ea5dffac656769ff8ae71c3e
5
5
  SHA512:
6
- metadata.gz: 0f74ff49ba94ba64da6ea041a3fe91392187ece35ea400769c512cf86252fae18f15cfb06ba7c49f628680e4dfc6eafd44b2570f38e790b79383e76ff3a9507c
7
- data.tar.gz: 154ee0a59ccddb3e053a6818343aad2c44b8141ac9c3f13f62a7cf70820e51e736c479d525a8ad64b187c14f972687bba7612ace1b68883275225cb9b3d80cdc
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`
@@ -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
  #
@@ -22,7 +22,7 @@ module Ivapi
22
22
  response
23
23
  end
24
24
 
25
- def connection(options = {})
25
+ def connection(_options = {})
26
26
  conn_opts = client.connection_options
27
27
  conn_opts[:url] = client.api_endpoint
28
28
  conn_opts[:builder] = client.middleware if client.middleware
@@ -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
- id: server_id,
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({ command: 'server_firewall', id: server_id })
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({ command: 'server_change', id: server_id })
136
+ params = options.merge(command: 'server_change', id: server_id)
141
137
  get('/json.php', params)
142
138
  end
143
139
 
@@ -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
@@ -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 GitHub username for Basic Auth from ENV
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 GitHub password for Basic Auth from ENV
59
+ # Default Ivapi password for Basic Auth from ENV
60
60
  # @return [String]
61
61
  def password
62
62
  ENV['IVAPI_PASSWORD']
@@ -1,3 +1,3 @@
1
1
  module Ivapi
2
- VERSION = '1.1.2'
2
+ VERSION = '1.1.3'
3
3
  end
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.2
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-09-16 00:00:00.000000000 Z
11
+ date: 2014-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable