{"id":13747338,"url":"https://github.com/basecamp/platform_agent","last_synced_at":"2025-07-20T03:31:12.934Z","repository":{"id":56888242,"uuid":"178965628","full_name":"basecamp/platform_agent","owner":"basecamp","description":"Parse user agent to deduce the platform","archived":false,"fork":false,"pushed_at":"2022-07-22T03:03:07.000Z","size":9,"stargazers_count":125,"open_issues_count":1,"forks_count":4,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-07-18T05:34:50.035Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":false,"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/basecamp.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":"2019-04-02T00:02:29.000Z","updated_at":"2025-05-31T03:17:53.000Z","dependencies_parsed_at":"2022-08-20T16:00:15.009Z","dependency_job_id":null,"html_url":"https://github.com/basecamp/platform_agent","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/basecamp/platform_agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basecamp%2Fplatform_agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basecamp%2Fplatform_agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basecamp%2Fplatform_agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basecamp%2Fplatform_agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/basecamp","download_url":"https://codeload.github.com/basecamp/platform_agent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basecamp%2Fplatform_agent/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266063095,"owners_count":23870716,"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","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":[],"created_at":"2024-08-03T06:01:25.468Z","updated_at":"2025-07-20T03:31:12.894Z","avatar_url":"https://github.com/basecamp.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Platform Agent\n\nParse user agent to discern the common platforms that UIs are tailored for. Expected that you'll inherit from this to specify native apps.\n\n## Examples\n\n```ruby\nclass ApplicationPlatform \u003c PlatformAgent\n  def ios_app?\n    match? /BC3 iOS/\n  end\n\n  def android_app?\n    match? /BC3 Android/\n  end\n\n  def mac_app?\n    match?(/Electron/) \u0026\u0026 match?(/basecamp3/) \u0026\u0026 match?(/Macintosh/)\n  end\n\n  def windows_app?\n    match?(/Electron/) \u0026\u0026 match?(/basecamp3/) \u0026\u0026 match?(/Windows/)\n  end\nend\n\nmodule SetPlatform\n  extend ActiveSupport::Concern\n\n  included do\n    helper_method :platform\n  end\n\n  private\n    def platform\n      @platform ||= ApplicationPlatform.new(request.user_agent)\n    end\nend\n\nclass ApplicationController \u003c ActionController::Base\n  include SetPlatform\nend\n\n\u003c% if platform.phone? %\u003e\n  Do phone specific stuff!\n\u003c% end %\u003e\n```\n\n## Maintenance Expectations\n\nThis library is an extraction from Basecamp that's been sufficient in almost unaltered form for years. While contributions are always welcome, do not expect a lot of feature evolution beyond the basics.\n\n## License\n\nPlatform Agent is released under the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasecamp%2Fplatform_agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasecamp%2Fplatform_agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasecamp%2Fplatform_agent/lists"}