karatekit 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +38 -0
- data/MIT-LICENSE.md +20 -0
- data/README.md +7 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/karatekit.gemspec +31 -0
- data/lib/karatekit/arguments.rb +14 -0
- data/lib/karatekit/authentication.rb +15 -0
- data/lib/karatekit/client/event_details.rb +27 -0
- data/lib/karatekit/client/event_parts.rb +27 -0
- data/lib/karatekit/client/events.rb +27 -0
- data/lib/karatekit/client/instructor_details.rb +27 -0
- data/lib/karatekit/client/instructor_group_members.rb +27 -0
- data/lib/karatekit/client/instructor_groups.rb +27 -0
- data/lib/karatekit/client/instructors.rb +27 -0
- data/lib/karatekit/client/locations.rb +27 -0
- data/lib/karatekit/client/posts.rb +27 -0
- data/lib/karatekit/client/products.rb +27 -0
- data/lib/karatekit/client/rate_limit.rb +53 -0
- data/lib/karatekit/client/sessions.rb +27 -0
- data/lib/karatekit/client.rb +78 -0
- data/lib/karatekit/configurable.rb +80 -0
- data/lib/karatekit/connection.rb +191 -0
- data/lib/karatekit/default.rb +97 -0
- data/lib/karatekit/error.rb +244 -0
- data/lib/karatekit/rate_limit.rb +33 -0
- data/lib/karatekit/response/raise_error.rb +21 -0
- data/lib/karatekit/version.rb +3 -0
- data/lib/karatekit/warnable.rb +16 -0
- data/lib/karatekit.rb +35 -0
- metadata +154 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5dd7b6325d8c8b310f1e7bc17c8cf5d570e9db7d
|
4
|
+
data.tar.gz: 964079363f1ac6b19f648f03f0a8cd1100a4ec83
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 61162f1b560a580ba28239775d5d5b501e0be4d23bf8a74c41dbf38fee168e5cd1d32d6c9bc4fa9e90d407a6a45408b0e52a2a271edcd3866da14b3fb6eb7441
|
7
|
+
data.tar.gz: 2051a638c8399e49fe22f0194e06bc0e1a31faba5fe3ccd0104822480708ee016ee80f14c56a62e1bcaf086535a677f8037b441dc3c1187eff98aec5b3cedb4c
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at pulleasy@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
karatekit (0.1.0)
|
5
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.5.2)
|
11
|
+
public_suffix (>= 2.0.2, < 4.0)
|
12
|
+
coderay (1.1.2)
|
13
|
+
faraday (0.15.4)
|
14
|
+
multipart-post (>= 1.2, < 3)
|
15
|
+
method_source (0.9.2)
|
16
|
+
minitest (5.11.3)
|
17
|
+
multipart-post (2.0.0)
|
18
|
+
pry (0.12.2)
|
19
|
+
coderay (~> 1.1.0)
|
20
|
+
method_source (~> 0.9.0)
|
21
|
+
public_suffix (3.0.3)
|
22
|
+
rake (10.5.0)
|
23
|
+
sawyer (0.8.1)
|
24
|
+
addressable (>= 2.3.5, < 2.6)
|
25
|
+
faraday (~> 0.8, < 1.0)
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
ruby
|
29
|
+
|
30
|
+
DEPENDENCIES
|
31
|
+
bundler (~> 1.16)
|
32
|
+
karatekit!
|
33
|
+
minitest (~> 5.0)
|
34
|
+
pry (~> 0.12)
|
35
|
+
rake (~> 10.0)
|
36
|
+
|
37
|
+
BUNDLED WITH
|
38
|
+
1.16.6
|
data/MIT-LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2019 Codegestalt GmbH
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "karatekit"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
require "pry"
|
11
|
+
Pry.start
|
12
|
+
|
13
|
+
# require "irb"
|
14
|
+
# IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/karatekit.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "karatekit/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "karatekit"
|
8
|
+
spec.version = Karatekit::VERSION
|
9
|
+
spec.authors = ["Daniel Puglisi"]
|
10
|
+
spec.email = ["daniel@codegestalt.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Ruby toolkit for the kampfsport.center API}
|
13
|
+
spec.description = %q{Ruby toolkit for the kampfsport.center API}
|
14
|
+
spec.homepage = "https://kampfsport.center"
|
15
|
+
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
spec.bindir = "exe"
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
spec.add_dependency 'sawyer', '>= 0.5.3', '~> 0.8.0'
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
30
|
+
spec.add_development_dependency "pry", "~> 0.12"
|
31
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Karatekit
|
2
|
+
|
3
|
+
# Authentication methods for {Karatekit::Client}
|
4
|
+
module Authentication
|
5
|
+
|
6
|
+
# Indicates if the client was supplied an OAuth
|
7
|
+
# access token
|
8
|
+
#
|
9
|
+
# @see https://developer.github.com/v3/#authentication
|
10
|
+
# @return [Boolean]
|
11
|
+
def token_authenticated?
|
12
|
+
!!@access_token
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Karatekit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the EventDetails API
|
5
|
+
#
|
6
|
+
# @see https://...
|
7
|
+
module EventDetails
|
8
|
+
|
9
|
+
# List event_details
|
10
|
+
#
|
11
|
+
# @return [Array<Sawyer::Resource>] An array of hashes representing event_details
|
12
|
+
# @see https://...
|
13
|
+
def event_details(options = {})
|
14
|
+
paginate "event_details", options
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get a single event_detail
|
18
|
+
#
|
19
|
+
# @param id [Integer] ID of the event_detail
|
20
|
+
# @return [Sawyer::Resource] A single event_detail
|
21
|
+
# @see https://...
|
22
|
+
def event_detail(id, options = {})
|
23
|
+
get "event_details/#{id}", options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Karatekit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the EventParts API
|
5
|
+
#
|
6
|
+
# @see https://...
|
7
|
+
module EventParts
|
8
|
+
|
9
|
+
# List event_parts
|
10
|
+
#
|
11
|
+
# @return [Array<Sawyer::Resource>] An array of hashes representing event_parts
|
12
|
+
# @see https://...
|
13
|
+
def event_parts(options = {})
|
14
|
+
paginate "event_parts", options
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get a single event_part
|
18
|
+
#
|
19
|
+
# @param id [Integer] ID of the event_part
|
20
|
+
# @return [Sawyer::Resource] A single event_part
|
21
|
+
# @see https://...
|
22
|
+
def event_part(id, options = {})
|
23
|
+
get "event_parts/#{id}", options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Karatekit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Events API
|
5
|
+
#
|
6
|
+
# @see https://...
|
7
|
+
module Events
|
8
|
+
|
9
|
+
# List events
|
10
|
+
#
|
11
|
+
# @return [Array<Sawyer::Resource>] An array of hashes representing events
|
12
|
+
# @see https://...
|
13
|
+
def events(options = {})
|
14
|
+
paginate "events", options
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get a single event
|
18
|
+
#
|
19
|
+
# @param id [Integer] ID of the event
|
20
|
+
# @return [Sawyer::Resource] A single event
|
21
|
+
# @see https://...
|
22
|
+
def event(id, options = {})
|
23
|
+
get "events/#{id}", options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Karatekit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the InstructorDetails API
|
5
|
+
#
|
6
|
+
# @see https://...
|
7
|
+
module InstructorDetails
|
8
|
+
|
9
|
+
# List instructor_details
|
10
|
+
#
|
11
|
+
# @return [Array<Sawyer::Resource>] An array of hashes representing instructor_details
|
12
|
+
# @see https://...
|
13
|
+
def instructor_details(options = {})
|
14
|
+
paginate "instructor_details", options
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get a single instructor_detail
|
18
|
+
#
|
19
|
+
# @param id [Integer] ID of the instructor_detail
|
20
|
+
# @return [Sawyer::Resource] A single instructor_detail
|
21
|
+
# @see https://...
|
22
|
+
def instructor_detail(id, options = {})
|
23
|
+
get "instructor_details/#{id}", options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Karatekit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the InstructorGroupMembers API
|
5
|
+
#
|
6
|
+
# @see https://...
|
7
|
+
module InstructorGroupMembers
|
8
|
+
|
9
|
+
# List instructor_group_members
|
10
|
+
#
|
11
|
+
# @return [Array<Sawyer::Resource>] An array of hashes representing instructor_group_members
|
12
|
+
# @see https://...
|
13
|
+
def instructor_group_members(options = {})
|
14
|
+
paginate "instructor_group_members", options
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get a single instructor_group_member
|
18
|
+
#
|
19
|
+
# @param id [Integer] ID of the instructor_group_member
|
20
|
+
# @return [Sawyer::Resource] A single instructor_group_member
|
21
|
+
# @see https://...
|
22
|
+
def instructor_group_member(id, options = {})
|
23
|
+
get "instructor_group_members/#{id}", options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Karatekit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the InstructorGroups API
|
5
|
+
#
|
6
|
+
# @see https://...
|
7
|
+
module InstructorGroups
|
8
|
+
|
9
|
+
# List instructor_groups
|
10
|
+
#
|
11
|
+
# @return [Array<Sawyer::Resource>] An array of hashes representing instructor_groups
|
12
|
+
# @see https://...
|
13
|
+
def instructor_groups(options = {})
|
14
|
+
paginate "instructor_groups", options
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get a single instructor_group
|
18
|
+
#
|
19
|
+
# @param id [Integer] ID of the instructor_group
|
20
|
+
# @return [Sawyer::Resource] A single instructor_group
|
21
|
+
# @see https://...
|
22
|
+
def instructor_group(id, options = {})
|
23
|
+
get "instructor_groups/#{id}", options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Karatekit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Instructors API
|
5
|
+
#
|
6
|
+
# @see https://...
|
7
|
+
module Instructors
|
8
|
+
|
9
|
+
# List instructors
|
10
|
+
#
|
11
|
+
# @return [Array<Sawyer::Resource>] An array of hashes representing instructors
|
12
|
+
# @see https://...
|
13
|
+
def instructors(options = {})
|
14
|
+
paginate "instructors", options
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get a single instructor
|
18
|
+
#
|
19
|
+
# @param id [Integer] ID of the instructor
|
20
|
+
# @return [Sawyer::Resource] A single instructor
|
21
|
+
# @see https://...
|
22
|
+
def instructor(id, options = {})
|
23
|
+
get "instructors/#{id}", options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Karatekit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Locations API
|
5
|
+
#
|
6
|
+
# @see https://...
|
7
|
+
module Locations
|
8
|
+
|
9
|
+
# List locations
|
10
|
+
#
|
11
|
+
# @return [Array<Sawyer::Resource>] An array of hashes representing locations
|
12
|
+
# @see https://...
|
13
|
+
def locations(options = {})
|
14
|
+
paginate "locations", options
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get a single location
|
18
|
+
#
|
19
|
+
# @param id [Integer] ID of the location
|
20
|
+
# @return [Sawyer::Resource] A single location
|
21
|
+
# @see https://...
|
22
|
+
def location(id, options = {})
|
23
|
+
get "locations/#{id}", options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Karatekit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Posts API
|
5
|
+
#
|
6
|
+
# @see https://...
|
7
|
+
module Posts
|
8
|
+
|
9
|
+
# List posts
|
10
|
+
#
|
11
|
+
# @return [Array<Sawyer::Resource>] An array of hashes representing posts
|
12
|
+
# @see https://...
|
13
|
+
def posts(options = {})
|
14
|
+
paginate "posts", options
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get a single post
|
18
|
+
#
|
19
|
+
# @param id [Integer] ID of the post
|
20
|
+
# @return [Sawyer::Resource] A single post
|
21
|
+
# @see https://...
|
22
|
+
def post(id, options = {})
|
23
|
+
get "posts/#{id}", options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Karatekit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Products API
|
5
|
+
#
|
6
|
+
# @see https://...
|
7
|
+
module Products
|
8
|
+
|
9
|
+
# List products
|
10
|
+
#
|
11
|
+
# @return [Array<Sawyer::Resource>] An array of hashes representing products
|
12
|
+
# @see https://...
|
13
|
+
def products(options = {})
|
14
|
+
paginate "products", options
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get a single product
|
18
|
+
#
|
19
|
+
# @param id [Integer] ID of the product
|
20
|
+
# @return [Sawyer::Resource] A single product
|
21
|
+
# @see https://...
|
22
|
+
def product(id, options = {})
|
23
|
+
get "products/#{id}", options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Karatekit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for API rate limiting info
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/#rate-limiting
|
7
|
+
module RateLimit
|
8
|
+
|
9
|
+
# Get rate limit info from last response if available
|
10
|
+
# or make a new request to fetch rate limit
|
11
|
+
#
|
12
|
+
# @see https://developer.github.com/v3/rate_limit/#rate-limit
|
13
|
+
# @return [Karatekit::RateLimit] Rate limit info
|
14
|
+
def rate_limit(options = {})
|
15
|
+
return rate_limit! if last_response.nil?
|
16
|
+
|
17
|
+
Karatekit::RateLimit.from_response(last_response)
|
18
|
+
end
|
19
|
+
alias ratelimit rate_limit
|
20
|
+
|
21
|
+
# Get number of rate limted requests remaining
|
22
|
+
#
|
23
|
+
# @see https://developer.github.com/v3/rate_limit/#rate-limit
|
24
|
+
# @return [Integer] Number of requests remaining in this period
|
25
|
+
def rate_limit_remaining(options = {})
|
26
|
+
octokit_warn "Deprecated: Please use .rate_limit.remaining"
|
27
|
+
rate_limit.remaining
|
28
|
+
end
|
29
|
+
alias ratelimit_remaining rate_limit_remaining
|
30
|
+
|
31
|
+
# Refresh rate limit info by making a new request
|
32
|
+
#
|
33
|
+
# @see https://developer.github.com/v3/rate_limit/#rate-limit
|
34
|
+
# @return [Karatekit::RateLimit] Rate limit info
|
35
|
+
def rate_limit!(options = {})
|
36
|
+
get "rate_limit"
|
37
|
+
Karatekit::RateLimit.from_response(last_response)
|
38
|
+
end
|
39
|
+
alias ratelimit! rate_limit!
|
40
|
+
|
41
|
+
# Refresh rate limit info and get number of rate limted requests remaining
|
42
|
+
#
|
43
|
+
# @see https://developer.github.com/v3/rate_limit/#rate-limit
|
44
|
+
# @return [Integer] Number of requests remaining in this period
|
45
|
+
def rate_limit_remaining!(options = {})
|
46
|
+
octokit_warn "Deprecated: Please use .rate_limit!.remaining"
|
47
|
+
rate_limit!.remaining
|
48
|
+
end
|
49
|
+
alias ratelimit_remaining! rate_limit_remaining!
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Karatekit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Sessions API
|
5
|
+
#
|
6
|
+
# @see https://...
|
7
|
+
module Sessions
|
8
|
+
|
9
|
+
# List sessions
|
10
|
+
#
|
11
|
+
# @return [Array<Sawyer::Resource>] An array of hashes representing sessions
|
12
|
+
# @see https://...
|
13
|
+
def sessions(options = {})
|
14
|
+
paginate "sessions", options
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get a single session
|
18
|
+
#
|
19
|
+
# @param id [Integer] ID of the session
|
20
|
+
# @return [Sawyer::Resource] A single session
|
21
|
+
# @see https://...
|
22
|
+
def session(id, options = {})
|
23
|
+
get "sessions/#{id}", options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|