minecraft-jsonapi 0.0.7 → 0.0.8

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1f253fe7ce0299620badd91af39884850f54150a
4
+ data.tar.gz: 1566ae09a9cfe701aba3a3581a51b25bfd62bc58
5
+ SHA512:
6
+ metadata.gz: 1dd3552d3839b1c1e76a22caa690ccbaf232fa06de1c528978470c0697e3071416fe483dbe25e2e4b5e0be253793899aa0e6a12d8a52c62e2e44db75d981cb49
7
+ data.tar.gz: 3c3213a5241499cf52cc78ea167f5c4fbcfb96fca0082b407d201ea357c2fd1b1f02be4da3902efdca9baa2997ada5dfb5ae016264d95ae76352cdee7366ea65
data/README.md CHANGED
@@ -23,9 +23,10 @@ require 'minecraft-jsonapi'
23
23
 
24
24
  api = Minecraft::JSONAPI.new(host: "123.45.6.78", port: 20059, username: "admin", password: "12345", salt: "mmm")
25
25
 
26
+ # The common (non-namespaced) commands are sent as regular Ruby methods with optional parameters:
26
27
  api.sendMessage "Dinnerbone", "Hello, Dinnerbone!"
27
28
 
28
- # Namespaced commands can be sent via blocks...
29
+ # Namespaced commands can be sent via blocks:
29
30
  api.permissions do |perms|
30
31
  perms.addPlayerToGroup "Fustrate", "Jolly Good Fellows"
31
32
  groups = perms.getGroups
@@ -1,13 +1,12 @@
1
- require 'minecraft-jsonapi/version'
2
- require 'minecraft-jsonapi/namespace'
3
- require 'minecraft-jsonapi/jsonapi'
4
- require 'minecraft-jsonapi/response'
5
-
6
1
  require 'json'
7
2
  require 'digest/sha2'
8
3
  require 'net/http'
9
4
  require 'cgi'
10
5
 
6
+ %w{version jsonapi namespace response}.each do |file|
7
+ require "minecraft-jsonapi/#{file}"
8
+ end
9
+
11
10
  module Minecraft
12
11
  module JSONAPI
13
12
  CALL_URL = 'http://%{host}:%{port}/api/call?method=%{method}&args=%{args}&key=%{key}'
@@ -47,9 +46,9 @@ module Minecraft
47
46
 
48
47
  def self.url_encoded_json(data)
49
48
  begin
50
- CGI.escape JSON.generate data
49
+ URI.escape JSON.generate data
51
50
  rescue JSON::GeneratorError
52
- CGI.escape data
51
+ URI.escape data
53
52
  end
54
53
  end
55
54
  end
@@ -1,6 +1,8 @@
1
1
  module Minecraft
2
2
  module JSONAPI
3
3
  class JSONAPI
4
+ attr_reader :host, :port, :username, :salt
5
+
4
6
  def initialize(options = {})
5
7
  raise "A username must be provided." if options[:username].nil?
6
8
  raise "A password must be provided." if options[:password].nil?
@@ -1,6 +1,8 @@
1
1
  module Minecraft
2
2
  module JSONAPI
3
3
  class Response
4
+ attr_reader :result, :source, :response
5
+
4
6
  def initialize(data)
5
7
  data = JSON.parse data
6
8
 
@@ -15,18 +17,6 @@ module Minecraft
15
17
  @response = data["success"]
16
18
  end
17
19
  end
18
-
19
- def result
20
- @result
21
- end
22
-
23
- def source
24
- @source
25
- end
26
-
27
- def response
28
- @response
29
- end
30
20
  end
31
21
  end
32
22
  end
@@ -1,5 +1,5 @@
1
1
  module Minecraft
2
2
  module JSONAPI
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minecraft-jsonapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
5
- prerelease:
4
+ version: 0.0.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Steven Hoffman
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-22 00:00:00.000000000 Z
11
+ date: 2013-07-01 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: A simple Ruby gem to interact with a Minecraft server running the JSONAPI
15
14
  mod
@@ -33,27 +32,26 @@ files:
33
32
  - test/test_minecraft-jsonapi.rb
34
33
  homepage: https://github.com/Fustrate/minecraft-jsonapi
35
34
  licenses: []
35
+ metadata: {}
36
36
  post_install_message:
37
37
  rdoc_options: []
38
38
  require_paths:
39
39
  - lib
40
40
  required_ruby_version: !ruby/object:Gem::Requirement
41
- none: false
42
41
  requirements:
43
- - - ! '>='
42
+ - - '>='
44
43
  - !ruby/object:Gem::Version
45
44
  version: '0'
46
45
  required_rubygems_version: !ruby/object:Gem::Requirement
47
- none: false
48
46
  requirements:
49
- - - ! '>='
47
+ - - '>='
50
48
  - !ruby/object:Gem::Version
51
49
  version: '0'
52
50
  requirements: []
53
51
  rubyforge_project:
54
- rubygems_version: 1.8.24
52
+ rubygems_version: 2.0.3
55
53
  signing_key:
56
- specification_version: 3
54
+ specification_version: 4
57
55
  summary: A simple Ruby gem to interact with a Minecraft server running the JSONAPI
58
56
  mod
59
57
  test_files: