Class: BacklogKit::Client
- Inherits:
-
Object
- Object
- BacklogKit::Client
- Includes:
- Authorization, Git, Group, Issue, Notification, Priority, Project, Resolution, Space, Star, Status, User, Wiki
- Defined in:
- lib/backlog_kit/client.rb,
lib/backlog_kit/client/git.rb,
lib/backlog_kit/client/star.rb,
lib/backlog_kit/client/user.rb,
lib/backlog_kit/client/wiki.rb,
lib/backlog_kit/client/group.rb,
lib/backlog_kit/client/issue.rb,
lib/backlog_kit/client/space.rb,
lib/backlog_kit/client/status.rb,
lib/backlog_kit/client/project.rb,
lib/backlog_kit/client/priority.rb,
lib/backlog_kit/client/resolution.rb,
lib/backlog_kit/client/notification.rb,
lib/backlog_kit/client/authorization.rb
Defined Under Namespace
Modules: Authorization, Git, Group, Issue, Notification, Priority, Project, Resolution, Space, Star, Status, User, Wiki
Constant Summary collapse
- USER_AGENT =
"BacklogKit Ruby Gem #{BacklogKit::VERSION}".freeze
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
-
#space_id ⇒ Object
Returns the value of attribute space_id.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
- #authorization_url ⇒ Object
- #delete(path, params = {}) ⇒ Object
- #get(path, params = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #patch(path, params = {}) ⇒ Object
- #post(path, params = {}) ⇒ Object
- #put(path, params = {}) ⇒ Object
Methods included from Wiki
#create_wiki, #delete_wiki, #get_wiki, #get_wiki_count, #get_wiki_histories, #get_wiki_shared_files, #get_wiki_stars, #get_wiki_tags, #get_wikis, #link_wiki_shared_files, #unlink_wiki_shared_file, #update_wiki
Methods included from User
#create_user, #delete_user, #download_user_icon, #get_myself, #get_recently_viewed_issues, #get_recently_viewed_projects, #get_recently_viewed_wikis, #get_user, #get_user_activities, #get_user_star_count, #get_user_stars, #get_users, #update_user
Methods included from Status
Methods included from Star
#add_issue_comment_star, #add_issue_star, #add_wiki_star
Methods included from Space
#download_space_icon, #get_space, #get_space_activities, #get_space_disk_usage, #get_space_notification, #update_space_notification, #upload_attachment
Methods included from Resolution
Methods included from Project
#add_category, #add_issue_type, #add_project_admin_auth, #add_project_user, #add_version, #add_webhook, #create_project, #delete_project, #download_project_icon, #download_shared_file, #get_categories, #get_issue_types, #get_project, #get_project_activities, #get_project_administrators, #get_project_disk_usage, #get_project_users, #get_projects, #get_shared_files, #get_versions, #get_webhook, #get_webhooks, #remove_category, #remove_issue_type, #remove_project_admin_auth, #remove_project_user, #remove_version, #remove_webhook, #update_category, #update_issue_type, #update_project, #update_version, #update_webhook
Methods included from Priority
Methods included from Notification
#get_notification_count, #get_notifications, #mark_as_read_notification, #reset_already_read_notification_count
Methods included from Issue
#add_comment, #add_comment_notification, #create_issue, #delete_issue, #download_issue_attachment, #get_comment, #get_comment_count, #get_comment_notifications, #get_comments, #get_issue, #get_issue_attachments, #get_issue_count, #get_issue_shared_files, #get_issues, #link_issue_shared_files, #remove_issue_attachment, #unlink_issue_shared_file, #update_comment, #update_issue
Methods included from Group
#create_group, #delete_group, #get_group, #get_groups, #update_group
Methods included from Git
Methods included from Authorization
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/backlog_kit/client.rb', line 50 def initialize( = {}) @space_id = ENV['BACKLOG_SPACE_ID'] @api_key = ENV['BACKLOG_API_KEY'] @client_id = ENV['BACKLOG_OAUTH_CLIENT_ID'] @client_secret = ENV['BACKLOG_OAUTH_CLIENT_SECRET'] @refresh_token = ENV['BACKLOG_OAUTH_REFRESH_TOKEN'] .each do |key, value| instance_variable_set(:"@#{key}", value) end end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
39 40 41 |
# File 'lib/backlog_kit/client.rb', line 39 def access_token @access_token end |
#api_key ⇒ Object
Returns the value of attribute api_key.
39 40 41 |
# File 'lib/backlog_kit/client.rb', line 39 def api_key @api_key end |
#client_id ⇒ Object
Returns the value of attribute client_id.
39 40 41 |
# File 'lib/backlog_kit/client.rb', line 39 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
39 40 41 |
# File 'lib/backlog_kit/client.rb', line 39 def client_secret @client_secret end |
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
39 40 41 |
# File 'lib/backlog_kit/client.rb', line 39 def redirect_uri @redirect_uri end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
39 40 41 |
# File 'lib/backlog_kit/client.rb', line 39 def refresh_token @refresh_token end |
#space_id ⇒ Object
Returns the value of attribute space_id.
39 40 41 |
# File 'lib/backlog_kit/client.rb', line 39 def space_id @space_id end |
#state ⇒ Object
Returns the value of attribute state.
39 40 41 |
# File 'lib/backlog_kit/client.rb', line 39 def state @state end |
Instance Method Details
#authorization_url ⇒ Object
62 63 64 65 66 67 |
# File 'lib/backlog_kit/client.rb', line 62 def url = "#{host}/OAuth2AccessRequest.action?response_type=code&client_id=#{@client_id}" url += "&redirect_uri=#{URI.escape(@redirect_uri)}" if @redirect_uri url += "&state=#{@state}" if @state url end |
#delete(path, params = {}) ⇒ Object
85 86 87 |
# File 'lib/backlog_kit/client.rb', line 85 def delete(path, params = {}) request(:delete, path, params) end |
#get(path, params = {}) ⇒ Object
69 70 71 |
# File 'lib/backlog_kit/client.rb', line 69 def get(path, params = {}) request(:get, path, params) end |
#patch(path, params = {}) ⇒ Object
81 82 83 |
# File 'lib/backlog_kit/client.rb', line 81 def patch(path, params = {}) request(:patch, path, params) end |
#post(path, params = {}) ⇒ Object
73 74 75 |
# File 'lib/backlog_kit/client.rb', line 73 def post(path, params = {}) request(:post, path, params) end |
#put(path, params = {}) ⇒ Object
77 78 79 |
# File 'lib/backlog_kit/client.rb', line 77 def put(path, params = {}) request(:put, path, params) end |