{"id":47871678,"url":"https://github.com/twilightcoders/alta_labs","last_synced_at":"2026-04-07T03:00:44.494Z","repository":{"id":348186530,"uuid":"1196856087","full_name":"TwilightCoders/alta_labs","owner":"TwilightCoders","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-31T05:41:29.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-05T01:10:00.657Z","etag":null,"topics":[],"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/TwilightCoders.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-31T05:29:49.000Z","updated_at":"2026-03-31T05:34:48.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/TwilightCoders/alta_labs","commit_stats":null,"previous_names":["twilightcoders/alta_labs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TwilightCoders/alta_labs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwilightCoders%2Falta_labs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwilightCoders%2Falta_labs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwilightCoders%2Falta_labs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwilightCoders%2Falta_labs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TwilightCoders","download_url":"https://codeload.github.com/TwilightCoders/alta_labs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwilightCoders%2Falta_labs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31456664,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"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":[],"created_at":"2026-04-04T00:54:23.633Z","updated_at":"2026-04-06T02:01:15.564Z","avatar_url":"https://github.com/TwilightCoders.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Gem Version](https://img.shields.io/gem/v/alta_labs.svg)](https://rubygems.org/gems/alta_labs)\n[![Build Status](https://github.com/TwilightCoders/alta_labs/workflows/CI/badge.svg)](https://github.com/TwilightCoders/alta_labs/actions)\n[![Coverage](https://img.qlty.sh/badges/github/TwilightCoders/alta_labs/coverage.svg)](https://qlty.sh/gh/TwilightCoders/alta_labs)\n\n# AltaLabs\n\nA Ruby SDK for the [Alta Labs](https://alta.inc) cloud management API. Manage sites, devices, WiFi networks, and more programmatically.\n\n\u003e **Note:** Alta Labs does not currently publish public API documentation. This library was built by reverse-engineering the web management portal at `manage.alta.inc`. While functional, the API surface may change without notice.\n\n## Installation\n\nAdd to your Gemfile:\n\n```ruby\ngem 'alta_labs'\n```\n\nOr install directly:\n\n```\n$ gem install alta_labs\n```\n\n## Usage\n\n### Authentication\n\nThe SDK authenticates with Alta Labs via AWS Cognito SRP — the same mechanism used by the web portal. No AWS SDK dependency is required; SRP is implemented natively.\n\n```ruby\nrequire 'alta_labs'\n\nclient = AltaLabs::Client.new(\n  email: 'you@example.com',\n  password: 'your-password'\n)\n\n# Authentication happens automatically on the first API call,\n# or you can authenticate explicitly:\nclient.authenticate\n```\n\nYou can also configure via environment variables or a block:\n\n```ruby\n# Environment variables (ALTA_LABS_EMAIL, ALTA_LABS_PASSWORD)\nclient = AltaLabs::Client.new\n\n# Block configuration\nAltaLabs.configure do |config|\n  config.email = 'you@example.com'\n  config.password = 'your-password'\n  config.timeout = 60\nend\n```\n\n### Sites\n\n```ruby\n# List all sites\nsites = client.sites.list\n# =\u003e [{\"id\" =\u003e \"abc123\", \"name\" =\u003e \"Main Office\", \"online\" =\u003e 5, ...}]\n\n# Get site detail\nsite = client.sites.find(id: 'abc123')\n# =\u003e {\"id\" =\u003e \"abc123\", \"tz\" =\u003e \"America/Denver\", \"vlans\" =\u003e [...], ...}\n\n# Site audit log\naudit = client.sites.audit(id: 'abc123')\naudit['trail'].each do |entry|\n  puts \"[#{entry['ts']}] #{entry['action']} #{entry['type']}\"\nend\n\n# Create a site\nclient.sites.create(name: 'New Site', type: 'residential')\n\n# Rename a site\nclient.sites.rename(id: 'abc123', name: 'Updated Name')\n```\n\n### Devices\n\n```ruby\n# List devices for a site\ndevices = client.devices.list(site_id: 'abc123')\n\n# Add a device by serial number\nclient.devices.add_serial(site_id: 'abc123', serial: 'ALTA-XXXX')\n\n# Move a device between sites\nclient.devices.move(id: 'device-id', site_id: 'new-site-id')\n```\n\n### WiFi / SSIDs\n\n```ruby\n# List SSIDs for a site\nresult = client.wifi.list(site_id: 'abc123')\nresult['ssids'].each do |ssid|\n  puts \"#{ssid['ssid']} (#{ssid.dig('config', 'security')})\"\nend\n\n# Get a specific SSID\nssid = client.wifi.find(id: 'ssid-id')\n```\n\n### Account\n\n```ruby\n# Get account info (requires access_token)\ninfo = client.account.info\n```\n\n### Content Filtering\n\n```ruby\n# Get content filter settings\nfilter = client.filters.get_filter(site_id: 'abc123')\n# =\u003e {\"blockedRegions\" =\u003e [\"CN\"], \"blockWired\" =\u003e true, ...}\n```\n\n### Profiles\n\n```ruby\nprofiles = client.profiles.list(site_ids: ['abc123'])\n```\n\n### Floor Plans\n\n```ruby\nfloors = client.floor_plans.floors(site_id: 'abc123')\n```\n\n## Token Management\n\nTokens are automatically refreshed when they expire. The SDK handles:\n\n- Initial SRP authentication with Cognito\n- JWT token storage and expiration tracking\n- Automatic token refresh using the refresh token\n- MFA challenges (raises `AltaLabs::MfaRequiredError` with session data)\n\n### MFA Support\n\nIf MFA is enabled on the account:\n\n```ruby\nbegin\n  client.authenticate\nrescue AltaLabs::MfaRequiredError =\u003e e\n  # Prompt user for MFA code\n  client.auth.verify_mfa(\n    code: '123456',\n    session: e.session,\n    challenge_name: e.challenge_name\n  )\nend\n```\n\n## Error Handling\n\n```ruby\nbegin\n  client.sites.find(id: 'nonexistent')\nrescue AltaLabs::AuthenticationError =\u003e e\n  # Invalid credentials or expired session\nrescue AltaLabs::NotFoundError =\u003e e\n  # Resource not found\nrescue AltaLabs::RateLimitError =\u003e e\n  # Too many requests\nrescue AltaLabs::ServerError =\u003e e\n  # Alta Labs server error\nrescue AltaLabs::ApiError =\u003e e\n  # Generic API error\n  puts e.status # HTTP status code\n  puts e.body   # Response body\nend\n```\n\n## Configuration Options\n\n| Option | Default | Description |\n|--------|---------|-------------|\n| `email` | `ENV['ALTA_LABS_EMAIL']` | Account email |\n| `password` | `ENV['ALTA_LABS_PASSWORD']` | Account password |\n| `api_url` | `https://manage.alta.inc` | API base URL |\n| `timeout` | `30` | Request timeout (seconds) |\n| `open_timeout` | `10` | Connection open timeout (seconds) |\n\n## Self-Hosted Controller\n\nTo use with a self-hosted Alta Control instance:\n\n```ruby\nclient = AltaLabs::Client.new(\n  email: 'you@example.com',\n  password: 'your-password',\n)\nclient.config.api_url = 'https://your-controller.local'\n```\n\n## Development\n\n```\n$ bundle install\n$ bundle exec rspec\n$ bin/console\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b feature/my-feature`)\n3. Commit your changes (`git commit -am 'Add my feature'`)\n4. Push to the branch (`git push origin feature/my-feature`)\n5. Create a Pull Request\n\n## License\n\nMIT License. See [LICENSE.txt](LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwilightcoders%2Falta_labs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwilightcoders%2Falta_labs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwilightcoders%2Falta_labs/lists"}