Class: Karatekit::Client
- Inherits:
-
Object
- Object
- Karatekit::Client
- Includes:
- Authentication, EventDetails, EventParts, Events, InstructorDetails, InstructorGroupMembers, InstructorGroups, Instructors, Locations, Posts, Products, RateLimit, Sessions, Configurable, Connection, Warnable
- Defined in:
- lib/karatekit/client.rb,
lib/karatekit/client/posts.rb,
lib/karatekit/client/events.rb,
lib/karatekit/client/products.rb,
lib/karatekit/client/sessions.rb,
lib/karatekit/client/locations.rb,
lib/karatekit/client/rate_limit.rb,
lib/karatekit/client/event_parts.rb,
lib/karatekit/client/instructors.rb,
lib/karatekit/client/event_details.rb,
lib/karatekit/client/instructor_groups.rb,
lib/karatekit/client/instructor_details.rb,
lib/karatekit/client/instructor_group_members.rb
Overview
Client for the kampfsport.center API
Defined Under Namespace
Modules: EventDetails, EventParts, Events, InstructorDetails, InstructorGroupMembers, InstructorGroups, Instructors, Locations, Posts, Products, RateLimit, Sessions
Constant Summary collapse
- CONVENIENCE_HEADERS =
Header keys that can be passed in options hash to Karatekit::Connection#get,Karatekit::Connection#head
Set.new([:accept, :content_type])
Instance Attribute Summary
Attributes included from Configurable
#access_token, #api_endpoint, #auto_paginate, #connection_options, #default_media_type, #middleware, #per_page, #user_agent
Instance Method Summary collapse
-
#access_token=(value) ⇒ Object
Set OAuth access token for authentication.
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
-
#inspect ⇒ String
Text representation of the client, masking tokens and passwords.
Methods included from RateLimit
#rate_limit, #rate_limit!, #rate_limit_remaining, #rate_limit_remaining!
Methods included from InstructorGroupMembers
#instructor_group_member, #instructor_group_members
Methods included from InstructorGroups
#instructor_group, #instructor_groups
Methods included from InstructorDetails
#instructor_detail, #instructor_details
Methods included from Instructors
Methods included from Posts
Methods included from EventParts
Methods included from EventDetails
Methods included from Events
Methods included from Sessions
Methods included from Products
Methods included from Locations
Methods included from Warnable
Methods included from Connection
#agent, #delete, #get, #head, #last_response, #paginate, #patch, #post, #put, #root
Methods included from Authentication
Methods included from Configurable
#configure, keys, #reset!, #same_options?
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
49 50 51 52 53 54 55 |
# File 'lib/karatekit/client.rb', line 49 def initialize( = {}) # Use options passed in, but fall back to module defaults Karatekit::Configurable.keys.each do |key| value = .key?(key) ? [key] : Karatekit.instance_variable_get(:"@#{key}") instance_variable_set(:"@#{key}", value) end end |
Instance Method Details
#access_token=(value) ⇒ Object
Set OAuth access token for authentication
73 74 75 76 |
# File 'lib/karatekit/client.rb', line 73 def access_token=(value) reset_agent @access_token = value end |
#inspect ⇒ String
Text representation of the client, masking tokens and passwords
60 61 62 63 64 65 66 67 68 |
# File 'lib/karatekit/client.rb', line 60 def inspect inspected = super if @access_token inspected = inspected.gsub! @access_token, "#{'*'*36}#{@access_token[36..-1]}" end inspected end |