Class: ActiveProject::Adapters::TrelloAdapter
- Includes:
- ActiveProject::Adapters::Trello::Comments, ActiveProject::Adapters::Trello::Connection, ActiveProject::Adapters::Trello::Issues, ActiveProject::Adapters::Trello::Lists, ActiveProject::Adapters::Trello::Projects, ActiveProject::Adapters::Trello::Webhooks
- Defined in:
- lib/active_project/adapters/trello_adapter.rb
Overview
Adapter for interacting with the Trello REST API. Implements the interface defined in ActiveProject::Adapters::Base. API Docs: developer.atlassian.com/cloud/trello/rest/
Constant Summary
Constants included from ActiveProject::Adapters::Trello::Issues
ActiveProject::Adapters::Trello::Issues::DEFAULT_FIELDS
Constants included from ActiveProject::Adapters::Trello::Connection
ActiveProject::Adapters::Trello::Connection::BASE_URL
Constants included from Connections::HttpClient
Connections::HttpClient::DEFAULT_HEADERS, Connections::HttpClient::DEFAULT_RETRY_OPTS
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Attributes included from Connections::HttpClient
Class Method Summary collapse
-
.compute_webhook_signature(callback_url, response_body, api_secret) ⇒ String
Computes the expected Trello webhook signature.
Instance Method Summary collapse
-
#connected? ⇒ Boolean
Checks if the adapter can successfully authenticate and connect to the service.
-
#get_current_user ⇒ ActiveProject::Resources::User
Retrieves details for the currently authenticated user.
-
#issues ⇒ ResourceFactory<Resources::Issue>
Returns a factory for Issue resources (Cards).
-
#projects ⇒ ResourceFactory<Resources::Project>
Returns a factory for Project resources.
Methods included from ActiveProject::Adapters::Trello::Webhooks
Methods included from ActiveProject::Adapters::Trello::Lists
Methods included from ActiveProject::Adapters::Trello::Comments
#add_comment, #delete_comment, #update_comment
Methods included from ActiveProject::Adapters::Trello::Issues
#create_issue, #delete_issue, #find_issue, #list_issues, #update_issue
Methods included from ActiveProject::Adapters::Trello::Projects
#create_project, #delete_project, #find_project, #list_projects
Methods included from ActiveProject::Adapters::Trello::Connection
Methods included from Connections::Rest
Methods included from Connections::Pagination
Methods included from Connections::HttpClient
Methods included from Connections::Base
Methods inherited from Base
#add_comment, #create_issue, #create_list, #create_project, #delete_comment, #delete_issue, #delete_project, #denormalize_status, #find_issue, #find_project, #initialize, #list_issues, #list_projects, #normalize_status, #parse_webhook, #status_known?, #supports_webhooks?, #update_comment, #update_issue, #valid_statuses, #verify_webhook_signature, #webhook_type, webhook_type
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
27 28 29 |
# File 'lib/active_project/adapters/trello_adapter.rb', line 27 def config @config end |
Class Method Details
.compute_webhook_signature(callback_url, response_body, api_secret) ⇒ String
Computes the expected Trello webhook signature.
21 22 23 24 25 |
# File 'lib/active_project/adapters/trello_adapter.rb', line 21 def self.compute_webhook_signature(callback_url, response_body, api_secret) digest = OpenSSL::Digest.new("sha1") hmac = OpenSSL::HMAC.digest(digest, api_secret, response_body + callback_url) Base64.strict_encode64(hmac) end |
Instance Method Details
#connected? ⇒ Boolean
Checks if the adapter can successfully authenticate and connect to the service. Calls #get_current_user internally and catches authentication errors.
62 63 64 65 66 67 |
# File 'lib/active_project/adapters/trello_adapter.rb', line 62 def connected? get_current_user true rescue ActiveProject::AuthenticationError false end |
#get_current_user ⇒ ActiveProject::Resources::User
Retrieves details for the currently authenticated user.
54 55 56 57 |
# File 'lib/active_project/adapters/trello_adapter.rb', line 54 def get_current_user user_data = make_request(:get, "members/me") map_user_data(user_data) end |
#issues ⇒ ResourceFactory<Resources::Issue>
Returns a factory for Issue resources (Cards).
46 47 48 |
# File 'lib/active_project/adapters/trello_adapter.rb', line 46 def issues ResourceFactory.new(adapter: self, resource_class: Resources::Issue) end |
#projects ⇒ ResourceFactory<Resources::Project>
Returns a factory for Project resources.
40 41 42 |
# File 'lib/active_project/adapters/trello_adapter.rb', line 40 def projects ResourceFactory.new(adapter: self, resource_class: Resources::Project) end |