steamworks 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -8
- data/lib/steamworks/api.rb +5 -3
- data/lib/steamworks/configure.rb +11 -0
- data/lib/steamworks/core_ext/configurable.rb +42 -0
- data/lib/steamworks/version.rb +1 -1
- data/lib/steamworks.rb +4 -2
- metadata +4 -3
- data/lib/steamworks/configurable.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88601346707fc11c18002353b8e70d0e8375fd559c1a70a2d5ddb10eff13565f
|
4
|
+
data.tar.gz: 65ab3bf4f736e5984e221610607a45d87a9da12cc2a6fc671a0787a0a448b329
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dd57be9464caeb61287788d4a7d751f3191bebde1c19c3eaf67fae0690270e44a94655f895d68f3c1aa78d9f66c4b60d5337652a896e05d748fc1211aea1d6f
|
7
|
+
data.tar.gz: 195a73fd61f26a0e9d058521691b9b98183bf3e95bd0a3033eaff4511954f5577e6ca97016fb10eac5a389177731bcd81260ce126783584b98e2ec2e2a8a1b8b
|
data/README.md
CHANGED
@@ -12,16 +12,16 @@ Steamworks Web API client for Ruby.
|
|
12
12
|
## Example
|
13
13
|
|
14
14
|
```ruby
|
15
|
-
require
|
15
|
+
require "steamworks"
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
config.appid = "your_steam_app_id"
|
22
|
-
config.identity = "your_steam_identity"
|
17
|
+
class Steamworks::Configure
|
18
|
+
set :key, "key"
|
19
|
+
set :appid, "appid"
|
20
|
+
set :identity, "identity"
|
23
21
|
end
|
24
22
|
|
25
|
-
|
23
|
+
steamworks_api = Steamworks::API.new
|
24
|
+
|
25
|
+
steamworks_api.authenticate_user_ticket(ticket: params[:ticket]).to_json
|
26
26
|
|
27
27
|
```
|
data/lib/steamworks/api.rb
CHANGED
@@ -2,12 +2,14 @@
|
|
2
2
|
|
3
3
|
module Steamworks
|
4
4
|
class API
|
5
|
-
include Steamworks::Configureable
|
6
|
-
attr_accessor :key, :appid, :identity
|
7
|
-
|
8
5
|
def initialize
|
9
6
|
@partner_conn = Steamworks::Connection.new(gateway: :partner)
|
10
7
|
@public_conn = Steamworks::Connection.new(gateway: :public)
|
8
|
+
|
9
|
+
config = Steamworks::Configure
|
10
|
+
@key = config.key
|
11
|
+
@appid = config.appid
|
12
|
+
@identity = config.identity
|
11
13
|
end
|
12
14
|
|
13
15
|
# https://partner.steamgames.com/doc/webapi/ISteamUserAuth#AuthenticateUserTicket
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# From https://github.com/midori-rb/midori.rb/blob/master/lib/midori/core_ext/configurable.rb
|
4
|
+
|
5
|
+
module Configurable
|
6
|
+
# Sets an option to the given value.
|
7
|
+
# @param [Symbol] option the name of config
|
8
|
+
# @param [Object] value value to the name
|
9
|
+
# @param [Boolean] read_only Generate option= method or not
|
10
|
+
# @return [nil] nil
|
11
|
+
def set(option, value = (not_set = true), read_only: false)
|
12
|
+
raise ArgumentError if not_set
|
13
|
+
|
14
|
+
setter = proc { |val| set option, val }
|
15
|
+
getter = proc { value }
|
16
|
+
|
17
|
+
define_singleton("#{option}=", setter) unless read_only
|
18
|
+
define_singleton(option, getter)
|
19
|
+
define_singleton("#{option}?", "!!#{option}") unless method_defined? "#{option}?"
|
20
|
+
|
21
|
+
self
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
# Dynamically defines a method on settings.
|
27
|
+
# @param [String] name method name
|
28
|
+
# @param [Proc] content method content
|
29
|
+
# @return [nil] nil
|
30
|
+
def define_singleton(name, content = Proc.new)
|
31
|
+
singleton_class.class_eval do
|
32
|
+
undef_method(name) if method_defined? name
|
33
|
+
if content.is_a?(String)
|
34
|
+
# rubocop:disable Style/DocumentDynamicEvalDefinition
|
35
|
+
class_eval("def #{name}() #{content}; end", __FILE__, __LINE__)
|
36
|
+
# rubocop:enable Style/DocumentDynamicEvalDefinition
|
37
|
+
else
|
38
|
+
define_method(name, &content)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/steamworks/version.rb
CHANGED
data/lib/steamworks.rb
CHANGED
@@ -4,7 +4,9 @@ require "faraday"
|
|
4
4
|
|
5
5
|
require_relative "steamworks/version"
|
6
6
|
require_relative "steamworks/errors"
|
7
|
-
require_relative "steamworks/configurable"
|
8
|
-
require_relative "steamworks/connection"
|
9
7
|
|
8
|
+
require_relative "steamworks/core_ext/configurable"
|
9
|
+
require_relative "steamworks/configure"
|
10
|
+
|
11
|
+
require_relative "steamworks/connection"
|
10
12
|
require_relative "steamworks/api"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: steamworks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kowalski Dark
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -38,8 +38,9 @@ files:
|
|
38
38
|
- Rakefile
|
39
39
|
- lib/steamworks.rb
|
40
40
|
- lib/steamworks/api.rb
|
41
|
-
- lib/steamworks/
|
41
|
+
- lib/steamworks/configure.rb
|
42
42
|
- lib/steamworks/connection.rb
|
43
|
+
- lib/steamworks/core_ext/configurable.rb
|
43
44
|
- lib/steamworks/errors.rb
|
44
45
|
- lib/steamworks/version.rb
|
45
46
|
homepage: https://github.com/yet-another-ai/steamworks.rb
|