karatekit 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.3
7
+ before_install: gem install bundler -v 1.16.6
@@ -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
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in karatekit.gemspec
6
+ gemspec
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
@@ -0,0 +1,7 @@
1
+ # Karatekit
2
+
3
+ Ruby toolkit for the kampfsport.center API.
4
+
5
+ ## Philosophy
6
+
7
+ This Gem is based on GitHub's [Octokit.rb](https://github.com/octokit/octokit.rb).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
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,14 @@
1
+ module Karatekit
2
+
3
+ # Extracts options from method arguments
4
+ # @private
5
+ class Arguments < Array
6
+ attr_reader :options
7
+
8
+ def initialize(args)
9
+ @options = args.last.is_a?(::Hash) ? args.pop : {}
10
+ super(args)
11
+ end
12
+
13
+ end
14
+ 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