pubg-rb 0.1.3 → 0.1.4

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: e85f90dac7a3df7f9321a137ddb8d12f47b13393
4
- data.tar.gz: 41f776c2156d7f6592c180a830c97a8b0f96feaa
3
+ metadata.gz: 902b2742f3e511539295e0a45dba53ea0526df67
4
+ data.tar.gz: dcc74ae3902de37d2a912622a82ae54b79904f6f
5
5
  SHA512:
6
- metadata.gz: bf9e50cfed1a4d4446bc3507c6df0d8ed1b1a2e49836dde51b735e168b201e4104a7cfdff1001fae0a9f93864a7d91970e51f3df72d4ce46f9e79286879afc05
7
- data.tar.gz: b5015d3bb81f99ed25af9dee4a842a1f44cebff198d90f281ec64418eb678a07bebbcd59aacc0396da9baf03108f7d3e6cc185239d05f1e9565b5e2ebcbcce06
6
+ metadata.gz: 59244d54c66eacd1e9cef1c23301ae2d9c8dfaea3ba2ef762c34f8b05fb839f666d248278746fb72fb3877d76991952ed264e7ae117b6b3fd43fd7b89a73ea47
7
+ data.tar.gz: 720c414a8ad42e9a90679c86476b080557fb3add746e0a68af427177c0f25be4a95847a309285762bf72b1c4520add02048e53f259a0a4893b3dc1d14d6db75b
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pubg-rb (0.1.3)
4
+ pubg-rb (0.1.4)
5
5
  oj (~> 3.5.1)
6
6
  typhoeus (~> 1.3.0)
7
7
 
data/README.md CHANGED
@@ -4,6 +4,8 @@ Wraps the PUBG REST API for convenient access from ruby applications.
4
4
 
5
5
  Documentation for the PUBG REST API can be found here: [https://documentation.playbattlegrounds.com/en/introduction.html](https://documentation.playbattlegrounds.com/en/introduction.html)
6
6
 
7
+ Notice this wrapper is still in development. Im sure some things are broken when dealing with PC match data. Ive been testing using an xbox account.
8
+
7
9
  ## Installation
8
10
  To install using [Bundler](https://bundler.io/) grab the latest stable version:
9
11
 
@@ -31,7 +33,7 @@ make install
31
33
  ```
32
34
  ## Getting Started
33
35
  ### Setup Work
34
- ```
36
+ ```ruby
35
37
  require "pubg-rb"
36
38
 
37
39
  # put your own credentials here
@@ -43,10 +45,10 @@ platform_region = "xbox-na"
43
45
  ```
44
46
 
45
47
  ### Make a Call
46
- an example for getting the seasons
48
+ an example for getting the status
47
49
 
48
- ```
49
- @pubg.seasons
50
+ ```ruby
51
+ @pubg.status
50
52
  ```
51
53
 
52
54
  ---
@@ -56,18 +58,19 @@ an example for getting the seasons
56
58
  ### -CLIENT
57
59
  Set up a client to talk to the PUBG API.
58
60
 
59
- ```
61
+ ```ruby
60
62
  @pubg = PUBG::Client.new("api_key", "platform_region")
61
63
  ```
62
- - note if platform_region is set on the client it does not need to be set elsewhere
64
+ - note if `platform_region` is set on the client or environment variable`PUBG_PLATFORM_REGION` it does not need to be set elsewhere
63
65
 
64
66
  ### -PLAYERS
65
67
  ##### /players
66
68
  Get a collection of players by name's.
67
69
 
68
- ```
69
- players = @pubg.players("acidtib,ImAverageSniper")
70
+ ```ruby
71
+ players = @pubg.players("Optional_platform_region", "acidtib,ImAverageSniper")
70
72
 
73
+ players.original
71
74
  players.data
72
75
  players.links
73
76
  players.meta
@@ -75,9 +78,10 @@ players.meta
75
78
 
76
79
  Get a collection of players by player_id's.
77
80
 
78
- ```
79
- players = @pubg.players("account.c975e15685614c5f9da44f25598f7670,account.c6d7393a0fed4613973e3d89582f23fc")
81
+ ```ruby
82
+ players = @pubg.players("Optional_platform_region", "account.c975e15685614c5f9da44f25598f7670,account.c6d7393a0fed4613973e3d89582f23fc")
80
83
 
84
+ players.original
81
85
  players.data
82
86
  players.links
83
87
  players.meta
@@ -86,9 +90,10 @@ players.meta
86
90
  ##### /players/{player_id}
87
91
  Get a single player by the `player_id`.
88
92
 
89
- ```
90
- player = @pubg.player("account.c975e15685614c5f9da44f25598f7670")
93
+ ```ruby
94
+ player = @pubg.player("Optional_platform_region", "account.c975e15685614c5f9da44f25598f7670")
91
95
 
96
+ player.original
92
97
  player.data
93
98
  player.links
94
99
  player.meta
@@ -101,9 +106,10 @@ player.season("division.bro.official.xb-pre1")
101
106
  ##### /players/{player_id}/seasons/{season_id}
102
107
  Get season information for a single player.
103
108
 
104
- ```
109
+ ```ruby
105
110
  season = player.season("xbox-na", "division.bro.official.xb-pre1")
106
111
 
112
+ season.original
107
113
  season.data
108
114
  season.links
109
115
  season.meta
@@ -112,7 +118,7 @@ season.meta
112
118
  ### -MATCHES
113
119
  #### /matches/{match_id}
114
120
 
115
- ```
121
+ ```ruby
116
122
  match = @pubg.match("895e77a8-0efa-492b-b256-3e9bf79097e6")
117
123
 
118
124
  match.data
@@ -128,20 +134,21 @@ match.roster
128
134
  ##### /status
129
135
  Check the status of the API.
130
136
 
131
- ```
137
+ ```ruby
132
138
  status = @pubg.status
133
139
 
140
+ status.original
134
141
  status.data
135
- status.attributes
136
142
  ```
137
143
 
138
144
  ### -SEASONS
139
145
  ##### /seasons
140
146
  Get a list of available seasons.
141
147
 
142
- ```
143
- seasons = @pubg.seasons
148
+ ```ruby
149
+ seasons = @pubg.seasons("Optional_platform_region")
144
150
 
151
+ seasons.original
145
152
  seasons.data
146
153
  seasons.links
147
154
  seasons.meta
@@ -150,10 +157,10 @@ seasons.meta
150
157
  ### -TELEMETRY
151
158
  Telemetry provides further insight into a match.
152
159
 
153
- ```
160
+ ```ruby
154
161
  telemetry = @pubg.telemetry("https://telemetry-cdn...c30c-telemetry.json")
155
162
 
156
- telemetry.data
163
+ telemetry.original
157
164
  telemetry.playerLogin
158
165
  telemetry.playerCreate
159
166
  telemetry.playerPosition
@@ -3,7 +3,6 @@ require "pubg/pub_error"
3
3
  require "pubg/client"
4
4
  require "pubg/status"
5
5
  require "pubg/player"
6
- require "pubg/players"
7
6
  require "pubg/match"
8
7
  require "pubg/telemetry"
9
8
  require "pubg/seasons"
@@ -29,7 +29,7 @@ module PUBG
29
29
  params = "?filter[playerNames]=#{items}"
30
30
  end
31
31
  path = "/shards/#{platform_region}/players#{params}"
32
- PUBG::Players.new(Client.request(path))
32
+ PUBG::Player.new(Client.request(path), true)
33
33
  end
34
34
 
35
35
  def match(platform_region=$platform_region, match_id)
@@ -5,7 +5,8 @@ module PUBG
5
5
  require "pubg/player/matches"
6
6
  require "pubg/player/season"
7
7
 
8
- def initialize(args)
8
+ def initialize(args, s=false)
9
+ @s = s
9
10
  @args = args
10
11
  end
11
12
 
@@ -14,7 +15,15 @@ module PUBG
14
15
  end
15
16
 
16
17
  def data
17
- Data.new(@args["data"])
18
+ if @s
19
+ data = []
20
+ @args["data"].each do |player|
21
+ data << Data.new(player)
22
+ end
23
+ return data
24
+ else
25
+ Data.new(@args["data"])
26
+ end
18
27
  end
19
28
 
20
29
  def links
@@ -13,7 +13,7 @@ module PUBG
13
13
  @args = args
14
14
  end
15
15
 
16
- def data
16
+ def original
17
17
  @args
18
18
  end
19
19
 
@@ -1,3 +1,3 @@
1
1
  module PUBG
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubg-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dainel Vera
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-04 00:00:00.000000000 Z
11
+ date: 2018-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -181,7 +181,6 @@ files:
181
181
  - lib/pubg/player/season/data/relationships/player.rb
182
182
  - lib/pubg/player/season/data/relationships/season.rb
183
183
  - lib/pubg/player/season/data/stats.rb
184
- - lib/pubg/players.rb
185
184
  - lib/pubg/pub_error.rb
186
185
  - lib/pubg/seasons.rb
187
186
  - lib/pubg/seasons/data.rb
@@ -1,20 +0,0 @@
1
- module PUBG
2
- class Players
3
-
4
- def initialize(args)
5
- @args = args
6
- end
7
-
8
- def data
9
- @args["data"]
10
- end
11
-
12
- def links
13
- @args["links"]
14
- end
15
-
16
- def meta
17
- @args["meta"]
18
- end
19
- end
20
- end