pubg-rb 0.1.0 → 0.1.1

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: 404b970804250c2138b8a0f103f61108db4dfedc
4
- data.tar.gz: '0798e8231f91bb5c1d20b4503a92b9ca5c2bb6ea'
3
+ metadata.gz: 2a91baa570838d9750a1fb9d5bc8a031fe7e429c
4
+ data.tar.gz: 0eb72038aa58190471e45979af9d6e3ac548c6da
5
5
  SHA512:
6
- metadata.gz: c7a76b5875f90cefee2018184c354b451d039c92396c1ea37bb50cea3265c62cb1d4a750941706089ef6cb7fe9c324efa7a5a8d00ff93b974c04aed1f9d3d430
7
- data.tar.gz: 525152229c88fc134261745bacefbe6d167f1dc15a9e08bd34d42fd5afe55315d7d6a014d76a0b315af66b2805955174e0e500c80e09cffbbf26976000cf73e7
6
+ metadata.gz: 76d4bd504a9c0408cf788818d17cd0935cd8550b4a3cd45e3d6c6655e09ba76f110fb5db64332dd364455234f9184a71826c2d3df0fb7b84827970df52932acf
7
+ data.tar.gz: 55570f934acfcd610c38ff57b5b7dff0610362edc109c97a20f48b87746fa1528f2315a1e3e62e7f3d718e823aa546b1a8d4f84b3b142f98c027a819293b42aa
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pubg-rb (0.1.0)
4
+ pubg-rb (0.1.1)
5
5
  oj (~> 3.5.1)
6
6
  typhoeus (~> 1.3.0)
7
7
 
data/Makefile CHANGED
@@ -12,4 +12,7 @@ setup:
12
12
  ./bin/setup
13
13
 
14
14
  test:
15
- rake spec
15
+ rake spec
16
+
17
+ release:
18
+ bundle exec rake release
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Pubg-rb
1
+ # pubg-rb [![Gem Version](https://img.shields.io/gem/v/pubg-rb.svg)](https://rubygems.org/gems/pubg-rb)
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pubg`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Wraps the PUBG REST API for convenient access from ruby applications.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
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
7
  ## Installation
8
8
  To install using [Bundler](https://bundler.io/) grab the latest stable version:
@@ -29,10 +29,6 @@ git@github.com:pubstatsg/pubg-rb.git
29
29
  cd pubg-rb
30
30
  make install
31
31
  ```
32
-
33
- ## Battlegrounds API Documenation
34
- [API Documentation Here](https://documentation.playbattlegrounds.com/en/introduction.html)
35
-
36
32
  ## Getting Started
37
33
  ### Setup Work
38
34
  ```
@@ -47,6 +43,7 @@ platform_region = "xbox-na"
47
43
  ```
48
44
 
49
45
  ### Make a Call
46
+ an example for getting the seasons
50
47
 
51
48
  ```
52
49
  @pubg.seasons
@@ -57,7 +54,7 @@ platform_region = "xbox-na"
57
54
  ## Usage
58
55
 
59
56
  ### -CLIENT
60
- Set up a client to talk to the PUBG API
57
+ Set up a client to talk to the PUBG API.
61
58
 
62
59
  ```
63
60
  @pubg = PUBG::Client.new("api_key", "platform_region")
@@ -66,30 +63,50 @@ Set up a client to talk to the PUBG API
66
63
 
67
64
  ### -PLAYERS
68
65
  ##### /players
69
- Get a collection of players by name's
66
+ Get a collection of players by name's.
70
67
 
71
68
  ```
72
69
  players = @pubg.players("acidtib,ImAverageSniper")
70
+
71
+ players.data
72
+ players.links
73
+ players.meta
73
74
  ```
74
75
 
75
- Get a collection of players by player_id's
76
+ Get a collection of players by player_id's.
76
77
 
77
78
  ```
78
79
  players = @pubg.players("account.c975e15685614c5f9da44f25598f7670,account.c6d7393a0fed4613973e3d89582f23fc")
80
+
81
+ players.data
82
+ players.links
83
+ players.meta
79
84
  ```
80
85
 
81
86
  ##### /players/{player_id}
82
- Get a single player by the `player_id`
87
+ Get a single player by the `player_id`.
83
88
 
84
89
  ```
85
90
  player = @pubg.player("account.c975e15685614c5f9da44f25598f7670")
91
+
92
+ player.data
93
+ player.links
94
+ player.meta
95
+ player.player
96
+ player.playerId
97
+ player.matches
98
+ player.season("division.bro.official.xb-pre1")
86
99
  ```
87
100
 
88
101
  ##### /players/{player_id}/seasons/{season_id}
89
- Get season information for a single player
102
+ Get season information for a single player.
90
103
 
91
104
  ```
92
105
  season = player.season("xbox-na", "division.bro.official.xb-pre1")
106
+
107
+ season.data
108
+ season.links
109
+ season.meta
93
110
  ```
94
111
 
95
112
  ### -MATCHES
@@ -97,14 +114,25 @@ season = player.season("xbox-na", "division.bro.official.xb-pre1")
97
114
 
98
115
  ```
99
116
  match = @pubg.match("895e77a8-0efa-492b-b256-3e9bf79097e6")
117
+
118
+ match.data
119
+ match.included
120
+ match.links
121
+ match.meta
122
+ match.telemetry
123
+ match.participants
124
+ match.roster
100
125
  ```
101
126
 
102
127
  ### -STATUS
103
128
  ##### /status
104
- Check the status of the API
129
+ Check the status of the API.
105
130
 
106
131
  ```
107
132
  status = @pubg.status
133
+
134
+ status.data
135
+ status.attributes
108
136
  ```
109
137
 
110
138
  ### -SEASONS
@@ -113,13 +141,34 @@ Get a list of available seasons.
113
141
 
114
142
  ```
115
143
  seasons = @pubg.seasons
144
+
145
+ seasons.data
146
+ seasons.links
147
+ seasons.meta
148
+ ```
149
+
150
+ ### -TELEMETRY
151
+ Telemetry provides further insight into a match.
152
+
153
+ ```
154
+ telemetry = @pubg.telemetry("https://telemetry-cdn...c30c-telemetry.json")
155
+
156
+ telemetry.data
157
+ telemetry.playerLogin
158
+ telemetry.playerCreate
159
+ telemetry.playerPosition
160
+ telemetry.playerAttack
161
+ telemetry.itemPickup
162
+ telemetry.itemEquip
163
+ telemetry.itemUnequip
164
+ telemetry.vehicleRide
116
165
  ```
117
166
 
118
167
  ## Development
119
168
 
120
169
  After checking out the repo, run `make setup` to install dependencies. Then, run `make test` to run the tests. You can also run `make console` for an interactive prompt that will allow you to experiment.
121
170
 
122
- To install this gem onto your local machine, run `make install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
171
+ To install this gem onto your local machine, run `make install`. To release a new version, update the version number in `version.rb`, and then run `make release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
123
172
 
124
173
  ## Contributing
125
174
 
@@ -9,6 +9,14 @@ module PUBG
9
9
  $platform_region = platform_region || ENV["PUBG_PLATFORM_REGION"]
10
10
  end
11
11
 
12
+ def api_key
13
+ $api_key
14
+ end
15
+
16
+ def platform_region
17
+ $platform_region
18
+ end
19
+
12
20
  def player(platform_region=$platform_region, player_id)
13
21
  path = "/shards/#{platform_region}/players/#{player_id}"
14
22
  PUBG::Player.new(Client.request(path))
@@ -21,12 +29,12 @@ module PUBG
21
29
  params = "?filter[playerNames]=#{items}"
22
30
  end
23
31
  path = "/shards/#{platform_region}/players#{params}"
24
- PUBG::Players.new(request(path))
32
+ PUBG::Players.new(Client.request(path))
25
33
  end
26
34
 
27
35
  def match(platform_region=$platform_region, match_id)
28
36
  path = "/shards/#{platform_region}/matches/#{match_id}"
29
- PUBG::Match.new(request(path))
37
+ PUBG::Match.new(Client.request(path))
30
38
  end
31
39
 
32
40
  def telemetry(url)
@@ -35,7 +43,7 @@ module PUBG
35
43
 
36
44
  def seasons(platform_region=$platform_region)
37
45
  path = "/shards/#{platform_region}/seasons"
38
- PUBG::Seasons.new(request(path))
46
+ PUBG::Seasons.new(Client.request(path))
39
47
  end
40
48
 
41
49
  def status
@@ -4,29 +4,46 @@ module PUBG
4
4
  require "pubg/match/telemetry"
5
5
  require "pubg/match/roster"
6
6
 
7
- attr_reader :data, :included, :links, :meta, :telemetry, :participants, :roster
8
-
9
7
  def initialize(args)
10
- @data = args["data"]
11
- @included = args["included"]
12
- @links = args["links"]
13
- @meta = args["meta"]
14
- @participants = []
15
- @roster = []
16
- @telemetry = Telemetry.new(@included.select {|data| data["type"] == "asset" }.first)
17
- included_apart
18
- end
19
-
20
- def included_apart
21
- participants = @included.select {|data| data["type"] == "participant" }
8
+ @args = args
9
+ end
10
+
11
+ def data
12
+ @args["data"]
13
+ end
14
+
15
+ def included
16
+ @args["included"]
17
+ end
18
+
19
+ def links
20
+ @args["links"]
21
+ end
22
+
23
+ def meta
24
+ @args["meta"]
25
+ end
26
+
27
+ def telemetry
28
+ Telemetry.new(@args["included"].select {|data| data["type"] == "asset" }.first)
29
+ end
30
+
31
+ def participants
32
+ items = []
33
+ participants = @args["included"].select {|data| data["type"] == "participant" }
22
34
  participants.each do |participant|
23
- @participants << Participants.new(participant)
35
+ items << Participants.new(participant)
24
36
  end
37
+ return items
38
+ end
25
39
 
26
- rosters = @included.select {|data| data["type"] == "roster" }
40
+ def roster
41
+ items = []
42
+ rosters = @args["included"].select {|data| data["type"] == "roster" }
27
43
  rosters.each do |roster|
28
- @roster << Roster.new(roster)
44
+ items << Roster.new(roster)
29
45
  end
46
+ return items
30
47
  end
31
48
  end
32
49
  end
@@ -4,25 +4,37 @@ module PUBG
4
4
  require "pubg/player/player"
5
5
  require "pubg/player/season"
6
6
 
7
- attr_reader :data, :links, :meta, :player, :matches, :season
8
-
9
7
  def initialize(args)
10
8
  if args["data"]
11
9
  args = args["data"]
12
10
  end
13
11
 
14
- @data = args
15
- @links = args["links"]
16
- @meta = args["meta"]
17
- @player = Player.new(@data["attributes"])
18
- @matches = get_matches
19
- @player_id = @data["id"]
20
- @season = nil
12
+ @args = args
13
+ end
14
+
15
+ def data
16
+ @args
17
+ end
18
+
19
+ def links
20
+ @args["links"]
21
+ end
22
+
23
+ def meta
24
+ @args["meta"]
25
+ end
26
+
27
+ def player
28
+ Player.new(@args["attributes"])
29
+ end
30
+
31
+ def playerId
32
+ @args["id"]
21
33
  end
22
34
 
23
- def get_matches
35
+ def matches
24
36
  matches = []
25
- @data["relationships"]["matches"]["data"].each do |match|
37
+ @args["relationships"]["matches"]["data"].each do |match|
26
38
  matches << Matches.new(match)
27
39
  end
28
40
  return matches
@@ -1,26 +1,29 @@
1
1
  module PUBG
2
2
  class Player
3
3
  class Season
4
- attr_reader :data, :links, :meta
5
-
6
4
  def initialize(platform_region=$platform_region, player_id, season_id)
7
5
  @platform_region = platform_region
8
6
  @player_id = player_id
9
7
  @season_id = season_id
10
8
 
11
- @data = nil
12
- @links = nil
13
- @meta = nil
9
+ @args = get_season
10
+ end
11
+
12
+ def data
13
+ @args["data"]
14
+ end
15
+
16
+ def links
17
+ @args["links"]
18
+ end
14
19
 
15
- get_season
20
+ def meta
21
+ @args["meta"]
16
22
  end
17
23
 
18
24
  def get_season
19
25
  path = "/shards/#{@platform_region}/players/#{@player_id}/seasons/#{@season_id}"
20
- season = Client.request(path)
21
- @data = season["data"]
22
- @links = season["links"]
23
- @meta = season["meta"]
26
+ Client.request(path)
24
27
  end
25
28
  end
26
29
  end
@@ -1,11 +1,20 @@
1
1
  module PUBG
2
2
  class Players
3
- attr_reader :data, :links, :meta
4
3
 
5
4
  def initialize(args)
6
- @data = args["data"]
7
- @links = args["links"]
8
- @meta = args["meta"]
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"]
9
18
  end
10
19
  end
11
20
  end
@@ -1,11 +1,20 @@
1
1
  module PUBG
2
2
  class Seasons
3
- attr_reader :data, :links, :meta
4
3
 
5
4
  def initialize(args)
6
- @data = args["data"]
7
- @links = args["links"]
8
- @meta = args["meta"]
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"]
9
18
  end
10
19
  end
11
20
  end
@@ -2,11 +2,16 @@ module PUBG
2
2
  class Status
3
3
  require "pubg/status/attributes"
4
4
 
5
- attr_reader :data, :attributes
6
-
7
5
  def initialize(args)
8
- @data = args["data"]
9
- @attributes = Attributes.new(@data["attributes"])
6
+ @args = args
10
7
  end
8
+
9
+ def data
10
+ @args["data"]
11
+ end
12
+
13
+ def attributes
14
+ Attributes.new(@args["data"]["attributes"])
15
+ end
11
16
  end
12
17
  end
@@ -1,56 +1,113 @@
1
1
  module PUBG
2
2
  class Telemetry
3
- require "pubg/telemetry/LogPlayerLogin"
4
- require "pubg/telemetry/LogPlayerCreate"
5
- require "pubg/telemetry/LogPlayerPosition"
6
- require "pubg/telemetry/LogPlayerAttack"
7
-
8
- attr_reader :events
3
+ require "pubg/telemetry/log_player_login"
4
+ require "pubg/telemetry/log_player_create"
5
+ require "pubg/telemetry/log_player_position"
6
+ require "pubg/telemetry/log_player_attack"
7
+ require "pubg/telemetry/log_item_equip"
8
+ require "pubg/telemetry/log_item_pickup"
9
+ require "pubg/telemetry/log_item_unequip"
10
+ require "pubg/telemetry/log_vehicle_ride"
9
11
 
10
12
  def initialize(args)
11
13
  @args = args
12
- @events = Array.new
13
- @LogPlayerLogin = nil
14
- @LogPlayerCreate = nil
15
- @LogPlayerPosition = nil
16
- @LogPlayerAttack = nil
17
-
18
- @LogItemPickup = nil
19
- @LogItemEquip = nil
20
- @LogItemUnequip = nil
21
- @LogVehicleRide = nil
22
- @LogMatchDefinition = nil
23
- @LogMatchStart = nil
24
- @LogGameStatePeriodic = nil
25
- @LogVehicleLeave = nil
26
- @LogPlayerTakeDamage = nil
27
- @LogPlayerLogout = nil
28
- @LogItemAttach = nil
29
- @LogItemDrop = nil
30
- @LogPlayerKill = nil
31
- @LogItemDetach = nil
32
- @LogItemUse = nil
33
- @LogCarePackageSpawn = nil
34
- @LogVehicleDestroy = nil
35
- @LogCarePackageLand = nil
36
- @LogMatchEnd = nil
37
-
38
- process_telemetry
39
- end
40
-
41
- def process_telemetry
42
- @args.each do |event|
43
- case event["_T"]
44
- when "LogPlayerLogin"
45
- @events << LogPlayerLogin.new(event)
46
- when "LogPlayerCreate"
47
- @events << LogPlayerCreate.new(event)
48
- when "LogPlayerPosition"
49
- @events << LogPlayerPosition.new(event)
50
- when "LogPlayerAttack"
51
- @events << LogPlayerAttack.new(event)
52
- end
53
- end
54
14
  end
15
+
16
+ def data
17
+ @args
18
+ end
19
+
20
+ def playerLogin
21
+ @args.select {|data| data["_T"] == "LogPlayerLogin" }
22
+ end
23
+
24
+ def playerCreate
25
+ @args.select {|data| data["_T"] == "LogPlayerCreate" }
26
+ end
27
+
28
+ def playerPosition
29
+ @args.select {|data| data["_T"] == "LogPlayerPosition" }
30
+ end
31
+
32
+ def playerAttack
33
+ @args.select {|data| data["_T"] == "LogPlayerAttack" }
34
+ end
35
+
36
+ def itemPickup
37
+ @args.select {|data| data["_T"] == "LogItemPickup" }
38
+ end
39
+
40
+ def itemEquip
41
+ @args.select {|data| data["_T"] == "LogItemEquip" }
42
+ end
43
+
44
+ def itemUnequip
45
+ @args.select {|data| data["_T"] == "LogItemUnequip" }
46
+ end
47
+
48
+ def vehicleRide
49
+ @args.select {|data| data["_T"] == "LogVehicleRide" }
50
+ end
51
+
52
+ def LogMatchDefinition
53
+
54
+ end
55
+
56
+ def LogMatchStart
57
+
58
+ end
59
+
60
+ def LogGameStatePeriodic
61
+
62
+ end
63
+
64
+ def LogVehicleLeave
65
+
66
+ end
67
+
68
+ def LogPlayerTakeDamage
69
+
70
+ end
71
+
72
+ def LogPlayerLogout
73
+
74
+ end
75
+
76
+ def LogItemAttach
77
+
78
+ end
79
+
80
+ def LogItemDrop
81
+
82
+ end
83
+
84
+ def LogPlayerKill
85
+
86
+ end
87
+
88
+ def LogItemDetach
89
+
90
+ end
91
+
92
+ def LogItemUse
93
+
94
+ end
95
+
96
+ def LogCarePackageSpawn
97
+
98
+ end
99
+
100
+ def LogVehicleDestroy
101
+
102
+ end
103
+
104
+ def LogCarePackageLand
105
+
106
+ end
107
+
108
+ def LogMatchEnd
109
+
110
+ end
111
+
55
112
  end
56
113
  end
@@ -0,0 +1,19 @@
1
+ module PUBG
2
+ class Telemetry
3
+ class LogItemEquip
4
+ require "pubg/telemetry/shared/character"
5
+ require "pubg/telemetry/shared/item"
6
+
7
+ attr_reader :data, :character, :item, :_V, :_D, :_T
8
+
9
+ def initialize(args)
10
+ @data = args
11
+ @character = Character.new(args["Character"])
12
+ @item = Item.new(args["Item"])
13
+ @_V = args["_V"]
14
+ @_D = args["_D"]
15
+ @_T = args["_T"]
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module PUBG
2
+ class Telemetry
3
+ class LogItemPickup
4
+ require "pubg/telemetry/shared/character"
5
+ require "pubg/telemetry/shared/item"
6
+
7
+ attr_reader :data, :character, :item, :_V, :_D, :_T
8
+
9
+ def initialize(args)
10
+ @data = args
11
+ @character = Character.new(args["Character"])
12
+ @item = Item.new(args["Item"])
13
+ @_V = args["_V"]
14
+ @_D = args["_D"]
15
+ @_T = args["_T"]
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module PUBG
2
+ class Telemetry
3
+ class LogItemUnequip
4
+ require "pubg/telemetry/shared/character"
5
+ require "pubg/telemetry/shared/item"
6
+
7
+ attr_reader :data, :character, :item, :_V, :_D, :_T
8
+
9
+ def initialize(args)
10
+ @data = args
11
+ @character = Character.new(args["Character"])
12
+ @item = Item.new(args["Item"])
13
+ @_V = args["_V"]
14
+ @_D = args["_D"]
15
+ @_T = args["_T"]
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ module PUBG
2
+ class Telemetry
3
+ class LogPlayerAttack
4
+ require "pubg/telemetry/shared/attacker"
5
+ require "pubg/telemetry/shared/weapon"
6
+ require "pubg/telemetry/shared/vehicle"
7
+
8
+ attr_reader :data, :attackid, :attacker, :attacktype, :weapon, :vehicle, :_V, :_D, :_T
9
+
10
+ def initialize(args)
11
+ @data = args
12
+ @attackid = args["AttackId"]
13
+ @attacker = Attacker.new(args["Attacker"])
14
+ @attacktype = args["AttackType"]
15
+ @weapon = Weapon.new(args["Weapon"])
16
+ @vehicle = Vehicle.new(args["Vehicle"])
17
+ @_V = args["_V"]
18
+ @_D = args["_D"]
19
+ @_T = args["_T"]
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,7 +1,7 @@
1
1
  module PUBG
2
2
  class Telemetry
3
3
  class LogPlayerCreate
4
- require "pubg/telemetry/events/shared/character"
4
+ require "pubg/telemetry/shared/character"
5
5
 
6
6
  attr_reader :character, :_V, :_D, :_T
7
7
 
@@ -0,0 +1,17 @@
1
+ module PUBG
2
+ class Telemetry
3
+ class LogPlayerLogin
4
+ attr_reader :data, :result, :errormessage, :accountid, :_V, :_D, :_T
5
+
6
+ def initialize(args)
7
+ @data = args
8
+ @result = args["Result"]
9
+ @errornessage = args["ErrorMessage"]
10
+ @accountid = args["AccountId"]
11
+ @_V = args["_V"]
12
+ @_D = args["_D"]
13
+ @_T = args["_T"]
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,7 +1,7 @@
1
1
  module PUBG
2
2
  class Telemetry
3
3
  class LogPlayerPosition
4
- require "pubg/telemetry/events/shared/character"
4
+ require "pubg/telemetry/shared/character"
5
5
 
6
6
  attr_reader :character, :elapsedtime, :numaliveplayers, :_V, :_D, :_T
7
7
 
@@ -0,0 +1,19 @@
1
+ module PUBG
2
+ class Telemetry
3
+ class LogVehicleRide
4
+ require "pubg/telemetry/shared/character"
5
+ require "pubg/telemetry/shared/vehicle"
6
+
7
+ attr_reader :data, :character, :vehicle, :_V, :_D, :_T
8
+
9
+ def initialize(args)
10
+ @data = args
11
+ @character = Character.new(args["Character"])
12
+ @vehicle = Vehicle.new(args["Vehicle"])
13
+ @_V = args["_V"]
14
+ @_D = args["_D"]
15
+ @_T = args["_T"]
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module PUBG
2
+ class Telemetry
3
+ class Attacker
4
+ require "pubg/telemetry/shared/location"
5
+
6
+ attr_reader :data, :name, :teamid, :health, :location, :ranking, :accountid
7
+
8
+ def initialize(args)
9
+ @data = args
10
+ @name = args["Name"]
11
+ @teamid = args["TeamId"]
12
+ @health = args["Health"]
13
+ @location = Location.new(args["Location"])
14
+ @ranking = args["Ranking"]
15
+ @accountid = args["AccountId"]
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,17 +1,17 @@
1
1
  module PUBG
2
2
  class Telemetry
3
3
  class Character
4
- require "pubg/telemetry/events/shared/location"
4
+ require "pubg/telemetry/shared/location"
5
5
 
6
- attr_reader :name, :teamId, :health, :location, :ranking, :accountId
6
+ attr_reader :name, :teamid, :health, :location, :ranking, :accountid
7
7
 
8
8
  def initialize(args)
9
9
  @name = args["Name"]
10
- @teamId = args["TeamId"]
10
+ @teamid = args["TeamId"]
11
11
  @health = args["Health"]
12
12
  @location = Location.new(args["Location"])
13
13
  @ranking = args["Ranking"]
14
- @accountId = args["AccountId"]
14
+ @accountid = args["AccountId"]
15
15
  end
16
16
  end
17
17
  end
@@ -0,0 +1,16 @@
1
+ module PUBG
2
+ class Telemetry
3
+ class Item
4
+ attr_reader :data, :itemid, :stackcount, :category, :subcategory, :attacheditems
5
+
6
+ def initialize(args)
7
+ @data = args
8
+ @itemid = args["ItemId"]
9
+ @stackcount = args["StackCount"]
10
+ @category = args["Category"]
11
+ @subcategory = args["SubCategory"]
12
+ @attacheditems = args["AttachedItems"]
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ module PUBG
2
+ class Telemetry
3
+ class Location
4
+ attr_reader :x, :y, :z
5
+
6
+ def initialize(args)
7
+ @x = args["X"]
8
+ @y = args["Y"]
9
+ @z = args["Z"]
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module PUBG
2
+ class Telemetry
3
+ class Vehicle
4
+ attr_reader :data, :vehicletype, :vehicleid, :healthpercent, :fuelpercent
5
+
6
+ def initialize(args)
7
+ @data = args
8
+ @vehicletype = args["VehicleType"]
9
+ @vehicleid = args["VehicleId"]
10
+ @healthpercent = args["HealthPercent"]
11
+ @fuelpercent = args["FeulPercent"]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ module PUBG
2
+ class Telemetry
3
+ class Weapon
4
+ attr_reader :data, :itemid, :stackcount, :category, :subcategory, :attacheditems
5
+
6
+ def initialize(args)
7
+ @data = args
8
+ @itemid = args["ItemId"]
9
+ @stackcount = args["StackCount"]
10
+ @category = args["Category"]
11
+ @subcategory = args["SubCategory"]
12
+ @attacheditems = args["AttachedItems"]
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module PUBG
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
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.0
4
+ version: 0.1.1
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-01 00:00:00.000000000 Z
11
+ date: 2018-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -115,7 +115,6 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
- - ".DS_Store"
119
118
  - ".gitignore"
120
119
  - ".rspec"
121
120
  - ".travis.yml"
@@ -128,7 +127,6 @@ files:
128
127
  - Rakefile
129
128
  - bin/console
130
129
  - bin/setup
131
- - lib/.DS_Store
132
130
  - lib/pubg-rb.rb
133
131
  - lib/pubg/client.rb
134
132
  - lib/pubg/match.rb
@@ -148,13 +146,20 @@ files:
148
146
  - lib/pubg/status.rb
149
147
  - lib/pubg/status/attributes.rb
150
148
  - lib/pubg/telemetry.rb
151
- - lib/pubg/telemetry/.DS_Store
152
- - lib/pubg/telemetry/LogPlayerAttack.rb
153
- - lib/pubg/telemetry/LogPlayerCreate.rb
154
- - lib/pubg/telemetry/LogPlayerLogin.rb
155
- - lib/pubg/telemetry/LogPlayerPosition.rb
156
- - lib/pubg/telemetry/events/shared/character.rb
157
- - lib/pubg/telemetry/events/shared/location.rb
149
+ - lib/pubg/telemetry/log_item_equip.rb
150
+ - lib/pubg/telemetry/log_item_pickup.rb
151
+ - lib/pubg/telemetry/log_item_unequip.rb
152
+ - lib/pubg/telemetry/log_player_attack.rb
153
+ - lib/pubg/telemetry/log_player_create.rb
154
+ - lib/pubg/telemetry/log_player_login.rb
155
+ - lib/pubg/telemetry/log_player_position.rb
156
+ - lib/pubg/telemetry/log_vehicle_ride.rb
157
+ - lib/pubg/telemetry/shared/attacker.rb
158
+ - lib/pubg/telemetry/shared/character.rb
159
+ - lib/pubg/telemetry/shared/item.rb
160
+ - lib/pubg/telemetry/shared/location.rb
161
+ - lib/pubg/telemetry/shared/vehicle.rb
162
+ - lib/pubg/telemetry/shared/weapon.rb
158
163
  - lib/pubg/version.rb
159
164
  - pubg-rb.gemspec
160
165
  homepage: https://github.com/pubstatsg/pubg-rb
@@ -1,19 +0,0 @@
1
- module PUBG
2
- class Telemetry
3
- class LogPlayerAttack
4
- require "pry"
5
-
6
- # attr_reader :character, :elapsedtime, :numaliveplayers, :_V, :_D, :_T
7
-
8
- def initialize(args)
9
- binding.pry
10
- @character = Character.new(args["Character"])
11
- @elapsedtime = args["ElapsedTime"]
12
- @numaliveplayers = args["NumAlivePlayers"]
13
- @_V = args["_V"]
14
- @_D = args["_D"]
15
- @_T = args["_T"]
16
- end
17
- end
18
- end
19
- end
@@ -1,16 +0,0 @@
1
- module PUBG
2
- class Telemetry
3
- class LogPlayerLogin
4
- attr_reader :Result, :ErrorMessage, :AccountId, :_V, :_D, :_T
5
-
6
- def initialize(args)
7
- @Result = args["Result"]
8
- @ErrorMessage = args["ErrorMessage"]
9
- @AccountId = args["AccountId"]
10
- @_V = args["_V"]
11
- @_D = args["_D"]
12
- @_T = args["_T"]
13
- end
14
- end
15
- end
16
- end
@@ -1,15 +0,0 @@
1
- module PUBG
2
- class Telemetry
3
- class Character
4
- class Location
5
- attr_reader :x, :y, :z
6
-
7
- def initialize(args)
8
- @x = args["X"]
9
- @y = args["Y"]
10
- @z = args["Z"]
11
- end
12
- end
13
- end
14
- end
15
- end