pubg-rb 0.1.2 → 0.1.3

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: 3e7a464209b0b04ff7bfc3324a9bbe045d97edb3
4
- data.tar.gz: 6a40c510347b1661bc2d158dd57832443faa0b75
3
+ metadata.gz: e85f90dac7a3df7f9321a137ddb8d12f47b13393
4
+ data.tar.gz: 41f776c2156d7f6592c180a830c97a8b0f96feaa
5
5
  SHA512:
6
- metadata.gz: 6eaa50f6e5786986fda91670fae8431c43a6fe85542fd3aae398782c1afa86c6ab60ee49832d5f7ef4eb22b240f3aa36c7a02e6f3774748f0399c7b1a7a99fc0
7
- data.tar.gz: d5e9f1c0cafc91d22e42b12824f7541c7604271791294797f036cf83a61ed3b4401fc58f91da08e8e0cc06fe9a06937738860cf991b0bb74b2f69a76c5fd5ee2
6
+ metadata.gz: bf9e50cfed1a4d4446bc3507c6df0d8ed1b1a2e49836dde51b735e168b201e4104a7cfdff1001fae0a9f93864a7d91970e51f3df72d4ce46f9e79286879afc05
7
+ data.tar.gz: b5015d3bb81f99ed25af9dee4a842a1f44cebff198d90f281ec64418eb678a07bebbcd59aacc0396da9baf03108f7d3e6cc185239d05f1e9565b5e2ebcbcce06
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pubg-rb (0.1.2)
4
+ pubg-rb (0.1.3)
5
5
  oj (~> 3.5.1)
6
6
  typhoeus (~> 1.3.0)
7
7
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # pubg-rb [![Gem Version](https://img.shields.io/gem/v/pubg-rb.svg)](https://rubygems.org/gems/pubg-rb)
1
+ # pubg-rb [![Build Status](https://travis-ci.com/pubstatsg/pubg-rb.svg?branch=master)](https://travis-ci.com/pubstatsg/pubg-rb) [![Gem Version](https://img.shields.io/gem/v/pubg-rb.svg)](https://rubygems.org/gems/pubg-rb)
2
2
 
3
3
  Wraps the PUBG REST API for convenient access from ruby applications.
4
4
 
@@ -1,23 +1,24 @@
1
1
  module PUBG
2
2
  class Player
3
+ require "pubg/player/links"
4
+ require "pubg/player/data"
3
5
  require "pubg/player/matches"
4
- require "pubg/player/player"
5
6
  require "pubg/player/season"
6
7
 
7
8
  def initialize(args)
8
- if args["data"]
9
- args = args["data"]
10
- end
11
-
12
9
  @args = args
13
10
  end
14
11
 
15
- def data
12
+ def original
16
13
  @args
17
14
  end
18
15
 
16
+ def data
17
+ Data.new(@args["data"])
18
+ end
19
+
19
20
  def links
20
- @args["links"]
21
+ Links.new(@args["links"])
21
22
  end
22
23
 
23
24
  def meta
@@ -25,23 +26,23 @@ module PUBG
25
26
  end
26
27
 
27
28
  def player
28
- Player.new(@args["attributes"])
29
+ Data::Attributes.new(@args["data"]["attributes"])
29
30
  end
30
31
 
31
32
  def playerId
32
- @args["id"]
33
+ @args["data"]["id"]
33
34
  end
34
35
 
35
36
  def matches
36
37
  matches = []
37
- @args["relationships"]["matches"]["data"].each do |match|
38
+ @args["data"]["relationships"]["matches"]["data"].each do |match|
38
39
  matches << Matches.new(match)
39
40
  end
40
41
  return matches
41
42
  end
42
43
 
43
- def season(platform_region=$platform_region, season_id=nil)
44
- Season.new(platform_region, @player_id, season_id)
44
+ def season(season_id=nil, platform_region=$platform_region)
45
+ Season.new(platform_region, @args["data"]["id"], season_id)
45
46
  end
46
47
  end
47
48
  end
@@ -0,0 +1,33 @@
1
+ module PUBG
2
+ class Player
3
+ class Data
4
+ require "pubg/player/data/links"
5
+ require "pubg/player/data/attributes"
6
+ require "pubg/player/data/relationships"
7
+
8
+ def initialize(args)
9
+ @args = args
10
+ end
11
+
12
+ def type
13
+ @args["type"]
14
+ end
15
+
16
+ def id
17
+ @args["id"]
18
+ end
19
+
20
+ def attributes
21
+ Attributes.new(@args["attributes"])
22
+ end
23
+
24
+ def relationships
25
+ Relationships.new(@args["relationships"])
26
+ end
27
+
28
+ def links
29
+ Links.new(@args["links"])
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,39 @@
1
+ module PUBG
2
+ class Player
3
+ class Data
4
+ class Attributes
5
+ def initialize(args)
6
+ @args = args
7
+ end
8
+
9
+ def titleId
10
+ @args["titleId"]
11
+ end
12
+
13
+ def shardId
14
+ @args["shardId"]
15
+ end
16
+
17
+ def createdAt
18
+ @args["createdAt"]
19
+ end
20
+
21
+ def updatedAt
22
+ @args["updatedAt"]
23
+ end
24
+
25
+ def patchVersion
26
+ @args["patchVersion"]
27
+ end
28
+
29
+ def name
30
+ @args["name"]
31
+ end
32
+
33
+ def stats
34
+ @args["stats"]
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,19 @@
1
+ module PUBG
2
+ class Player
3
+ class Data
4
+ class Links
5
+ def initialize(args)
6
+ @args = args
7
+ end
8
+
9
+ def schema
10
+ @args["schema"]
11
+ end
12
+
13
+ def self
14
+ @args["self"]
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,25 @@
1
+ module PUBG
2
+ class Player
3
+ class Data
4
+ class Relationships
5
+ require "pubg/player/matches"
6
+
7
+ def initialize(args)
8
+ @args = args
9
+ end
10
+
11
+ def assets
12
+ @args["assets"]["data"]
13
+ end
14
+
15
+ def matches
16
+ matches = []
17
+ @args["matches"]["data"].each do |match|
18
+ matches << Matches.new(match)
19
+ end
20
+ return matches
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,13 @@
1
+ module PUBG
2
+ class Player
3
+ class Links
4
+ def initialize(args)
5
+ @args = args
6
+ end
7
+
8
+ def self
9
+ @args["self"]
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,11 +1,16 @@
1
1
  module PUBG
2
2
  class Player
3
3
  class Matches
4
- attr_reader :type, :id
5
-
6
4
  def initialize(args)
7
- @type = args["type"]
8
- @id = args["id"]
5
+ @args = args
6
+ end
7
+
8
+ def type
9
+ @args["type"]
10
+ end
11
+
12
+ def id
13
+ @args["id"]
9
14
  end
10
15
  end
11
16
  end
@@ -1,6 +1,8 @@
1
1
  module PUBG
2
2
  class Player
3
3
  class Season
4
+ require "pubg/player/season/data"
5
+
4
6
  def initialize(platform_region=$platform_region, player_id, season_id)
5
7
  @platform_region = platform_region
6
8
  @player_id = player_id
@@ -9,12 +11,16 @@ module PUBG
9
11
  @args = get_season
10
12
  end
11
13
 
14
+ def original
15
+ @args
16
+ end
17
+
12
18
  def data
13
- @args["data"]
19
+ Data.new(@args["data"])
14
20
  end
15
21
 
16
22
  def links
17
- @args["links"]
23
+ Links.new(@args["links"])
18
24
  end
19
25
 
20
26
  def meta
@@ -0,0 +1,19 @@
1
+ module PUBG
2
+ class Player
3
+ class Season
4
+ class Data
5
+ class Attributes
6
+ require "pubg/player/season/data"
7
+
8
+ def initialize(args)
9
+ @args = args
10
+ end
11
+
12
+ def gameModeStats
13
+ @args["gameModeStats"]
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,26 @@
1
+ module PUBG
2
+ class Player
3
+ class Season
4
+ class Data
5
+ require "pubg/player/season/data/attributes"
6
+ require "pubg/player/season/data/relationships"
7
+
8
+ def initialize(args)
9
+ @args = args
10
+ end
11
+
12
+ def type
13
+ @args["type"]
14
+ end
15
+
16
+ def attributes
17
+ Attributes.new(@args["attributes"])
18
+ end
19
+
20
+ def relationships
21
+ Relationships.new(@args["relationships"])
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,19 @@
1
+ module PUBG
2
+ class Player
3
+ class Season
4
+ class Data
5
+ class Attributes
6
+ require "pubg/player/season/data/game_mode_stats"
7
+
8
+ def initialize(args)
9
+ @args = args
10
+ end
11
+
12
+ def gameModeStats
13
+ GameModeStats.new(@args["gameModeStats"])
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,41 @@
1
+ module PUBG
2
+ class Player
3
+ class Season
4
+ class Data
5
+ class Attributes
6
+ class GameModeStats
7
+ require "pubg/player/season/data/stats"
8
+
9
+ def initialize(args)
10
+ @args = args
11
+ end
12
+
13
+ def solo
14
+ Stats.new(@args["solo"])
15
+ end
16
+
17
+ def duo
18
+ Stats.new(@args["duo"])
19
+ end
20
+
21
+ def squad
22
+ Stats.new(@args["squad"])
23
+ end
24
+
25
+ def solo_fpp
26
+ Stats.new(@args["solo-fpp"])
27
+ end
28
+
29
+ def duo_fpp
30
+ Stats.new(@args["duo-fpp"])
31
+ end
32
+
33
+ def squad_fpp
34
+ Stats.new(@args["squad-fpp"])
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,57 @@
1
+ module PUBG
2
+ class Player
3
+ class Season
4
+ class Data
5
+ class Relationships
6
+ require "pubg/player/season/data/relationships/player"
7
+ require "pubg/player/season/data/relationships/season"
8
+ require "pubg/player/season/data/relationships/matches"
9
+
10
+ def initialize(args)
11
+ @args = args
12
+ end
13
+
14
+ def player
15
+ Player.new(@args["player"])
16
+ end
17
+
18
+ def season
19
+ Season.new(@args["season"])
20
+ end
21
+
22
+ def matchesSolo
23
+ matchStyle(@args["matchesSolo"]["data"])
24
+ end
25
+
26
+ def matchesDuo
27
+ matchStyle(@args["matchesDuo"]["data"])
28
+ end
29
+
30
+ def matchesSquad
31
+ matchStyle(@args["matchesSquad"]["data"])
32
+ end
33
+
34
+ def matchesSoloFPP
35
+ matchStyle(@args["matchesSoloFPP"]["data"])
36
+ end
37
+
38
+ def matchesDuoFPP
39
+ matchStyle(@args["matchesDuoFPP"]["data"])
40
+ end
41
+
42
+ def matchesSquadFPP
43
+ matchStyle(@args["matchesSquadFPP"]["data"])
44
+ end
45
+
46
+ def matchStyle(data)
47
+ i = []
48
+ data.each do |item|
49
+ i << Matches.new(item)
50
+ end
51
+ i
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,23 @@
1
+ module PUBG
2
+ class Player
3
+ class Season
4
+ class Data
5
+ class Relationships
6
+ class Matches
7
+ def initialize(args)
8
+ @args = args
9
+ end
10
+
11
+ def type
12
+ @args["type"]
13
+ end
14
+
15
+ def id
16
+ @args["id"]
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module PUBG
2
+ class Player
3
+ class Season
4
+ class Data
5
+ class Relationships
6
+ class Player
7
+ def initialize(args)
8
+ @args = args
9
+ end
10
+
11
+ def type
12
+ @args["data"]["type"]
13
+ end
14
+
15
+ def id
16
+ @args["data"]["id"]
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module PUBG
2
+ class Player
3
+ class Season
4
+ class Data
5
+ class Relationships
6
+ class Season
7
+ def initialize(args)
8
+ @args = args
9
+ end
10
+
11
+ def type
12
+ @args["data"]["type"]
13
+ end
14
+
15
+ def id
16
+ @args["data"]["id"]
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,137 @@
1
+ module PUBG
2
+ class Player
3
+ class Season
4
+ class Data
5
+ class Attributes
6
+ class GameModeStats
7
+ class Stats
8
+ def initialize(args)
9
+ @args = args
10
+ end
11
+
12
+ def assists
13
+ @args["assists"]
14
+ end
15
+
16
+ def boosts
17
+ @args["boosts"]
18
+ end
19
+
20
+ def dBNOs
21
+ @args["dBNOs"]
22
+ end
23
+
24
+ def dailyKills
25
+ @args["dailyKills"]
26
+ end
27
+
28
+ def damageDealt
29
+ @args["damageDealt"]
30
+ end
31
+
32
+ def days
33
+ @args["days"]
34
+ end
35
+
36
+ def headshotKills
37
+ @args["headshotKills"]
38
+ end
39
+
40
+ def heals
41
+ @args["heals"]
42
+ end
43
+
44
+ def killPoints
45
+ @args["killPoints"]
46
+ end
47
+
48
+ def kills
49
+ @args["kills"]
50
+ end
51
+
52
+ def longestKill
53
+ @args["longestKill"]
54
+ end
55
+
56
+ def longestTimeSurvived
57
+ @args["longestTimeSurvived"]
58
+ end
59
+
60
+ def losses
61
+ @args["losses"]
62
+ end
63
+
64
+ def maxKillStreaks
65
+ @args["maxKillStreaks"]
66
+ end
67
+
68
+ def mostSurvivalTime
69
+ @args["mostSurvivalTime"]
70
+ end
71
+
72
+ def revives
73
+ @args["revives"]
74
+ end
75
+
76
+ def rideDistance
77
+ @args["rideDistance"]
78
+ end
79
+
80
+ def roadKills
81
+ @args["roadKills"]
82
+ end
83
+
84
+ def roundMostKills
85
+ @args["roundMostKills"]
86
+ end
87
+
88
+ def roundsPlayed
89
+ @args["roundsPlayed"]
90
+ end
91
+
92
+ def suicides
93
+ @args["suicides"]
94
+ end
95
+
96
+ def teamKills
97
+ @args["teamKills"]
98
+ end
99
+
100
+ def timeSurvived
101
+ @args["timeSurvived"]
102
+ end
103
+
104
+ def top10s
105
+ @args["top10s"]
106
+ end
107
+
108
+ def vehicleDestroys
109
+ @args["vehicleDestroys"]
110
+ end
111
+
112
+ def walkDistance
113
+ @args["walkDistance"]
114
+ end
115
+
116
+ def weaponsAcquired
117
+ @args["weaponsAcquired"]
118
+ end
119
+
120
+ def weeklyKills
121
+ @args["weeklyKills"]
122
+ end
123
+
124
+ def winPoints
125
+ @args["winPoints"]
126
+ end
127
+
128
+ def wins
129
+ @args["wins"]
130
+ end
131
+ end
132
+ end
133
+ end
134
+ end
135
+ end
136
+ end
137
+ end
@@ -1,16 +1,26 @@
1
1
  module PUBG
2
2
  class Seasons
3
+ require "pubg/seasons/data"
4
+ require "pubg/seasons/links"
3
5
 
4
6
  def initialize(args)
5
7
  @args = args
6
8
  end
7
9
 
10
+ def original
11
+ @args
12
+ end
13
+
8
14
  def data
9
- @args["data"]
15
+ d = []
16
+ @args["data"].each do |data|
17
+ d << Data.new(data)
18
+ end
19
+ d
10
20
  end
11
21
 
12
22
  def links
13
- @args["links"]
23
+ Links.new(@args["links"])
14
24
  end
15
25
 
16
26
  def meta
@@ -0,0 +1,35 @@
1
+ module PUBG
2
+ class Seasons
3
+ class Data
4
+ def initialize(args)
5
+ @args = args
6
+ end
7
+
8
+ def type
9
+ @args["type"]
10
+ end
11
+
12
+ def id
13
+ @args["id"]
14
+ end
15
+
16
+ def attributes
17
+ Attributes.new(@args["attributes"])
18
+ end
19
+
20
+ class Attributes
21
+ def initialize(args)
22
+ @args = args
23
+ end
24
+
25
+ def isCurrentSeason
26
+ @args["isCurrentSeason"]
27
+ end
28
+
29
+ def isOffseason
30
+ @args["isOffseason"]
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,13 @@
1
+ module PUBG
2
+ class Seasons
3
+ class Links
4
+ def initialize(args)
5
+ @args = args
6
+ end
7
+
8
+ def self
9
+ @args["self"]
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,17 +1,17 @@
1
1
  module PUBG
2
2
  class Status
3
- require "pubg/status/attributes"
3
+ require "pubg/status/data"
4
4
 
5
5
  def initialize(args)
6
6
  @args = args
7
7
  end
8
8
 
9
- def data
10
- @args["data"]
9
+ def original
10
+ @args
11
11
  end
12
12
 
13
- def attributes
14
- Attributes.new(@args["data"]["attributes"])
13
+ def data
14
+ Data.new(@args["data"])
15
15
  end
16
16
  end
17
17
  end
@@ -1,12 +1,17 @@
1
1
  module PUBG
2
2
  class Status
3
3
  class Attributes
4
- attr_reader :version, :releasedAt
5
-
6
4
  def initialize(args)
7
- @version = args["version"]
8
- @releasedAt = args["releasedAt"]
5
+ @args = args
9
6
  end
7
+
8
+ def version
9
+ @args["version"]
10
+ end
11
+
12
+ def releasedAt
13
+ @args["releasedAt"]
14
+ end
10
15
  end
11
16
  end
12
17
  end
@@ -0,0 +1,23 @@
1
+ module PUBG
2
+ class Status
3
+ class Data
4
+ require "pubg/status/attributes"
5
+
6
+ def initialize(args)
7
+ @args = args
8
+ end
9
+
10
+ def type
11
+ @args["type"]
12
+ end
13
+
14
+ def id
15
+ @args["id"]
16
+ end
17
+
18
+ def attributes
19
+ Attributes.new(@args["attributes"])
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module PUBG
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
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.2
4
+ version: 0.1.3
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-02 00:00:00.000000000 Z
11
+ date: 2018-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -165,14 +165,30 @@ files:
165
165
  - lib/pubg/match/roster/relationships.rb
166
166
  - lib/pubg/match/telemetry.rb
167
167
  - lib/pubg/player.rb
168
+ - lib/pubg/player/data.rb
169
+ - lib/pubg/player/data/attributes.rb
170
+ - lib/pubg/player/data/links.rb
171
+ - lib/pubg/player/data/relationships.rb
172
+ - lib/pubg/player/links.rb
168
173
  - lib/pubg/player/matches.rb
169
- - lib/pubg/player/player.rb
170
174
  - lib/pubg/player/season.rb
175
+ - lib/pubg/player/season/attributes.rb
176
+ - lib/pubg/player/season/data.rb
177
+ - lib/pubg/player/season/data/attributes.rb
178
+ - lib/pubg/player/season/data/game_mode_stats.rb
179
+ - lib/pubg/player/season/data/relationships.rb
180
+ - lib/pubg/player/season/data/relationships/matches.rb
181
+ - lib/pubg/player/season/data/relationships/player.rb
182
+ - lib/pubg/player/season/data/relationships/season.rb
183
+ - lib/pubg/player/season/data/stats.rb
171
184
  - lib/pubg/players.rb
172
185
  - lib/pubg/pub_error.rb
173
186
  - lib/pubg/seasons.rb
187
+ - lib/pubg/seasons/data.rb
188
+ - lib/pubg/seasons/links.rb
174
189
  - lib/pubg/status.rb
175
190
  - lib/pubg/status/attributes.rb
191
+ - lib/pubg/status/data.rb
176
192
  - lib/pubg/telemetry.rb
177
193
  - lib/pubg/telemetry/log_item_equip.rb
178
194
  - lib/pubg/telemetry/log_item_pickup.rb
@@ -1,17 +0,0 @@
1
- module PUBG
2
- class Player
3
- class Player
4
- attr_reader :name, :stats, :titleId, :shardId, :createdAt, :updatedAt, :patchVersion
5
-
6
- def initialize(args)
7
- @name = args["name"]
8
- @stats = args["stats"]
9
- @titleId = args["titleId"]
10
- @shardId = args["shardId"]
11
- @createdAt = args["createdAt"]
12
- @updatedAt = args["updatedAt"]
13
- @patchVersion = args["patchVersion"]
14
- end
15
- end
16
- end
17
- end