{"id":21726529,"url":"https://github.com/dragonbox/freshsales","last_synced_at":"2025-08-15T23:09:17.560Z","repository":{"id":48768931,"uuid":"128530951","full_name":"DragonBox/freshsales","owner":"DragonBox","description":"A wrapper for Freshsales API","archived":false,"fork":false,"pushed_at":"2024-08-01T23:26:51.000Z","size":64,"stargazers_count":5,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-27T18:43:36.162Z","etag":null,"topics":["crm-sdk","freshsales","gem","ruby"],"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/DragonBox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2018-04-07T13:28:41.000Z","updated_at":"2023-10-20T10:43:27.000Z","dependencies_parsed_at":"2024-11-26T04:45:20.556Z","dependency_job_id":null,"html_url":"https://github.com/DragonBox/freshsales","commit_stats":{"total_commits":58,"total_committers":2,"mean_commits":29.0,"dds":"0.017241379310344862","last_synced_commit":"0b159a0a534028349b1fc0beb15a25e345e6e77b"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/DragonBox/freshsales","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DragonBox%2Ffreshsales","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DragonBox%2Ffreshsales/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DragonBox%2Ffreshsales/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DragonBox%2Ffreshsales/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DragonBox","download_url":"https://codeload.github.com/DragonBox/freshsales/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DragonBox%2Ffreshsales/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270644755,"owners_count":24621332,"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-15T02:00:12.559Z","response_time":110,"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":["crm-sdk","freshsales","gem","ruby"],"created_at":"2024-11-26T03:36:36.798Z","updated_at":"2025-08-15T23:09:17.541Z","avatar_url":"https://github.com/DragonBox.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Freshsales\n\n[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/DragonBox/freshsales/blob/master/LICENSE)\n[![Gem](https://img.shields.io/gem/v/freshsales.svg?style=flat)](https://rubygems.org/gems/freshsales)\n[![Build Status](https://img.shields.io/circleci/project/DragonBox/freshsales/master.svg?style=flat)](https://circleci.com/gh/DragonBox/freshsales)\n[![Coverage Status](https://coveralls.io/repos/github/DragonBox/freshsales/badge.svg?branch=master)](https://coveralls.io/github/DragonBox/freshsales?branch=master)\n\nFreshsales is a ruby wrapper around [Freshsales API](https://www.freshsales.io/api/)\n\n---\n\n## Installation\n\n```shell\ngem install freshsales\n```\n\n### Requirements\n\nA Freshsales account and an API key. You can set your API key here.\n\nhttps://yourdomain.freshsales.io/personal-settings/api-settings\n\n## Getting started\n\n```ruby\n# given https://yourdomain.freshsales.io/ and your API key\nfreshsales = Freshsales::API.new(freshsales_domain: \"yourdomain\", freshsales_apikey: \"...\")\n```\n\n### Design philosophy\n\nFreshsales expose resources using a RESTful API allowing to [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) those resources. It also provides extra features such as search.\n\nInspired by [gibbon](https://github.com/amro/gibbon), this library provides a simple dynamic language to construct the URLs required to query those resources.\n\nE.g. `freshsales.leads.post(body: requestbody)` would represent a `POST /api/leads/` request and return a `Freshsale::Response` instance.\n\nThe json data (`requestbody`) can be passed as string or Hashes.\n\nThe received json data can be obtained as raw or Hashes (with symbolized keys or not).\n\n## Examples\n\n### Create / Read / Update / Search / Delete resources\n\n```ruby\nemail = \"sample@sample.com\"\n\nlead_data = %({\"lead\":{\"last_name\":\"Sampleton (sample)\", \"email\": \"#{email}\"}})\n\n# Create lead\nresult = freshsales.leads.post(body: lead_data)\nlead_id = result.body['lead']['id']\n\nupdated_lead_data = %({\"lead\":{\"mobile_number\":\"1-926-555-9999\", \"email\": \"#{email}\"}})\n\n# Read the lead\nfreshsales.leads(lead_id).get.body\n\n# Update the lead\nfreshsales.leads(lead_id).put(body: updated_lead_data).body\n\n# Search the lead by email\nsample = freshsales.search.get(params: {include: \"lead\", q: email}).body.first\n\n# Delete it\nfreshsales.leads(lead_id).delete\n```\n\n### Finding a particular view\n\n```ruby\nfilters = freshsales.contacts.filters.get\n\nview_id = filters.body['filters'].select{|f| \"All Contacts\" == f['name'] }.first['id']\n```\n\n### Paginated resources\n\nSome resources are paginated and controlled by the `per_page` and `page` parameters.\n\nWhile you can return individual pages like this:\n```ruby\nfreshsales.contacts.view(view_id).get(params: {\"per_page\": 100, \"page\": 2}).body\n```\n\nthe library also allows to iterate over all pages either one element at a time or one page at a time, lazily making the requests for the different pages when required by the client.\n\n```ruby\nfreshsales.contacts.view(view_id).get_all.each do |contact|\n  # do something with this contact, which may come from any page\nend\n\npage_params = { \"per_page\": 100, \"sort\": \"id\", \"sort_type\": \"asc\", \"include\": \"owner,creater,source\"}\nfreshsales.contacts.view(view_id).get_all_pages(params: page_params).each do |contact_page|\n  # do something with this page's data which may contain up to 100 contacts and\n  # their associated owner, creater and source data\nend\n```\n\n`get_all` and `get_all_pages` return a `Freshsale::Cursor` whose `each` method returns a ruby `Enumerator` when no block is given.\n\n**tip** Enumerators in ruby can be used as [Enumerable](https://ruby-doc.org/core/Enumerable.html). This allows you to apply collection operations on them, even chain them, to transform or filter the returned data.\n\nE.g. if you wanted to restrict the number of elements/pages you could do `get_all[_pages].each.take(100)[.each]`.\n\n### Troubleshoot\n\nEnable the `debug` option (`Freshsales::API.new(debug: true)`)\n\n### WIP / first public release\n\nThe library is a work in progress. There will be a couple of API changes before the first public version is officially rolled out. Check [the issues targeted for the 0.1.0 milestone](https://github.com/DragonBox/freshsales/issues?q=is%3Aopen+is%3Aissue+milestone%3A0.1.0)\n\n### Solve SSL Errors\n\nIf you face an issue similar to this one\n\n```shell\nSSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed\n```\nyour ruby setup to work with OpenSSL probably needs to be fixed.\n\n * __On MacOS:__\n\nYour version of OpenSSL may be be outdated, make sure you are using the last one.\n\n * __On Windows:__\n\nA fix to the issue stated above has been found on [StackOverflow](http://stackoverflow.com/questions/5720484/how-to-solve-certificate-verify-failed-on-windows). If you follow the steps described in this topic, you will most likely get rid of this issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdragonbox%2Ffreshsales","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdragonbox%2Ffreshsales","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdragonbox%2Ffreshsales/lists"}