paladins 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: 65eafee446c7bc6ace160f9880241a989b521182
4
- data.tar.gz: ffe694a4b4e1586d21a9ba72168d0514af635017
3
+ metadata.gz: 42432f594e2c2125cdcd88c3d0152beeb6c52933
4
+ data.tar.gz: c4e0e45e844e7b2fca35992ce60c2b65d89a9901
5
5
  SHA512:
6
- metadata.gz: aae600b27e06b185ea5e6763aa9bd1094c0a6b1b578211e86c596b936165d064e2bccc04bdef871ebfb4e12c3ca4aa1d9e6d5ae6401fd3dd0c20216125c39234
7
- data.tar.gz: 4ed7c840de585b7bef3c9f28122afec08164fcbff004dbd530863120cfcaaf567a5011c2d44772971553bbbb32c8e3b11afc88590a982f1b8097e2ea27fe2d96
6
+ metadata.gz: ebf5656d12ec086b78105e46868f9fabf3567cd7f91b7025396c056feb1e1fa66e6fabf4919eddd73e1e5865f33b0092a255ab03f38bca8ccedfe4ac3301f66d
7
+ data.tar.gz: 29d936e169429307260d2974d82bdc57ce0a9cd02f61b7e2b5559732f53fe6c0067c46714ee97ffbddba9befe0926c3f158523a337f798e6434049ec1fa7ec82
data/.gitignore CHANGED
@@ -7,5 +7,8 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
 
10
+ # .gem file
11
+ *.gem
12
+
10
13
  # rspec failure tracking
11
14
  .rspec_status
@@ -0,0 +1,49 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ paladins (0.1.0)
5
+ faraday
6
+ json
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ coderay (1.1.2)
12
+ diff-lcs (1.3)
13
+ dotenv (2.4.0)
14
+ faraday (0.15.2)
15
+ multipart-post (>= 1.2, < 3)
16
+ json (2.1.0)
17
+ method_source (0.9.0)
18
+ multipart-post (2.0.0)
19
+ pry (0.11.3)
20
+ coderay (~> 1.1.0)
21
+ method_source (~> 0.9.0)
22
+ rake (10.5.0)
23
+ rspec (3.7.0)
24
+ rspec-core (~> 3.7.0)
25
+ rspec-expectations (~> 3.7.0)
26
+ rspec-mocks (~> 3.7.0)
27
+ rspec-core (3.7.1)
28
+ rspec-support (~> 3.7.0)
29
+ rspec-expectations (3.7.0)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.7.0)
32
+ rspec-mocks (3.7.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.7.0)
35
+ rspec-support (3.7.1)
36
+
37
+ PLATFORMS
38
+ ruby
39
+
40
+ DEPENDENCIES
41
+ bundler (~> 1.16)
42
+ dotenv
43
+ paladins!
44
+ pry
45
+ rake (~> 10.0)
46
+ rspec (~> 3.0)
47
+
48
+ BUNDLED WITH
49
+ 1.16.2
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Paladins
2
2
 
3
- This gem wraps Paladins API.
3
+ This gem wraps Hi-Rez Studios' Paladins API.
4
4
 
5
- See [API DOCS](https://docs.google.com/document/d/1OFS-3ocSx-1Rvg4afAnEHlT3917MAK_6eJTR6rzr-BM) for more information.
5
+ See [Paladins API DOCS](https://docs.google.com/document/d/1OFS-3ocSx-1Rvg4afAnEHlT3917MAK_6eJTR6rzr-BM) for more information.
6
6
 
7
7
  ## Status
8
8
 
@@ -0,0 +1,11 @@
1
+ module Paladins
2
+ class Configuration
3
+ attr_accessor :api_url, :dev_id, :auth_key
4
+
5
+ def initialize
6
+ @api_url = "http://api.paladins.com/paladinsapi.svc"
7
+ @dev_id = nil
8
+ @auth_key = nil
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ require 'faraday'
2
+ require 'json'
3
+
4
+ module Paladins
5
+ class Player
6
+ def self.getchampionranks(player_name)
7
+ # /getchampionranks[ResponseFormat]/{developerId}/{signature}/{session}/{timestamp}/{player}
8
+
9
+ response = Faraday.get("#{Paladins.configuration.api_url}/getchampionranksJson/#{Paladins.configuration.dev_id}/#{get_signature('createsession', date_time)}/#{date_time}/#{player_name}")
10
+ attributes = JSON.parse(response.body)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,48 @@
1
+ require 'faraday'
2
+ require 'json'
3
+ require 'digest'
4
+
5
+ module Paladins
6
+ class Session
7
+ def self.ping
8
+ # /ping[ResponseFormat]
9
+
10
+ response = Faraday.get("#{Paladins.configuration.api_url}/pingJson")
11
+ attributes = JSON.parse(response.body)
12
+ end
13
+
14
+ def self.createsession
15
+ # /createsession[ResponseFormat]/{developerId}/{signature}/{timestamp}
16
+
17
+ date_time = Time.now.utc.strftime("%Y%m%d%H%M%S")
18
+ url = "#{Paladins.configuration.api_url}/createsessionJson/#{Paladins.configuration.dev_id}/#{get_signature('createsession', date_time)}/#{date_time}"
19
+ response = Faraday.get(url)
20
+ attributes = JSON.parse(response.body)
21
+ end
22
+
23
+ def self.testsession(session_id)
24
+ # /testsession[ResponseFormat]/{developerId}/{signature}/{session}/{timestamp}
25
+
26
+ date_time = Time.now.utc.strftime("%Y%m%d%H%M%S")
27
+ url = "#{Paladins.configuration.api_url}/testsessionJson/#{Paladins.configuration.dev_id}/#{get_signature('testsession', date_time)}/#{session_id}/#{date_time}"
28
+ response = Faraday.get(url)
29
+ attributes = JSON.parse(response.body)
30
+ end
31
+
32
+ def self.gethirezserverstatus(session_id)
33
+ # /gethirezserverstatus[ResponseFormat]/{developerId}/{signature}/{session}/{timestamp}
34
+
35
+ date_time = Time.now.utc.strftime("%Y%m%d%H%M%S")
36
+ url = "#{Paladins.configuration.api_url}/gethirezserverstatusJson/#{Paladins.configuration.dev_id}/#{get_signature('gethirezserverstatus', date_time)}/#{session_id}/#{date_time}"
37
+ response = Faraday.get(url)
38
+ attributes = JSON.parse(response.body)
39
+ end
40
+
41
+ private
42
+
43
+ def self.get_signature(method_name, date_time)
44
+ raise ArgumentError.new('Missing dev_id or auth_key') if ( Paladins.configuration.dev_id.to_s.empty? || Paladins.configuration.auth_key.to_s.empty? )
45
+ Digest::MD5.hexdigest(Paladins.configuration.dev_id + method_name + Paladins.configuration.auth_key + date_time);
46
+ end
47
+ end
48
+ end
@@ -1,3 +1,3 @@
1
1
  module Paladins
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["davideghz@gmail.com"]
11
11
 
12
12
  spec.summary = %q{Ruby wrapper for Paladins API.}
13
- spec.description = %q{This gem wraps Paladins API. See https://docs.google.com/document/d/1OFS-3ocSx-1Rvg4afAnEHlT3917MAK_6eJTR6rzr-BM/edit for more information.}
13
+ spec.description = %q{Ruby wrapper for Hi-Rez Studios Paladins API.}
14
14
  spec.homepage = "https://www.github.com/davideghz/paladins"
15
15
  spec.license = "MIT"
16
16
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paladins
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
  - Davide Ghezzi
@@ -94,8 +94,7 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- description: This gem wraps Paladins API. See https://docs.google.com/document/d/1OFS-3ocSx-1Rvg4afAnEHlT3917MAK_6eJTR6rzr-BM/edit
98
- for more information.
97
+ description: Ruby wrapper for Hi-Rez Studios Paladins API.
99
98
  email:
100
99
  - davideghz@gmail.com
101
100
  executables: []
@@ -106,12 +105,16 @@ files:
106
105
  - ".rspec"
107
106
  - ".travis.yml"
108
107
  - Gemfile
108
+ - Gemfile.lock
109
109
  - LICENSE.txt
110
110
  - README.md
111
111
  - Rakefile
112
112
  - bin/console
113
113
  - bin/setup
114
114
  - lib/paladins.rb
115
+ - lib/paladins/configuration.rb
116
+ - lib/paladins/player.rb
117
+ - lib/paladins/session.rb
115
118
  - lib/paladins/version.rb
116
119
  - paladins.gemspec
117
120
  homepage: https://www.github.com/davideghz/paladins