Class: ActiveProject::Adapters::FizzyAdapter
- Includes:
- ActiveProject::Adapters::Fizzy::Columns, ActiveProject::Adapters::Fizzy::Comments, ActiveProject::Adapters::Fizzy::Connection, ActiveProject::Adapters::Fizzy::Issues, ActiveProject::Adapters::Fizzy::Projects
- Defined in:
- lib/active_project/adapters/fizzy_adapter.rb
Overview
Adapter for interacting with the Fizzy API. Fizzy is a Kanban-style project tracking tool by 37signals. Implements the interface defined in ActiveProject::Adapters::Base. API Docs: github.com/basecamp/fizzy (see docs/API.md)
Constant Summary
Constants included from ActiveProject::Adapters::Fizzy::Connection
ActiveProject::Adapters::Fizzy::Connection::DEFAULT_BASE_URL
Constants included from Connections::HttpClient
Connections::HttpClient::DEFAULT_HEADERS, Connections::HttpClient::DEFAULT_RETRY_OPTS
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Attributes included from Connections::HttpClient
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 (Boards).
Methods included from ActiveProject::Adapters::Fizzy::Columns
#create_list, #delete_list, #find_list, #list_lists, #update_list
Methods included from ActiveProject::Adapters::Fizzy::Comments
#add_comment, #delete_comment, #find_comment, #list_comments, #update_comment
Methods included from ActiveProject::Adapters::Fizzy::Issues
#create_issue, #delete_issue, #find_issue, #list_issues, #update_issue
Methods included from ActiveProject::Adapters::Fizzy::Projects
#create_project, #delete_project, #find_project, #list_projects
Methods included from ActiveProject::Adapters::Fizzy::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
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
15 16 17 |
# File 'lib/active_project/adapters/fizzy_adapter.rb', line 15 def base_url @base_url end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
15 16 17 |
# File 'lib/active_project/adapters/fizzy_adapter.rb', line 15 def config @config end |
Instance Method Details
#connected? ⇒ Boolean
Checks if the adapter can successfully authenticate and connect to the service.
63 64 65 66 67 68 |
# File 'lib/active_project/adapters/fizzy_adapter.rb', line 63 def connected? get_current_user true rescue ActiveProject::AuthenticationError false end |
#get_current_user ⇒ ActiveProject::Resources::User
Retrieves details for the currently authenticated user. Uses /my/identity endpoint which returns accounts and user info.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/active_project/adapters/fizzy_adapter.rb', line 44 def get_current_user # Fizzy's /my/identity is at the root, not under account_slug # We need to make a request to the base URL without the account_slug base_without_slug = @base_url.sub(%r{/\d+/$}, "/") response = @connection.get("#{base_without_slug}my/identity") identity_data = parse_response(response) # Get the first account's user data first_account = identity_data["accounts"]&.first return nil unless first_account user_data = first_account["user"] map_user_data(user_data) rescue Faraday::Error => e handle_faraday_error(e) end |
#issues ⇒ ResourceFactory<Resources::Issue>
Returns a factory for Issue resources (Cards).
33 34 35 |
# File 'lib/active_project/adapters/fizzy_adapter.rb', line 33 def issues ResourceFactory.new(adapter: self, resource_class: Resources::Issue) end |
#projects ⇒ ResourceFactory<Resources::Project>
Returns a factory for Project resources (Boards).
27 28 29 |
# File 'lib/active_project/adapters/fizzy_adapter.rb', line 27 def projects ResourceFactory.new(adapter: self, resource_class: Resources::Project) end |