structurely 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 196a4f2942c798f2e222fb529d599855c5dd02b660b982d5fc4d5738f72fb7aa
4
- data.tar.gz: b50c4820cf588dc445b4d73d1189dd857ccee5a318392cc64f9f8bc3f5b67490
3
+ metadata.gz: bbcd0972f2ff457bcd671980b8e51960411f0049713ab913b30d1765322fc7d6
4
+ data.tar.gz: a6e33c4bbf7f4cb2403d0d7b6fc59707116739eee4b9d1334179dbbe873627c0
5
5
  SHA512:
6
- metadata.gz: e96311e58a24d4b36962379a714b04c8ccf8d3eccc23ef9af7fbdda3a19f97d2f9a69066e0d5d07e5aad0e8a89b08caf904ee10dba81543a1a82e3d92b2e07b7
7
- data.tar.gz: 0ec26fe99839f2da9d93d42ec8e4631b6efd7f38709423d3583db27bef35a6cf3f760ed75b34bc6eb849852b2ad9d0e565b062769265fe9feb2340aec669a566
6
+ metadata.gz: 6a060fc89b2dc205eeb07322c121d252ec7e8ae97fdae267bdc13df5173b427a0d4c1a54ef101f6a768c5f895803f51e6f81de64f7fbeeeb27f47bcfcd09c9f6
7
+ data.tar.gz: 96b8e5f5e9e978d0c8c3cab47a6aba85c8fa383208959929000656082aa3688cadbf87aa1d75021f38e293210da9d1d12ff5637cbd60ddaa2b137b760448d305
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: API Change Report
3
+ about: Let us know if an upstream change to the API has occurred that needs to be triaged.
4
+ labels: 'api change :up:'
5
+ ---
6
+
7
+ # [API](https://docs.structurely.com) Change Report
8
+
9
+ > Note: Whether our services are affected by the upstream change or not will greatly affect the speed of resolution. We welcome you to open a PR if you are able to.
10
+
11
+ ## What endpoint has changed
12
+
13
+ - [ ] [Agents](https://docs.structurely.com/#agents)
14
+ - [ ] [Leads](https://docs.structurely.com/#leads)
15
+ - [ ] [Conversations](https://docs.structurely.com/#conversations)
16
+ - [ ] [Conversation Webhooks](https://docs.structurely.com/#conversation-webhooks)
17
+ - [ ] Other
18
+
19
+ ## Change information
20
+
21
+ - [ ] Breaking change
22
+ - [ ] Non-breaking change
23
+ - [ ] A new endpoint has been added
24
+ - [ ] Additional values are being returned by an endpoint
25
+
26
+ >Note: [This is how we define a breaking vs non-breaking change](https://help.projectorpsa.com/display/AD/Breaking+vs+Non-Breaking+Changes)
27
+
28
+ ## Documentation
29
+
30
+ If applicable, link us to an issue/PR on the [official documentation repo](https://github.com/structurely/datalayer-docs):
31
+
32
+ <!-- structurely/datalayer-docs# -->
33
+
34
+ If the change has been documented, please paste the link to the change on the live doc site or commit on their repo.
35
+
36
+ If the change has not been documented, please give us as much information as possible on how to confirm the change for ourselves.
37
+
38
+ Any of these would be very helpful:
39
+
40
+ - cURL command or Postman/Hoppscotch/Paw snippet
41
+ - Raw request output
42
+ - Create a failing test case in our test suite
43
+
44
+ ## Additional context
45
+
46
+ <!-- Let us know if you can open a PR to address this change or add anything else that may be important to know while triaging. -->
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Create a report to help us fix a problem. Do not use this to report API changes.
4
+ labels: 'bug :beetle:'
5
+ ---
6
+
7
+ # Bug Report
8
+
9
+ <!-- Bugs with reproduction cases are more likely to be solved, please include link to the repo here if applicable. -->
10
+
11
+ ## Describe the issue
12
+
13
+ ## Describe how you encountered the issue
14
+
15
+ ## Additional context
16
+
17
+ <!-- Include anything else that may be helpful, like stack traces, error messages, HTTP headers, etc. -->
18
+
19
+ ### Environment
20
+
21
+ - Gem Version: `x.y.z`
22
+ - Ruby Version: `x.y.z`
23
+ - Rails Version: `x.y.z`
24
+ - Rails Environment: `(production|development|test)`
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: Feature Request
3
+ about: Suggest an idea for this project. Do not use this for bugs or API changes.
4
+ labels: 'feature :sparkles:'
5
+ ---
6
+
7
+ # Feature Request
8
+
9
+ ## What are you trying to accomplish?
10
+
11
+ <!-- Example: As a ____, I need ____, in order to ____, because ____. -->
12
+
13
+ ## How are you working around this issue today?
14
+
15
+ <!-- If you are using a work around right now to accomplish your goal, please let us know. -->
16
+
17
+ ## Suggested solution
18
+
19
+ <!--
20
+ A clear and concise description of what you want to happen either in technical terms or not.
21
+ Add any considered drawbacks as well. If you go the extra mile and add the code yourself, we will be very grateful!
22
+ -->
23
+
24
+ ## Teachability, Documentation, Adoption, Migration Strategy
25
+
26
+ <!--
27
+ If you can, explain how users will be able to use this. You could write this out in the same pattern as our
28
+ documentation (please!), include a diagram/screenshot, write psuedocode examples, or anything else that you think will be helpful.
29
+ -->
@@ -0,0 +1,23 @@
1
+ # Type: <!-- Bug Fix|Chore|Feature|Documentation -->
2
+
3
+ ## Checklist
4
+
5
+ - [ ] I've added/updated tests for changes to source code
6
+ - [ ] I've added/updated applicable documentation
7
+ - [ ] Actions are passing
8
+
9
+ ## Description of changes
10
+
11
+ <!--
12
+ Give an overview of what changes you made and why. Your PR will be closed if this is not filled out.
13
+ If this is a bug fix, make sure there is an open and active issue, that you link below.
14
+ -->
15
+
16
+ Fixes: #
17
+
18
+ ## Additional context
19
+
20
+ <!--
21
+ Let us know if you have any questions, suggestion for focus of review, or any other context/information
22
+ that may be useful to a potential reviewer or someone who visits this change in the future.
23
+ -->
data/.gitpod.yml ADDED
@@ -0,0 +1,3 @@
1
+ tasks:
2
+ - init: bin/setup
3
+ command: bin/guard
data/CODE_OF_CONDUCT.md CHANGED
@@ -2,73 +2,126 @@
2
2
 
3
3
  ## Our Pledge
4
4
 
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
11
14
 
12
15
  ## Our Standards
13
16
 
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
16
19
 
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
22
27
 
23
- Examples of unacceptable behavior by participants include:
28
+ Examples of unacceptable behavior include:
24
29
 
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
28
33
  * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
31
36
  * Other conduct which could reasonably be considered inappropriate in a
32
37
  professional setting
33
38
 
34
- ## Our Responsibilities
39
+ ## Enforcement Responsibilities
35
40
 
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
39
45
 
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
45
50
 
46
51
  ## Scope
47
52
 
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
54
58
 
55
59
  ## Enforcement
56
60
 
57
61
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at andrewmcodes@protonmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
62
+ reported to the community leaders responsible for enforcement via GitHub issues.
63
+ All complaints will be reviewed and investigated promptly and fairly.
64
+
65
+ All community leaders are obligated to respect the privacy and security of the
66
+ reporter of any incident.
67
+
68
+ ## Enforcement Guidelines
69
+
70
+ Community leaders will follow these Community Impact Guidelines in determining
71
+ the consequences for any action they deem in violation of this Code of Conduct:
72
+
73
+ ### 1. Correction
74
+
75
+ **Community Impact**: Use of inappropriate language or other behavior deemed
76
+ unprofessional or unwelcome in the community.
77
+
78
+ **Consequence**: A private, written warning from community leaders, providing
79
+ clarity around the nature of the violation and an explanation of why the
80
+ behavior was inappropriate. A public apology may be requested.
81
+
82
+ ### 2. Warning
83
+
84
+ **Community Impact**: A violation through a single incident or series
85
+ of actions.
63
86
 
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
87
+ **Consequence**: A warning with consequences for continued behavior. No
88
+ interaction with the people involved, including unsolicited interaction with
89
+ those enforcing the Code of Conduct, for a specified period of time. This
90
+ includes avoiding interactions in community spaces as well as external channels
91
+ like social media. Violating these terms may lead to a temporary or
92
+ permanent ban.
93
+
94
+ ### 3. Temporary Ban
95
+
96
+ **Community Impact**: A serious violation of community standards, including
97
+ sustained inappropriate behavior.
98
+
99
+ **Consequence**: A temporary ban from any sort of interaction or public
100
+ communication with the community for a specified period of time. No public or
101
+ private interaction with the people involved, including unsolicited interaction
102
+ with those enforcing the Code of Conduct, is allowed during this period.
103
+ Violating these terms may lead to a permanent ban.
104
+
105
+ ### 4. Permanent Ban
106
+
107
+ **Community Impact**: Demonstrating a pattern of violation of community
108
+ standards, including sustained inappropriate behavior, harassment of an
109
+ individual, or aggression toward or disparagement of classes of individuals.
110
+
111
+ **Consequence**: A permanent ban from any sort of public interaction within
112
+ the community.
67
113
 
68
114
  ## Attribution
69
115
 
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
116
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117
+ version 2.0, available at
118
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
119
+
120
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
121
+ enforcement ladder](https://github.com/mozilla/diversity).
122
+
123
+ [homepage]: https://www.contributor-covenant.org
72
124
 
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ https://www.contributor-covenant.org/faq. Translations are available at
127
+ https://www.contributor-covenant.org/translations.
data/Gemfile CHANGED
@@ -7,5 +7,7 @@ group :development, :test do
7
7
  end
8
8
 
9
9
  group :development do
10
+ gem "guard"
11
+ gem "guard-rspec"
10
12
  gem "standard"
11
13
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- structurely (0.1.0)
4
+ structurely (0.1.1)
5
5
  api_struct (~> 1.0)
6
6
  dry-configurable (~> 0.11)
7
7
 
@@ -18,16 +18,15 @@ GEM
18
18
  http
19
19
  ast (2.4.1)
20
20
  coderay (1.1.3)
21
- concurrent-ruby (1.1.7)
21
+ concurrent-ruby (1.1.8)
22
22
  crack (0.4.4)
23
23
  diff-lcs (1.4.4)
24
24
  domain_name (0.5.20190701)
25
25
  unf (>= 0.0.5, < 1.0.0)
26
- dry-configurable (0.11.6)
26
+ dry-configurable (0.12.1)
27
27
  concurrent-ruby (~> 1.0)
28
- dry-core (~> 0.4, >= 0.4.7)
29
- dry-equalizer (~> 0.2)
30
- dry-core (0.4.9)
28
+ dry-core (~> 0.5, >= 0.5.0)
29
+ dry-core (0.5.0)
31
30
  concurrent-ruby (~> 1.0)
32
31
  dry-equalizer (0.3.0)
33
32
  dry-inflector (0.2.0)
@@ -39,6 +38,21 @@ GEM
39
38
  ffi-compiler (1.0.1)
40
39
  ffi (>= 1.0.0)
41
40
  rake
41
+ formatador (0.2.5)
42
+ guard (2.16.2)
43
+ formatador (>= 0.2.4)
44
+ listen (>= 2.7, < 4.0)
45
+ lumberjack (>= 1.0.12, < 2.0)
46
+ nenv (~> 0.1)
47
+ notiffany (~> 0.0)
48
+ pry (>= 0.9.12)
49
+ shellany (~> 0.0)
50
+ thor (>= 0.18.1)
51
+ guard-compat (1.2.1)
52
+ guard-rspec (4.7.3)
53
+ guard (~> 2.1)
54
+ guard-compat (~> 1.1)
55
+ rspec (>= 2.99.0, < 4.0)
42
56
  hashdiff (1.0.1)
43
57
  hashie (4.1.0)
44
58
  http (4.4.1)
@@ -49,9 +63,17 @@ GEM
49
63
  http-cookie (1.0.3)
50
64
  domain_name (~> 0.5)
51
65
  http-form_data (2.3.0)
52
- http-parser (1.2.1)
66
+ http-parser (1.2.3)
53
67
  ffi-compiler (>= 1.0, < 2.0)
68
+ listen (3.2.1)
69
+ rb-fsevent (~> 0.10, >= 0.10.3)
70
+ rb-inotify (~> 0.9, >= 0.9.10)
71
+ lumberjack (1.2.8)
54
72
  method_source (1.0.0)
73
+ nenv (0.3.0)
74
+ notiffany (0.1.3)
75
+ nenv (~> 0.1)
76
+ shellany (~> 0.0)
55
77
  parallel (1.19.2)
56
78
  parser (2.7.2.0)
57
79
  ast (~> 2.4.1)
@@ -61,6 +83,9 @@ GEM
61
83
  public_suffix (4.0.6)
62
84
  rainbow (3.0.0)
63
85
  rake (13.0.1)
86
+ rb-fsevent (0.10.4)
87
+ rb-inotify (0.10.1)
88
+ ffi (~> 1.0)
64
89
  regexp_parser (1.8.2)
65
90
  rexml (3.2.4)
66
91
  rspec (3.9.0)
@@ -91,13 +116,16 @@ GEM
91
116
  rubocop (>= 0.87.0)
92
117
  rubocop-ast (>= 0.4.0)
93
118
  ruby-progressbar (1.10.1)
119
+ shellany (0.0.1)
94
120
  standard (0.7)
95
121
  rubocop (= 0.92)
96
122
  rubocop-performance (= 1.8.1)
123
+ thor (1.0.1)
97
124
  unf (0.1.4)
98
125
  unf_ext
99
126
  unf_ext (0.0.7.7)
100
127
  unicode-display_width (1.7.0)
128
+ vcr (6.0.0)
101
129
  webmock (3.9.3)
102
130
  addressable (>= 2.3.6)
103
131
  crack (>= 0.3.2)
@@ -108,12 +136,15 @@ PLATFORMS
108
136
 
109
137
  DEPENDENCIES
110
138
  bundler (>= 1.5)
139
+ guard
140
+ guard-rspec
111
141
  pry
112
142
  rake
113
143
  rspec (~> 3.0)
114
144
  standard
115
145
  structurely!
146
+ vcr (~> 6.0)
116
147
  webmock (~> 3.9)
117
148
 
118
149
  BUNDLED WITH
119
- 2.1.4
150
+ 2.2.16
data/Guardfile ADDED
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # More info at https://github.com/guard/guard#readme
4
+
5
+ directories %w[lib spec].select { |d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist") }
6
+
7
+ ## Note: if you are using the `directories` clause above and you are not
8
+ ## watching the project directory ('.'), then you will want to move
9
+ ## the Guardfile to a watched dir and symlink it back, e.g.
10
+ #
11
+ # $ mkdir config
12
+ # $ mv Guardfile config/
13
+ # $ ln -s config/Guardfile .
14
+ #
15
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
16
+
17
+ # Note: The cmd option is now required due to the increasing number of ways
18
+ # rspec may be run, below are examples of the most common uses.
19
+ # * bundler: 'bundle exec rspec'
20
+ # * bundler binstubs: 'bin/rspec'
21
+ # * spring: 'bin/rsspec' (This will use spring if running and you have
22
+ # installed the spring binstubs per the docs)
23
+ # * zeus: 'zeus rspec' (requires the server to be started separetly)
24
+ # * 'just' rspec: 'rspec'
25
+ guard :rspec, cmd: "bundle exec rspec", failed_mode: :focus do
26
+ watch(%r{^spec/.+_spec\.rb$})
27
+ watch(%r{^lib/structurely/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
28
+ watch("spec/spec_helper.rb") { "spec" }
29
+ end
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 Andrew Mason
3
+ Copyright (c) 2020 Conor Odell
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,41 +1,308 @@
1
1
  # Structurely
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/structurely.svg)](https://badge.fury.io/rb/structurely)
3
4
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
4
5
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/structurely`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+ ![Tests](https://github.com/magnet-team/structurely/workflows/Tests/badge.svg)
7
+ ![Linters](https://github.com/magnet-team/structurely/workflows/Linters/badge.svg)
6
8
 
7
- TODO: Delete this and the text above, and describe your gem
9
+ Unofficial Structurely Ruby Client
8
10
 
9
- ## Installation
11
+ This gem lets you interface with the Structurely V1 API.
10
12
 
11
- Add this line to your application's Gemfile:
13
+ ## Table of Contents
12
14
 
13
- ```ruby
14
- gem 'structurely'
15
- ```
15
+ - [Install](#install)
16
+ - [Usage](#usage)
17
+ - [API](#api)
18
+ - [Conversations](#conversations)
19
+ - [Get Conversation](#get-conversation)
20
+ - [Create Conversation](#create-conversation)
21
+ - [Conversation Webhooks](#conversation-webhooks)
22
+ - [List Conversation Webhooks](#list-conversation-webhooks)
23
+ - [Create Conversation Webhook](#create-conversation-webhook)
24
+ - [Get Conversation Webhooks](#get-conversation-webhook)
25
+ - [Update Conversation Webhooks](#update-conversation-webhook)
26
+ - [Delete Conversation Webhooks](#delete-conversation-webhook)
27
+ - [Development](#development)
28
+ - [Setup](#setup)
29
+ - [Code Style](#code-style)
30
+ - [Lint](#lint)
31
+ - [Format](#format)
32
+ - [Releasing](#releasing)
33
+ - [Helpful Links](#helpful-links)
34
+ - [Gems](#gems)
35
+ - [Blog Posts](#blog-post)
36
+ - [Code of Conduct](#code-of-conduct)
37
+ - [License](#license)
38
+
39
+ ## Install
16
40
 
17
- And then execute:
41
+ Adding to a gem:
18
42
 
19
- $ bundle
43
+ ```ruby
44
+ # my-cool-gem.gemspec
45
+ Gem::Specification.new do |spec|
46
+ # ...
47
+ spec.add_dependency "structurely", "~> 0.1.0"
48
+ # ...
49
+ end
50
+ ```
20
51
 
21
- Or install it yourself as:
52
+ Or adding to your project:
22
53
 
23
- $ gem install structurely
54
+ ```ruby
55
+ # Gemfile
56
+ gem "structurely", "~> 0.1.0"
57
+ ```
24
58
 
25
59
  ## Usage
26
60
 
27
- ```rb
61
+ The easiest way to use this gem is to create an initializer.
62
+
63
+ ```ruby
64
+ # ./config/structurely.rb
28
65
  Structurely::Settings.configure do |config|
29
66
  config.api_key = 'your_api_key'
30
67
  config.api_endpoint = 'https://api.structurely.com/v1'
31
68
  end
32
69
  ```
33
70
 
71
+ ## API
72
+
73
+ ### Conversations
74
+
75
+ #### Get Conversation
76
+
77
+ [Structurely Get Conversation Documentation](https://docs.structurely.com/#conversations-get-conversation)
78
+
79
+ ```ruby
80
+ Structurely::Conversation.show("12345")
81
+ ```
82
+
83
+ Sample output:
84
+
85
+ ```ruby
86
+ {
87
+ "id" => "12345",
88
+ "muted" => true,
89
+ "settings" =>
90
+ {
91
+ "allowedDomains" => [
92
+ "real_estate"
93
+ ],
94
+ "dripCampaignEnabled" => false,
95
+ "holmesName" => "Aisa",
96
+ "leadTypes" => [
97
+ "buyer",
98
+ "seller"
99
+ ],
100
+ "reDripsEnabled" => false,
101
+ "timeZone" => "America/Chicago"
102
+ },
103
+ "slots" => [
104
+ {"name" => "email", "value" => "jdoe@example.com"},
105
+ {"name" => "name", "value" => "John"},
106
+ {"name" => "agent_name", "value" => "Eric Berry"}
107
+ ],
108
+ "stages" => [
109
+ "responded",
110
+ "interested"
111
+ ]
112
+ }
113
+ ```
114
+
115
+ #### Create Conversation
116
+
117
+ [Structurely Create Conversation Documentation](https://docs.structurely.com/#conversations-create-conversation)
118
+
119
+ ```ruby
120
+ Structurely::Conversation.create(
121
+ muted: false,
122
+ settings: Structurely::Entities::ConversationSettings.new(
123
+ time_zone: "America/Chicago"
124
+ ),
125
+ slots: [
126
+ Structurely::Entities::ConversationSlot.new(
127
+ name: "email",
128
+ value: "jdoe@example.com"
129
+ )
130
+ ],
131
+ messages: [
132
+ Structurely::Entities::ConversationItem.new(
133
+ response: Structurely::Entities::ConversationMessage.new(
134
+ text: "Hello, what is your name?",
135
+ received: "2018-12-08T15:20:00.000Z"
136
+ ),
137
+ context: "expect_name",
138
+ message: Structurely::Entities::ConversationMessage.new(
139
+ text: "John",
140
+ received: "2018-12-08T16:34:00.000Z"
141
+ )
142
+ )
143
+ ]
144
+ )
145
+ ```
146
+
147
+ Sample output:
148
+
149
+ ```ruby
150
+ {
151
+ "id" => "5f90958f9db94200311614a2",
152
+ "muted" => false,
153
+ "settings" => {
154
+ "allowedDomains" => [
155
+ "real_estate"
156
+ ],
157
+ "dripCampaignEnabled" => false,
158
+ "holmesName" => "Aisa",
159
+ "leadTypes" => [
160
+ "buyer", "seller"
161
+ ],
162
+ "reDripsEnabled" => false,
163
+ "timeZone" => "America/Chicago"
164
+ },
165
+ "slots" => [
166
+ {"name" => "email", "value" => "jdoe@example.com"}
167
+ ],
168
+ "stages" => [
169
+ "not_responded"
170
+ ]
171
+ }
172
+ ```
173
+
174
+
175
+ ### Conversation Webhooks
176
+
177
+ #### List Conversation Webhooks
178
+
179
+ [Structurely List Conversation Webhooks Documentation](https://docs.structurely.com/#conversation-webhooks-list-conversation-webhooks)
180
+
181
+ ```ruby
182
+ Structurely::ConversationWebhook.index
183
+ ```
184
+
185
+ Sample output:
186
+
187
+ ```ruby
188
+ {
189
+ "_metadata" => {
190
+ "collection" => "conversationWebhooks",
191
+ "limit" => 10,
192
+ "offset" => 0,
193
+ "total" => 0
194
+ },
195
+ "conversationWebhooks" => []
196
+ }
197
+ ```
198
+
199
+ #### Create Conversation Webhook
200
+
201
+ [Structurely Create Conversation Webhook Documentation](https://docs.structurely.com/#conversation-webhooks-create-conversation-webhook)
202
+
203
+ ```ruby
204
+ Structurely::ConversationWebhook.create(
205
+ name: "conversations",
206
+ target: "https://fp-local.ngrok.io",
207
+ triggers: ["conversation:updated", "response:created"]
208
+ )
209
+ ```
210
+
211
+ Sample output:
212
+
213
+ ```ruby
214
+ {
215
+ "created_at" => "Fri, 30 Jul 2021 20:19:42 GMT",
216
+ "id" => "61045ede0566800108895968",
217
+ "name" => "conversations",
218
+ "secret" => "SECRET",
219
+ "target" => "https://fp-local.ngrok.io",
220
+ "triggers" => ["conversation:updated", "response:created"],
221
+ "updated_at" => "Fri, 30 Jul 2021 20:19:42 GMT",
222
+ "version" => "v1"
223
+ }
224
+ ```
225
+
226
+ #### Get Conversation Webhook
227
+
228
+ [Structurely Get Conversation Webhook Documentation](https://docs.structurely.com/#conversation-webhooks-get-conversation-webhook)
229
+
230
+ ```ruby
231
+ Structurely::ConversationWebhook.show("61045ede0566800108895968")
232
+ ```
233
+
234
+ Sample output:
235
+
236
+ ```ruby
237
+ {
238
+ "created_at" => "Fri, 30 Jul 2021 20:19:42 GMT",
239
+ "id" => "61045ede0566800108895968",
240
+ "name" => "conversations",
241
+ "secret" => "SECRET",
242
+ "target" => "https://fp-local.ngrok.io",
243
+ "triggers" => ["conversation:updated", "response:created"],
244
+ "updated_at" => "Fri, 30 Jul 2021 20:19:42 GMT",
245
+ "version" => "v1"
246
+ }
247
+ ```
248
+
249
+ #### Update Conversation Webhook
250
+
251
+ [Structurely Update Conversation Webhook Documentation](https://docs.structurely.com/#conversation-webhooks-update-conversation-webhook)
252
+
253
+ ```ruby
254
+ Structurely::ConversationWebhook.update("61045ede0566800108895968", {
255
+ name: "my_conversations",
256
+ triggers: ["conversation:updated"]
257
+ })
258
+ ```
259
+
260
+ Sample output:
261
+
262
+ ```ruby
263
+ {
264
+ "created_at" => "Fri, 30 Jul 2021 20:19:42 GMT",
265
+ "id" => "61045ede0566800108895968",
266
+ "name" => "my_conversations",
267
+ "secret" => "ynpKYihXaxBUfc16xHi8Dc7LZL7xYwajlPUnT3kgKCbKy3Ce",
268
+ "target" => "https://fp-local.ngrok.io",
269
+ "triggers" => ["conversation:updated"],
270
+ "updated_at" => "Fri, 30 Jul 2021 20:25:11 GMT",
271
+ "version" => "v1"
272
+ }
273
+ ```
274
+
275
+ #### Delete Conversation Webhook
276
+
277
+ [Structurely Delete Conversation Webhook Documentation](https://docs.structurely.com/#conversation-webhooks-delete-conversation-webhook)
278
+
279
+ ```ruby
280
+ Structurely::ConversationWebhook.delete("61045ede0566800108895968")
281
+ ```
282
+
283
+ Sample output:
284
+
285
+ ```ruby
286
+ Dry::Monads::Result::Success(nil)
287
+ ```
288
+
34
289
  ## Development
35
290
 
291
+ ### Setup
292
+
36
293
  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.
37
294
 
38
- To install this gem onto your local machine, run `bundle exec rake install`. 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](https://rubygems.org).
295
+ To install this gem onto your local machine, run `bundle exec rake install`.
296
+
297
+ ### Guard
298
+
299
+ Guard provides a nice development experience by automatically running tests for you.
300
+
301
+ To start, run the following command in your terminal:
302
+
303
+ ```sh
304
+ bin/guard
305
+ ```
39
306
 
40
307
  ### Code Style
41
308
 
@@ -53,14 +320,28 @@ bin/lint
53
320
  bin/format
54
321
  ```
55
322
 
56
- ## Contributing
323
+ ## Releasing
57
324
 
58
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/structurely. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
325
+ 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](https://rubygems.org).
59
326
 
60
- ## License
327
+ ## Helpful Links
61
328
 
62
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
329
+ Some resources for using [api_structs](https://github.com/rubygarage/api_struct).
330
+
331
+ ### Gems
332
+
333
+ - [uploadcare-ruby-next](https://github.com/uploadcare/uploadcare-ruby-next)
334
+ - [yandex_kassa](https://github.com/sigra/yandex_kassa)
335
+ - [iubenda_api](https://github.com/raihan2006i/iubenda_api)
336
+
337
+ ### Blog Posts
338
+
339
+ - [ApiStruct – A Library for Building API Wrappers in Ruby](https://rubygarage.org/blog/gem-for-api-wrapping)
63
340
 
64
341
  ## Code of Conduct
65
342
 
66
- Everyone interacting in the Structurely project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/structurely/blob/master/CODE_OF_CONDUCT.md).
343
+ Everyone interacting in the Structurely project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/magnet-team/structurely/blob/main/CODE_OF_CONDUCT.md).
344
+
345
+ ## License
346
+
347
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/bin/console CHANGED
@@ -6,9 +6,5 @@ require "structurely"
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
9
+ require "pry"
10
+ Pry.start
data/bin/guard ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'guard' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("guard", "guard")
data/lib/structurely.rb CHANGED
@@ -6,6 +6,7 @@ require "structurely/settings"
6
6
  require "structurely/api_struct_settings"
7
7
 
8
8
  require "structurely/clients/conversations"
9
+ require "structurely/clients/conversation_webhooks"
9
10
 
10
11
  require "structurely/entities/conversation_settings"
11
12
  require "structurely/entities/message_meta_data"
@@ -14,6 +15,7 @@ require "structurely/entities/conversation_item"
14
15
  require "structurely/entities/conversation_slot"
15
16
 
16
17
  require "structurely/conversation"
18
+ require "structurely/conversation_webhook"
17
19
 
18
20
  module Structurely
19
21
  class Error < StandardError; end
@@ -0,0 +1,52 @@
1
+ module Structurely
2
+ module Clients
3
+ class ConversationWebhooks < ApiStruct::Client
4
+ structurely_api :conversation_webhooks
5
+
6
+ # Calls GET /conversationWebooks
7
+ #
8
+ # @example
9
+ # Structurely::Clients::ConversationWebhooks.new.index
10
+ # @see https://docs.structurely.com/#conversation-webhooks-list-conversation-webhooks
11
+ def index
12
+ get(path: "conversationWebhooks")
13
+ end
14
+
15
+ # Calls GET /conversationWebhooks/:id
16
+ #
17
+ # @example
18
+ # Structurely::Clients::ConversationWebhooks.new.show('test-conversation-webhook-id')
19
+ # @see https://docs.structurely.com/#conversation-webhooks-get-conversation-webhook
20
+ def show(id)
21
+ get(id, path: "conversationWebhooks")
22
+ end
23
+
24
+ # Calls POST /conversationWebhooks
25
+ #
26
+ # @example
27
+ # Structurely::Clients::ConversationWebhooks.new.create({ foo: "bar" })
28
+ # @see https://docs.structurely.com/#conversation-webhooks-create-conversation-webhook
29
+ def create(post_data)
30
+ post(json: post_data, path: "conversationWebhooks")
31
+ end
32
+
33
+ # Calls PATCH /conversationWebhooks/:id
34
+ #
35
+ # @example
36
+ # Structurely::Clients::ConversationWebhooks.new.update("abcde", { foo: "bar" })
37
+ # @see https://docs.structurely.com/#conversation-webhooks-update-conversation-webhook
38
+ def update(id, post_data)
39
+ patch(id, json: post_data, path: "conversationWebhooks")
40
+ end
41
+
42
+ # Calls DELETE /conversationWebhooks/:id
43
+ #
44
+ # @example
45
+ # Structurely::Clients::ConversationWebhooks.new.delete("abcde")
46
+ # @see https://docs.structurely.com/#conversation-webhooks-delete-conversation-webhook
47
+ def destroy(id)
48
+ delete(id, path: "conversationWebhooks")
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,8 @@
1
+ module Structurely
2
+ class ConversationWebhook < ApiStruct::Entity
3
+ client_service Structurely::Clients::ConversationWebhooks
4
+
5
+ attr_entity :id, :name, :target, :secret, :version, :created_at, :updated_at
6
+ attr_entity :triggers, &:to_a
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module Structurely
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/structurely.gemspec CHANGED
@@ -5,8 +5,8 @@ require "structurely/version"
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "structurely"
7
7
  spec.version = Structurely::VERSION
8
- spec.authors = ["Andrew Mason"]
9
- spec.email = ["andrewmcodes@protonmail.com"]
8
+ spec.authors = ["Conor Odell", "Andrew Mason"]
9
+ spec.email = ["conorao@gmail.com", "andrewmcodes@protonmail.com"]
10
10
 
11
11
  spec.summary = "Client for accessing Structurely's API"
12
12
  spec.homepage = "https://github.com/magnet-team/structurely"
@@ -35,4 +35,5 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency "rake"
36
36
  spec.add_development_dependency "rspec", "~> 3.0"
37
37
  spec.add_development_dependency "webmock", "~> 3.9"
38
+ spec.add_development_dependency "vcr", "~> 6.0"
38
39
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: structurely
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
+ - Conor Odell
7
8
  - Andrew Mason
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2020-10-20 00:00:00.000000000 Z
12
+ date: 2021-07-30 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: api_struct
@@ -94,8 +95,23 @@ dependencies:
94
95
  - - "~>"
95
96
  - !ruby/object:Gem::Version
96
97
  version: '3.9'
98
+ - !ruby/object:Gem::Dependency
99
+ name: vcr
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '6.0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '6.0'
97
112
  description:
98
113
  email:
114
+ - conorao@gmail.com
99
115
  - andrewmcodes@protonmail.com
100
116
  executables:
101
117
  - structurely
@@ -103,9 +119,14 @@ extensions: []
103
119
  extra_rdoc_files: []
104
120
  files:
105
121
  - ".env.example"
122
+ - ".github/ISSUE_TEMPLATE/api_changes_report.md"
123
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
124
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
125
+ - ".github/PULL_REQUEST_TEMPLATE.md"
106
126
  - ".github/workflows/linters.yml"
107
127
  - ".github/workflows/tests.yml"
108
128
  - ".gitignore"
129
+ - ".gitpod.yml"
109
130
  - ".rspec"
110
131
  - ".ruby-version"
111
132
  - ".standard.yml"
@@ -113,11 +134,13 @@ files:
113
134
  - CODE_OF_CONDUCT.md
114
135
  - Gemfile
115
136
  - Gemfile.lock
137
+ - Guardfile
116
138
  - LICENSE.txt
117
139
  - README.md
118
140
  - Rakefile
119
141
  - bin/console
120
142
  - bin/format
143
+ - bin/guard
121
144
  - bin/lint
122
145
  - bin/rspec
123
146
  - bin/setup
@@ -125,8 +148,10 @@ files:
125
148
  - exe/structurely
126
149
  - lib/structurely.rb
127
150
  - lib/structurely/api_struct_settings.rb
151
+ - lib/structurely/clients/conversation_webhooks.rb
128
152
  - lib/structurely/clients/conversations.rb
129
153
  - lib/structurely/conversation.rb
154
+ - lib/structurely/conversation_webhook.rb
130
155
  - lib/structurely/entities/conversation_item.rb
131
156
  - lib/structurely/entities/conversation_message.rb
132
157
  - lib/structurely/entities/conversation_settings.rb