Giter Site home page Giter Site logo

structurely's Introduction

Structurely

Gem Version Ruby Style Guide

Tests Linters

Unofficial Structurely Ruby Client

This gem lets you interface with the Structurely V1 API.

Table of Contents

Install

Adding to a gem:

# my-cool-gem.gemspec
Gem::Specification.new do |spec|
  # ...
  spec.add_dependency "structurely", "~> 0.1.0"
  # ...
end

Or adding to your project:

# Gemfile
gem "structurely", "~> 0.1.0"

Usage

The easiest way to use this gem is to create an initializer.

# ./config/structurely.rb
Structurely::Settings.configure do |config|
  config.api_key = 'your_api_key'
  config.api_endpoint = 'https://api.structurely.com/v1'
end

API

Conversations

Get Conversation

Structurely Get Conversation Documentation

Structurely::Conversation.show("12345")

Sample output:

{
  "id" => "12345",
  "muted" => true,
  "settings" =>
  {
    "allowedDomains" => [
      "real_estate"
    ],
    "dripCampaignEnabled" => false,
    "holmesName" => "Aisa",
    "leadTypes" => [
      "buyer",
      "seller"
    ],
    "reDripsEnabled" => false,
    "timeZone" => "America/Chicago"
  },
  "slots" => [
    {"name" => "email", "value" => "[email protected]"},
    {"name" => "name", "value" => "John"},
    {"name" => "agent_name", "value" => "Eric Berry"}
  ],
  "stages" => [
    "responded",
    "interested"
  ]
}

Create Conversation

Structurely Create Conversation Documentation

Structurely::Conversation.create(
  muted: false,
  settings: Structurely::Entities::ConversationSettings.new(
    time_zone: "America/Chicago"
  ),
  slots: [
    Structurely::Entities::ConversationSlot.new(
      name: "email",
      value: "[email protected]"
    )
  ],
  messages: [
    Structurely::Entities::ConversationItem.new(
      response: Structurely::Entities::ConversationMessage.new(
        text: "Hello, what is your name?",
        received: "2018-12-08T15:20:00.000Z"
      ),
      context: "expect_name",
      message: Structurely::Entities::ConversationMessage.new(
        text: "John",
        received: "2018-12-08T16:34:00.000Z"
      )
    )
  ]
)

Sample output:

{
  "id" => "5f90958f9db94200311614a2",
  "muted" => false,
  "settings" => {
    "allowedDomains" => [
      "real_estate"
    ],
    "dripCampaignEnabled" => false,
    "holmesName" => "Aisa",
    "leadTypes" => [
      "buyer", "seller"
    ],
    "reDripsEnabled" => false,
    "timeZone" => "America/Chicago"
  },
  "slots" => [
    {"name" => "email", "value" => "[email protected]"}
  ],
  "stages" => [
    "not_responded"
  ]
}

Conversation Webhooks

List Conversation Webhooks

Structurely List Conversation Webhooks Documentation

Structurely::ConversationWebhook.index

Sample output:

{
  "_metadata" => {
      "collection" => "conversationWebhooks",
      "limit" => 10,
      "offset" => 0,
      "total" => 0
  },
  "conversationWebhooks" => []
}

Create Conversation Webhook

Structurely Create Conversation Webhook Documentation

Structurely::ConversationWebhook.create(
  name: "conversations",
  target: "https://fp-local.ngrok.io",
  triggers: ["conversation:updated", "response:created"]
)

Sample output:

{
  "created_at" => "Fri, 30 Jul 2021 20:19:42 GMT",
  "id" => "61045ede0566800108895968",
  "name" => "conversations",
  "secret" => "SECRET",
  "target" => "https://fp-local.ngrok.io",
  "triggers" => ["conversation:updated", "response:created"],
  "updated_at" => "Fri, 30 Jul 2021 20:19:42 GMT",
  "version" => "v1"
}

Get Conversation Webhook

Structurely Get Conversation Webhook Documentation

Structurely::ConversationWebhook.show("61045ede0566800108895968")

Sample output:

{
  "created_at" => "Fri, 30 Jul 2021 20:19:42 GMT",
  "id" => "61045ede0566800108895968",
  "name" => "conversations",
  "secret" => "SECRET",
  "target" => "https://fp-local.ngrok.io",
  "triggers" => ["conversation:updated", "response:created"],
  "updated_at" => "Fri, 30 Jul 2021 20:19:42 GMT",
  "version" => "v1"
}

Update Conversation Webhook

Structurely Update Conversation Webhook Documentation

Structurely::ConversationWebhook.update("61045ede0566800108895968", {
  name: "my_conversations",
  triggers: ["conversation:updated"]
})

Sample output:

{
  "created_at" => "Fri, 30 Jul 2021 20:19:42 GMT",
  "id" => "61045ede0566800108895968",
  "name" => "my_conversations",
  "secret" => "ynpKYihXaxBUfc16xHi8Dc7LZL7xYwajlPUnT3kgKCbKy3Ce",
  "target" => "https://fp-local.ngrok.io",
  "triggers" => ["conversation:updated"],
  "updated_at" => "Fri, 30 Jul 2021 20:25:11 GMT",
  "version" => "v1"
}

Delete Conversation Webhook

Structurely Delete Conversation Webhook Documentation

Structurely::ConversationWebhook.delete("61045ede0566800108895968")

Sample output:

Dry::Monads::Result::Success(nil)

Development

Setup

After 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.

To install this gem onto your local machine, run bundle exec rake install.

Guard

Guard provides a nice development experience by automatically running tests for you.

To start, run the following command in your terminal:

bin/guard

Code Style

Ruby linting and formatting is handled via standard.

Lint

bin/lint

Format

bin/format

Releasing

To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Helpful Links

Some resources for using api_structs.

Gems

Blog Posts

Code of Conduct

Everyone interacting in the Structurely project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

structurely's People

Contributors

andrewmcodes avatar coderberry avatar

Watchers

Martin Streicher avatar James Cloos avatar Conor Odell avatar Mark Stepp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.