Class: ActiveProject::Adapters::GithubProjectAdapter

Constant Summary

Constants included from ActiveProject::Adapters::GithubProject::Issues

ActiveProject::Adapters::GithubProject::Issues::DEFAULT_ITEM_PAGE_SIZE

Constants included from ActiveProject::Adapters::GithubProject::Connection

ActiveProject::Adapters::GithubProject::Connection::ENDPOINT

Constants included from Connections::HttpClient

Connections::HttpClient::DEFAULT_HEADERS, Connections::HttpClient::DEFAULT_RETRY_OPTS

Instance Attribute Summary

Attributes included from Connections::HttpClient

#connection, #last_response

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods included from ActiveProject::Adapters::GithubProject::Webhooks

#parse_webhook, #verify_webhook_signature

Methods included from ActiveProject::Adapters::GithubProject::Comments

#add_comment, #delete_comment, #update_comment

Methods included from ActiveProject::Adapters::GithubProject::Issues

#create_issue, #delete_issue_original, #find_issue, #list_issues, #status_known?, #update_issue_original

Methods included from ActiveProject::Adapters::GithubProject::Helpers

#fetch_all_pages, #map_user, #owner_node_id, #project_field_ids

Methods included from ActiveProject::Adapters::GithubProject::Projects

#create_project, #delete_project, #find_project, #list_projects

Methods included from ActiveProject::Adapters::GithubProject::Connection

#initialize

Methods included from Connections::GraphQl

#init_graphql, #request_gql

Methods included from Connections::Pagination

#each_edge, #each_page

Methods included from Connections::HttpClient

#build_connection, #request

Methods included from Connections::Base

#parse_link_header

Methods inherited from Base

#add_comment, #create_issue, #create_list, #create_project, #delete_comment, #delete_project, #denormalize_status, #find_issue, #find_project, #initialize, #list_issues, #list_projects, #normalize_status, #parse_webhook, #status_known?, #supports_webhooks?, #update_comment, #valid_statuses, #verify_webhook_signature, webhook_type, #webhook_type

Instance Method Details

#adapter_typeObject



27
28
29
# File 'lib/active_project/adapters/github_project_adapter.rb', line 27

def adapter_type
  :github_project
end

#connected?Boolean

Returns:

  • (Boolean)


21
22
23
24
25
# File 'lib/active_project/adapters/github_project_adapter.rb', line 21

def connected? = begin
  !get_current_user.nil?
rescue StandardError
  false
end

#delete_issue(id, context = {}) ⇒ Object



37
38
39
40
41
# File 'lib/active_project/adapters/github_project_adapter.rb', line 37

def delete_issue(id, context = {})
  project_id = context[:project_id] || raise(ArgumentError,
"GithubProjectAdapter requires :project_id in context")
  delete_issue_internal(project_id, id)
end

#get_current_userObject



15
16
17
18
19
# File 'lib/active_project/adapters/github_project_adapter.rb', line 15

def get_current_user
  q = "query{viewer{ id login name email }}"
  data = request_gql(query: q)
  map_user_data(data["viewer"])
end

#issuesObject



13
# File 'lib/active_project/adapters/github_project_adapter.rb', line 13

def issues   = ResourceFactory.new(adapter: self, resource_class: Resources::Issue)

#projectsObject



12
# File 'lib/active_project/adapters/github_project_adapter.rb', line 12

def projects = ResourceFactory.new(adapter: self, resource_class: Resources::Project)

#update_issue(id, attributes, context = {}) ⇒ Object



31
32
33
34
35
# File 'lib/active_project/adapters/github_project_adapter.rb', line 31

def update_issue(id, attributes, context = {})
  project_id = context[:project_id] || raise(ArgumentError,
"GithubProjectAdapter requires :project_id in context")
  update_issue_internal(project_id, id, attributes)
end