{"id":13764481,"url":"https://github.com/NGMarmaduke/cisco_spark-ruby","last_synced_at":"2025-05-10T19:31:17.072Z","repository":{"id":56843515,"uuid":"55861764","full_name":"NGMarmaduke/cisco_spark-ruby","owner":"NGMarmaduke","description":"Ruby client for Spark: https://developer.ciscospark.com","archived":false,"fork":false,"pushed_at":"2024-06-07T11:35:02.000Z","size":26,"stargazers_count":9,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-26T19:39:53.135Z","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/NGMarmaduke.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2016-04-09T18:56:16.000Z","updated_at":"2021-11-15T16:23:34.000Z","dependencies_parsed_at":"2024-01-30T06:59:07.473Z","dependency_job_id":"2099e056-024f-4b0a-a1fd-4ec6807b7b6a","html_url":"https://github.com/NGMarmaduke/cisco_spark-ruby","commit_stats":{"total_commits":30,"total_committers":5,"mean_commits":6.0,"dds":0.3666666666666667,"last_synced_commit":"87fdcb63c873840faf2202b8b58e26e0a299a34b"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NGMarmaduke%2Fcisco_spark-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NGMarmaduke%2Fcisco_spark-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NGMarmaduke%2Fcisco_spark-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NGMarmaduke%2Fcisco_spark-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NGMarmaduke","download_url":"https://codeload.github.com/NGMarmaduke/cisco_spark-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253470790,"owners_count":21913734,"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-03T16:00:21.320Z","updated_at":"2025-05-10T19:31:16.777Z","avatar_url":"https://github.com/NGMarmaduke.png","language":"Ruby","readme":"# CiscoSpark\n[![Build Status](https://travis-ci.org/NGMarmaduke/cisco_spark-ruby.svg?branch=master)](https://travis-ci.org/NGMarmaduke/cisco_spark-ruby)\n[![Coverage Status](https://coveralls.io/repos/github/NGMarmaduke/cisco_spark-ruby/badge.svg?branch=master)](https://coveralls.io/github/NGMarmaduke/cisco_spark-ruby?branch=master)\n\nRuby client for [Cisco Spark](https://developer.ciscospark.com).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'cisco_spark'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install cisco_spark\n\n## Usage\n\n### Configuration\nConfiguration can be done in an initializer on app boot.\nAn API key or users OAuth token is required to make any API requests.\n\nAPI key example:\n```ruby\nCiscoSpark.configure do |config|\n  config.api_key = 'YOUR KEY'\nend\n```\n\nIf you are using OAuth token you can wrap API operaions in a block, all API calls within the block will then use that token.\n\nOAuth token example:\n```ruby\nCiscoSpark.with_token('OAuth token') do\n  users_rooms = CiscoSpark::Room.fetch_all\nend\n```\n\n### Models\nAll models have methods to interact with the API and parse response data.\n\nInlcuded models:\n- `CiscoSpark::Person`\n- `CiscoSpark::Room`\n- `CiscoSpark::Membership`\n- `CiscoSpark::Message`\n- `CiscoSpark::Team`\n- `CiscoSpark::TeamMembership`\n- `CiscoSpark::Webhook`\n\nYou can call all the following methods on any of these models\n\n###### `class.fetch_all`\nFetches all records for a given model, returns a `CiscoSpark::Collection`\nAccepts any parameters that the API allows.\n\n```ruby\nrooms = CiscoSpark::Room.fetch_all(max: 5)\n=\u003e #\u003cCiscoSpark::Collection\u003e\n```\n\n###### `class.fetch`\nFetches a single record for the given resource ID, returns an instance\nAccepts any parameters that the API allows.\n\n```ruby\nroom = CiscoSpark::Room.fetch('Y2lzY...', show_sip_address: true)\n=\u003e #\u003cCiscoSpark::Room\u003e\n```\n\n###### `class.create`\nCreates a resource with given attribues, returns an instance\nAccepts any parameters that the API allows.\n\n```ruby\nroom = CiscoSpark::Room.create(title: 'Ruby Room')\n=\u003e #\u003cCiscoSpark::Room\u003e\n```\n\n###### `class.update`\nUpdates a resource with given attribues, returns an instance\nAccepts any parameters that the API allows.\n\n```ruby\nroom = CiscoSpark::Room.update('Y2lzY...', title: 'Groovey Ruby Room')\n=\u003e #\u003cCiscoSpark::Room\u003e\n```\n\n###### `class.destroy`\nDestroys a resource with the given ID, returns an boolean to indicate success\nAccepts any parameters that the API allows.\n\n```ruby\nroom = CiscoSpark::Room.destroy('Y2lzY...')\n=\u003e true\n```\n\n###### `class.parse_collection`\nParses a valid JSON string or a ruby hash/array into a collection of models.\nThis is useful for processing data recieved from a webhook etc.\n\n```ruby\njson_string = '{\"items\": [{ \"id\": \"Y2lzY...\", \"key\": \"value\" }]}'\nrooms = CiscoSpark::Room.parse_collection(json_string)\n=\u003e #\u003cCiscoSpark::Collection\u003e\n```\n\n###### `class.parse`\nParses a valid JSON string or a ruby hash/array into a model.\nThis is useful for processing data recieved from a webhook etc.\n\n```ruby\njson_string = '{ \"id\": \"Y2lzY...\", \"key\": \"value\" }'\nroom = CiscoSpark::Room.parse(json_string)\n=\u003e #\u003cCiscoSpark::Room\u003e\n```\n\n###### `class.new`\nCreates a new instance of the model with given attributes\n\n```ruby\nroom = CiscoSpark::Room.new(title: 'New room')\n=\u003e #\u003cCiscoSpark::Room\u003e\n```\n\n###### `instance.persist`\nYou can call persist on an instance to create or update it through the API.\nIf the instance already has an ID a `PUT` will be made to update the mutable attributes\n\n```ruby\nroom = CiscoSpark::Room.new(title: 'New room')\nroom.persist\n=\u003e #\u003cCiscoSpark::Room\u003e\n```\n\n###### `instance.fetch`\nYou can call fetch on an instance fetch or refresh an instance\n\n```ruby\nroom = CiscoSpark::Room.new(id: 'Y2lzY...')\nroom.fetch\n=\u003e #\u003cCiscoSpark::Room\u003e\n```\n\n###### `instance.destroy`\nYou can call destroy on an instance to destroy it through the API\n\n```ruby\nroom = CiscoSpark::Room.new(id: 'Y2lzY...')\nroom.destroy\n=\u003e true\n```\n\n###### `instance.to_h`\nConvert a model instance into a hash\n\n```ruby\nroom = CiscoSpark::Room.fetch('Y2lzY...')\nroom.to_h\n=\u003e Hash\n```\n\n##### `CiscoSpark::Person`\n[API reference](https://developer.ciscospark.com/resource-people.html)\n\n###### `CiscoSpark::Person.all_by_email`\nSearch all people by email,\n\n```ruby\npeople = CiscoSpark::Person.all_by_email('nickpmaher@gmail.com', max: 5)\n=\u003e #\u003cCiscoSpark::Collection\u003e\n```\n\n###### `CiscoSpark::Person.all_by_name`\nSearch all people by display name\n\n```ruby\npeople = CiscoSpark::Person.all_by_name('Nick', max: 5)\n=\u003e #\u003cCiscoSpark::Collection\u003e\n```\n\n###### `#memberships`\nGet all memberships for person\n\n```ruby\nperson = CiscoSpark::Person.new(id: 'Y2lz...')\nperson.memberships(max: 5)\n=\u003e #\u003cCiscoSpark::Collection\u003e\n```\n\n##### `CiscoSpark::Room`\n[API reference](https://developer.ciscospark.com/resource-rooms.html)\n\n###### `#memberships`\nGet all memberships for room\n\n```ruby\nroom = CiscoSpark::Room.new(id: 'Y3de...')\nroom.memberships(max: 5)\n=\u003e #\u003cCiscoSpark::Collection\u003e\n```\n\n###### `#messages`\nGet all messages for room\n\n```ruby\nroom = CiscoSpark::Room.new(id: 'Y3de...')\nroom.messages(max: 5)\n=\u003e #\u003cCiscoSpark::Collection\u003e\n```\n\n###### `#messages_before_message`\nGet all message before a given message, accepts a `CiscoSpark::Message` or a message ID\n\n```ruby\nroom.all_before_message('Y3de...', max: 5)\n=\u003e #\u003cCiscoSpark::Collection\u003e\n```\n\n###### `#messages_before`\nGet all message before a given time, accepts a `DateTime` or a string\n\n```ruby\nroom.messages_before(DateTime.now, max: 5)\n=\u003e #\u003cCiscoSpark::Collection\u003e\n```\n\n###### `#send_message`\nSend a message to the room\n\n```ruby\nmessage = CiscoSpark::Message.new(text: 'Hello Spark')\n\nroom = CiscoSpark::Room.new(id: 'Y3de...')\nroom.send_message(message)\n=\u003e #\u003cCiscoSpark::Message\u003e\n```\n\n###### `#add_person`\nCreates a new membership to the room for a given person\n\n```ruby\nperson = CiscoSpark::Person.fetch('Y2lz')\n\nroom = CiscoSpark::Room.new(id: 'Y3de...')\nroom.add_person(person)\n=\u003e #\u003cCiscoSpark::Membership\u003e\n```\n\n##### `CiscoSpark::Membership`\n[API reference](https://developer.ciscospark.com/resource-memberships.html)\n\n###### `#person`\nReturns the person for this membership\n\n###### `#room`\nReturns the room this membership belongs to\n\n##### `CiscoSpark::Message`\n[API reference](https://developer.ciscospark.com/resource-messages.html)\n\n###### `#person`\nReturns the person that sent this message\n\n###### `#person_to`\nReturns the person that the message was sent to\n\n##### `CiscoSpark::Team`\n[API reference](https://developer.ciscospark.com/resource-teams.html)\n\n###### `#memberships`\nGet all memberships for team\n\n```ruby\nteam = CiscoSpark::Team.new(id: 'Y3de...')\nteam.memberships(max: 5)\n=\u003e #\u003cCiscoSpark::Collection\u003e\n```\n\n###### `#add_person`\nCreates a new membership to the team for a given person\n\n```ruby\nperson = CiscoSpark::Person.fetch('Y2lz')\n\nteam = CiscoSpark::Team.new(id: 'Y3de...')\nteam.add_person(person)\n=\u003e #\u003cCiscoSpark::TeamMembership\u003e\n```\n\n##### `CiscoSpark::TeamMembership`\n[API reference](https://developer.ciscospark.com/resource-team-memberships.html)\n\n###### `#person`\nReturns the person for this membership\n\n###### `#team`\nReturns the team this membership belongs to\n\n##### `CiscoSpark::Webhook`\n[API reference](https://developer.ciscospark.com/resource-webhooks.html)\n\n### `CiscoSpark::Collection`\nWraps a collection of models. Responds to all enumerable methods e.g. `first`, `map`, `each` etc...\n\nCall `next` on a collection to load the next page of data\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/NGMarmaduke/cisco_spark-ruby.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","funding_links":[],"categories":["Client SDKs"],"sub_categories":["REST API clients"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNGMarmaduke%2Fcisco_spark-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNGMarmaduke%2Fcisco_spark-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNGMarmaduke%2Fcisco_spark-ruby/lists"}