Class: ActiveProject::Adapters::GithubRepoAdapter
- Includes:
- ActiveProject::Adapters::GithubRepo::Connection, ActiveProject::Adapters::GithubRepo::Issues, ActiveProject::Adapters::GithubRepo::Projects, ActiveProject::Adapters::GithubRepo::Webhooks
- Defined in:
- lib/active_project/adapters/github_repo_adapter.rb
Overview
Adapter for interacting with the GitHub REST API. Implements the interface defined in ActiveProject::Adapters::Base. API Docs: docs.github.com/en/rest
Constant Summary
Constants included from ActiveProject::Adapters::GithubRepo::Connection
ActiveProject::Adapters::GithubRepo::Connection::BASE_URL
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
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.
-
#projects ⇒ ResourceFactory<Resources::Project>
Returns a factory for Project resources.
Methods included from ActiveProject::Adapters::GithubRepo::Webhooks
#parse_webhook, #secure_compare, #verify_webhook_signature
Methods included from ActiveProject::Adapters::GithubRepo::Issues
#create_issue, #delete_issue, #find_issue, #list_issues, #update_issue
Methods included from ActiveProject::Adapters::GithubRepo::Projects
#create_project, #delete_project, #find_project, #list_projects
Methods included from ActiveProject::Adapters::GithubRepo::Connection
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.
14 15 16 |
# File 'lib/active_project/adapters/github_repo_adapter.rb', line 14 def config @config 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.
33 34 35 36 37 38 |
# File 'lib/active_project/adapters/github_repo_adapter.rb', line 33 def connected? get_current_user true rescue ActiveProject::AuthenticationError false end |
#get_current_user ⇒ ActiveProject::Resources::User
Retrieves details for the currently authenticated user.
25 26 27 28 |
# File 'lib/active_project/adapters/github_repo_adapter.rb', line 25 def get_current_user user_data = make_request(:get, "user") map_user_data(user_data) end |
#issues ⇒ ResourceFactory<Resources::Issue>
Returns a factory for Issue resources.
49 50 51 |
# File 'lib/active_project/adapters/github_repo_adapter.rb', line 49 def issues ResourceFactory.new(adapter: self, resource_class: Resources::Issue) end |
#projects ⇒ ResourceFactory<Resources::Project>
Returns a factory for Project resources. In GitHub’s context, this is for interacting with repositories.
43 44 45 |
# File 'lib/active_project/adapters/github_repo_adapter.rb', line 43 def projects ResourceFactory.new(adapter: self, resource_class: Resources::Project) end |