Class: Camp3::Client
- Inherits:
-
Object
- Object
- Camp3::Client
- Includes:
- Authorization, MessageAPI, ProjectAPI, ResourceAPI, TodoAPI
- Defined in:
- lib/camp3/client.rb,
lib/camp3/api/todo.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: MessageAPI, ProjectAPI, ResourceAPI, TodoAPI
Instance Method Summary collapse
-
#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 Authorization
#authorization_uri, #authorize!, #authz_client, #update_access_token!
Constructor Details
#initialize(options = {}) ⇒ Client
Creates a new API.
20 21 22 23 24 25 26 |
# File 'lib/camp3/client.rb', line 20 def initialize( = {}) = Camp3..merge() (Configuration::VALID_OPTIONS_KEYS).each do |key| send("#{key}=", [key]) if [key] end end |
Instance Method Details
#inspect ⇒ String
Text representation of the client, masking private token.
43 44 45 46 47 |
# File 'lib/camp3/client.rb', line 43 def inspect inspected = super inspected.sub! @access_token, only_show_last_four_chars(@access_token) if @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
53 54 55 |
# File 'lib/camp3/client.rb', line 53 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 |