hackerrank 0.1.0 → 0.2.0

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: b1a06fef0ca1afe5bde3e0d036d5ac76390b0c8c
4
- data.tar.gz: 8cfb7a0696bee1725ea5866fa011fbc2a9e2a8cb
3
+ metadata.gz: 4895676533771049a86c62b063d08a6773a6eaab
4
+ data.tar.gz: 7da5cc5693a78d6f96754e38f75cd81d07acc26c
5
5
  SHA512:
6
- metadata.gz: 6c3137696c0f937691c92d06a6ae70a06b6a9a24cd8ffb5043f91c44e43868e939d92ca8d0e9faa7562f69e6c9e04602d1959aaeb8509da6687f0177ce53fcfb
7
- data.tar.gz: d1873a1b7774588bf7c8302435630169872756dcefa6447c7c8a5e9ec1d661e54a90b26ae3ba0253a42a4cc0ea54f99580dbaa73ebf385b64af973fc529c301a
6
+ metadata.gz: 285022fa415899601e3f03258d637b7be9cb5d2815bc45d331869ff792abfab325c6d80534d1d3c597f90fe5b61e39b3f7b6a5c5d3a2bff066dd6e3def75a4c9
7
+ data.tar.gz: 4384b64e6776c1bafb3ff3f7b4231e40e2241c80697688e14fa9e6887e3b1bdef001fab62013dfc5bddeb9860db09d9878d7225fbc67b4114d14f046df2b042f
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.2
4
- before_install: gem install bundler -v 1.10.5
3
+ - 2.3.1
4
+ before_install: gem install bundler
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/contratadome/hackerrank.svg?branch=master)](https://travis-ci.org/contratadome/hackerrank)
2
+
1
3
  # Hackerrank
2
4
 
3
5
  Ruby wrapper to the HackerRank V2 API
@@ -32,6 +34,8 @@ HackerRank::Test.delete '12345'
32
34
  HackerRank::Candidate.all test_id: 12345
33
35
  HackerRank::Candidate.find 64553, test_id: 12345
34
36
  HackerRank::Candidate.create test_id: 12345, username: 'dc.rec1@gmail.com'
37
+
38
+ HackerRank::Template.all
35
39
  ```
36
40
 
37
41
  ## Development
@@ -42,7 +46,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
42
46
 
43
47
  ## Contributing
44
48
 
45
- Bug reports and pull requests are welcome on GitHub at https://github.com/contratadome/hackerrank. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
49
+ Bug reports and pull requests are welcome on GitHub at https://github.com/dcrec1/hackerrank. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
46
50
 
47
51
 
48
52
  ## License
@@ -7,10 +7,10 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "hackerrank"
8
8
  spec.version = HackerRank::VERSION
9
9
  spec.authors = ["Diego Carrion"]
10
- spec.email = ["dev@contratado.com"]
10
+ spec.email = ["dc.rec1@gmail.com"]
11
11
 
12
12
  spec.summary = %q{Ruby wrapper to the HackerRank V2 API}
13
- spec.homepage = "https://github.com/contratadome/hackerrank"
13
+ spec.homepage = "https://github.com/dcrec1/hackerrank"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -2,6 +2,7 @@ require "hackerrank/version"
2
2
  require "hackerrank/base"
3
3
  require "hackerrank/candidate"
4
4
  require "hackerrank/test"
5
+ require "hackerrank/template"
5
6
 
6
7
  module HackerRank
7
8
  def self.access_token=(access_token)
@@ -30,12 +30,12 @@ module HackerRank
30
30
 
31
31
  private
32
32
 
33
- def self.request(method, path, params)
34
- HTTParty.send(method, "#{BASE_URI}#{@collection_path.call(params)}#{path}", auth.merge(body: params))['data']
33
+ def self.request(method, path, body_params, query_params = {})
34
+ HTTParty.send(method, "#{BASE_URI}#{@collection_path.call(body_params)}#{path}", { query: auth.merge(query_params), body: body_params })[response_key]
35
35
  end
36
36
 
37
37
  def self.auth
38
- { query: { access_token: HackerRank.access_token }}
38
+ { access_token: HackerRank.access_token }
39
39
  end
40
40
  end
41
41
  end
@@ -1,9 +1,13 @@
1
1
  module HackerRank
2
2
  class Candidate < Base
3
- collection_path -> (params) { "/tests/#{params[:test_id]}/candidates" }
3
+ collection_path -> (params) { "/tests/#{params.delete(:test_id)}/candidates" }
4
4
 
5
5
  def self.find_by_username(username, params)
6
- request :get, "/view", params.merge(username: username)
6
+ request :get, "/view", params, { username: username }
7
+ end
8
+
9
+ def self.response_key
10
+ 'data'
7
11
  end
8
12
  end
9
13
  end
@@ -0,0 +1,9 @@
1
+ module HackerRank
2
+ class Template < Base
3
+ collection_path -> (params) { '/templates' }
4
+
5
+ def self.response_key
6
+ 'models'
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,9 @@
1
1
  module HackerRank
2
2
  class Test < Base
3
3
  collection_path -> (params) { "/tests" }
4
+
5
+ def self.response_key
6
+ 'data'
7
+ end
4
8
  end
5
9
  end
@@ -1,3 +1,3 @@
1
1
  module HackerRank
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hackerrank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego Carrion
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-31 00:00:00.000000000 Z
11
+ date: 2017-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -96,7 +96,7 @@ dependencies:
96
96
  version: '0'
97
97
  description:
98
98
  email:
99
- - dev@contratado.com
99
+ - dc.rec1@gmail.com
100
100
  executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
@@ -115,9 +115,10 @@ files:
115
115
  - lib/hackerrank.rb
116
116
  - lib/hackerrank/base.rb
117
117
  - lib/hackerrank/candidate.rb
118
+ - lib/hackerrank/template.rb
118
119
  - lib/hackerrank/test.rb
119
120
  - lib/hackerrank/version.rb
120
- homepage: https://github.com/contratadome/hackerrank
121
+ homepage: https://github.com/dcrec1/hackerrank
121
122
  licenses:
122
123
  - MIT
123
124
  metadata: {}
@@ -137,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
138
  version: '0'
138
139
  requirements: []
139
140
  rubyforge_project:
140
- rubygems_version: 2.4.6
141
+ rubygems_version: 2.6.6
141
142
  signing_key:
142
143
  specification_version: 4
143
144
  summary: Ruby wrapper to the HackerRank V2 API