{"id":15064635,"url":"https://github.com/brett-richardson/base_service","last_synced_at":"2025-08-14T05:17:11.720Z","repository":{"id":62554006,"uuid":"64074902","full_name":"brett-richardson/base_service","owner":"brett-richardson","description":"Base Service for Ruby Objects","archived":false,"fork":false,"pushed_at":"2016-07-26T21:25:13.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-06T01:32:10.379Z","etag":null,"topics":["oop","ruby","ruby-gem","ruby-library","ruby-on-rails","rubygem","services","solid"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brett-richardson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-24T16:31:14.000Z","updated_at":"2018-06-20T19:12:37.000Z","dependencies_parsed_at":"2022-11-03T05:00:31.031Z","dependency_job_id":null,"html_url":"https://github.com/brett-richardson/base_service","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/brett-richardson/base_service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brett-richardson%2Fbase_service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brett-richardson%2Fbase_service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brett-richardson%2Fbase_service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brett-richardson%2Fbase_service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brett-richardson","download_url":"https://codeload.github.com/brett-richardson/base_service/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brett-richardson%2Fbase_service/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270364971,"owners_count":24571423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-14T02:00:10.309Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["oop","ruby","ruby-gem","ruby-library","ruby-on-rails","rubygem","services","solid"],"created_at":"2024-09-25T00:23:00.399Z","updated_at":"2025-08-14T05:17:11.080Z","avatar_url":"https://github.com/brett-richardson.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"BaseService\n===========\n\nThe client should extend this module, in order to implement this common\nservice object pattern.\n\n### Advanced Syntax\n\n```ruby\n\nMyService.new(param1, param2).call do |on|\n  on.success { |result| puts \"Success #{result}\" }\n\n  on.failure { |error| puts \"Generic failure #{error}\" }\n  on.failure(:param1_error) { |error| puts \"Problem with param1 #{param1}\" }\n  on.failure(:param2_error) { |error| puts \"Problem with param1 #{param1}\" }\nend\n\n```\n\n### Semi-Advanced Syntax\n\n```ruby\n\nMyService.new(param1, param2).call do |on|\n  puts \"Result: #{on.result}\"\nend\n\n```\n\n## Support for (depreacted) legacy behaviour\n\nNo command-query separation. :(\n\n```ruby\n\nresult = MyService.new(param1, param2).call\n\n```\n\n## Example Service\n\n```ruby\n\nclass MyService\n  include BaseService\n\n  def initialize(param1, param2)\n    @param1, @param2 = param1, param2\n  end\n\n  private\n  attr_reader :param1, :param2\n\n  def perform\n    return failure \"no param1\", :param1_error  unless param1.present?\n    return failure \"no param2\", :param2_error  unless param2.present?\n    return failure \"neither param1 or 2\" unless param1.present? \u0026\u0026 param2.present?\n\n    return \"success!\"\n  end\nend\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrett-richardson%2Fbase_service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrett-richardson%2Fbase_service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrett-richardson%2Fbase_service/lists"}