Class: Camp3::Client
- Inherits:
-
Object
- Object
- Camp3::Client
- Extended by:
- Forwardable
- Includes:
- Authorization, CommentAPI, MessageAPI, ProjectAPI, ResourceAPI, TodoAPI, Logging
- Defined in:
- lib/camp3/client.rb,
lib/camp3/api/todo.rb,
lib/camp3/api/comment.rb,
lib/camp3/api/message.rb,
lib/camp3/api/project.rb,
lib/camp3/api/resource.rb
Overview
Wrapper for the Camp3 REST API.
Defined Under Namespace
Modules: CommentAPI, MessageAPI, ProjectAPI, ResourceAPI, TodoAPI
Instance Attribute Summary
Attributes included from Logging
Instance Method Summary collapse
-
#configure {|@config| ... } ⇒ Object
Allows setting configuration values for this client returns the client instance being configured.
-
#initialize(options = {}) ⇒ Client
constructor
Creates a new API.
-
#inspect ⇒ String
Text representation of the client, masking private token.
-
#url_encode(url) ⇒ String
Utility method for URL encoding of a string.
Methods included from TodoAPI
Methods included from ResourceAPI
Methods included from ProjectAPI
#message_board, #projects, #todoset
Methods included from MessageAPI
Methods included from CommentAPI
Methods included from Authorization
#authorization_uri, #authorize!, #authz_client, #update_access_token!
Constructor Details
#initialize(options = {}) ⇒ Client
Creates a new API.
24 25 26 |
# File 'lib/camp3/client.rb', line 24 def initialize( = {}) @config = Configuration.new() end |
Instance Method Details
#configure {|@config| ... } ⇒ Object
Allows setting configuration values for this client returns the client instance being configured
42 43 44 45 46 |
# File 'lib/camp3/client.rb', line 42 def configure yield @config self end |
#inspect ⇒ String
Text representation of the client, masking private token.
51 52 53 54 55 |
# File 'lib/camp3/client.rb', line 51 def inspect inspected = super inspected.sub! @config.access_token, only_show_last_four_chars(@config.access_token) if @config.access_token inspected end |
#url_encode(url) ⇒ String
Utility method for URL encoding of a string. Copied from ruby-doc.org/stdlib-2.7.0/libdoc/erb/rdoc/ERB/Util.html
61 62 63 |
# File 'lib/camp3/client.rb', line 61 def url_encode(url) url.to_s.b.gsub(/[^a-zA-Z0-9_\-.~]/n) { |m| sprintf('%%%02X', m.unpack1('C')) } # rubocop:disable Style/FormatString, Style/FormatStringToken end |