steamwebapi 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18246c0e9973ef30a728216a753ad8ae71344ab1
4
- data.tar.gz: 584b05177f2ba66a996620a4f018a6af6705e387
3
+ metadata.gz: 1625e199aa2355d794b7b7d0f39677aa5c4f4ec6
4
+ data.tar.gz: 371bad280ff81336ce78e87f692750c12e6389f8
5
5
  SHA512:
6
- metadata.gz: e5428af36f211c7c3ab89ffec092f5113f868456ec543599e2154d1ce647311544f5cbae78f7015274898b503386e72ecee84e325e4079a19ec70c59f3652974
7
- data.tar.gz: c0b362774bba21b102496664538370ab68c358d2cec0d15a326c0c775c9c344320d19968ab5a2d88ead4bcd299ee114b78808507b75d399d0ceda40ab8c86b65
6
+ metadata.gz: 4b14fde02325d91600fe83ea92dc3dd6a7ada19b2cb517d83e03ba22dce867482991f8918666b429fc095b347023ccdea48fb714d44c634cf111e06e246f5833
7
+ data.tar.gz: 0dbe1574c1da5b3ab6047f96c70001568f8a79cd126c14465ea8eff4fcd8cfb0dc79b625dbd661569b1e6681019b96b60ce5f23194cb511b9b5428ae914969ad
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
- Steamwebapi
1
+ Steam web API
2
2
  ===
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/steamwebapi.svg)](http://badge.fury.io/rb/steamwebapi)
5
+
4
6
  Steam Web API library in Ruby. Retrieves and parses JSON data. If you want more information about the API go to:
5
7
 
6
8
  * http://steamcommunity.com/dev
@@ -15,11 +17,11 @@ Steam Web API library in Ruby. Retrieves and parses JSON data. If you want more
15
17
 
16
18
  Open up your terminal or cmd or whatever and copypasta this code
17
19
 
18
- $ gem install steamwebapi
20
+ gem install steamwebapi
19
21
 
20
22
  To use it in your application, add the following to your Gemfile:
21
23
 
22
- gem 'steamwebapi'
24
+ gem 'steamwebapi', '~> 1.0.0'
23
25
 
24
26
  ## Usage
25
27
 
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  require 'steamwebapi/steamapi'
2
3
  require 'steamwebapi/user'
3
4
  require 'steamwebapi/app'
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  require_relative 'steamapi'
2
3
 
3
4
  module SteamApp
@@ -1,15 +1,16 @@
1
+ # encoding: UTF-8
1
2
  require 'net/http'
2
3
  require 'json'
4
+ require 'rexml/document'
3
5
 
4
6
  module SteamAPI
5
7
  def self.get(interface, method, version, args = {})
6
- json = true
7
8
  if args.empty?
8
9
  raise 'cannot retrieve data without arguments'
9
10
  else
10
11
  i = ''
11
12
  args.each do |key, value|
12
- # the first key needs ? in front of it
13
+ # the first argument needs ? in front of it
13
14
  if key == args.keys[0]
14
15
  i += "?#{key}=#{value}"
15
16
  else
@@ -19,10 +20,13 @@ module SteamAPI
19
20
  domain = "http://api.steampowered.com/#{interface}/#{method}/#{version}/#{i}"
20
21
  end
21
22
  uri = Net::HTTP.get(URI(domain))
22
- if json
23
- JSON.parse(uri)
23
+ case args.key('format')
24
+ when 'xml'
25
+ uri
26
+ when 'vdf'
27
+ uri
24
28
  else
25
- raise 'data not in JSON format'
29
+ JSON.parse(uri)
26
30
  end
27
31
  end
28
- end
32
+ end
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  require_relative 'steamapi'
2
3
 
3
4
  module SteamUser
@@ -4,11 +4,11 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "steamwebapi"
7
- spec.version = "1.0.0"
7
+ spec.version = "1.0.1"
8
8
  spec.authors = ["kuzmaa"]
9
9
  spec.email = [""]
10
10
  spec.summary = %q{Steam Web API library in Ruby}
11
- spec.description = %q{Retrieves and parses JSON data, which it retrieves from http://api.steampowered.com}
11
+ spec.description = %q{Retrieves and parses JSON data, which it gets from http://api.steampowered.com}
12
12
  spec.homepage = "https://github.com/kuzmaa/steamwebapi"
13
13
  spec.license = "MIT"
14
14
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steamwebapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kuzmaa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-09 00:00:00.000000000 Z
11
+ date: 2014-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- description: Retrieves and parses JSON data, which it retrieves from http://api.steampowered.com
41
+ description: Retrieves and parses JSON data, which it gets from http://api.steampowered.com
42
42
  email:
43
43
  - ''
44
44
  executables: []