structurely 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.env.example +2 -0
- data/.github/workflows/linters.yml +34 -0
- data/.github/workflows/tests.yml +34 -0
- data/.gitignore +15 -0
- data/.rspec +4 -0
- data/.ruby-version +1 -0
- data/.standard.yml +4 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +119 -0
- data/LICENSE.txt +21 -0
- data/README.md +66 -0
- data/Rakefile +7 -0
- data/bin/console +14 -0
- data/bin/format +3 -0
- data/bin/lint +3 -0
- data/bin/rspec +29 -0
- data/bin/setup +10 -0
- data/bin/standardrb +29 -0
- data/exe/structurely +3 -0
- data/lib/structurely.rb +20 -0
- data/lib/structurely/api_struct_settings.rb +11 -0
- data/lib/structurely/clients/conversations.rb +25 -0
- data/lib/structurely/conversation.rb +12 -0
- data/lib/structurely/entities/conversation_item.rb +10 -0
- data/lib/structurely/entities/conversation_message.rb +9 -0
- data/lib/structurely/entities/conversation_settings.rb +9 -0
- data/lib/structurely/entities/conversation_slot.rb +7 -0
- data/lib/structurely/entities/message_meta_data.rb +7 -0
- data/lib/structurely/settings.rb +8 -0
- data/lib/structurely/version.rb +3 -0
- data/structurely.gemspec +38 -0
- metadata +163 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 196a4f2942c798f2e222fb529d599855c5dd02b660b982d5fc4d5738f72fb7aa
|
4
|
+
data.tar.gz: b50c4820cf588dc445b4d73d1189dd857ccee5a318392cc64f9f8bc3f5b67490
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e96311e58a24d4b36962379a714b04c8ccf8d3eccc23ef9af7fbdda3a19f97d2f9a69066e0d5d07e5aad0e8a89b08caf904ee10dba81543a1a82e3d92b2e07b7
|
7
|
+
data.tar.gz: 0ec26fe99839f2da9d93d42ec8e4631b6efd7f38709423d3583db27bef35a6cf3f760ed75b34bc6eb849852b2ad9d0e565b062769265fe9feb2340aec669a566
|
data/.env.example
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
name: Linters
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches:
|
6
|
+
- "*"
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- main
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
standardrb:
|
13
|
+
name: StandardRB Linter
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- name: Set up Ruby 2.6
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: 2.6.6
|
22
|
+
- name: Cache gems
|
23
|
+
uses: actions/cache@v2
|
24
|
+
with:
|
25
|
+
path: vendor/bundle
|
26
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
27
|
+
restore-keys: |
|
28
|
+
${{ runner.os }}-gems-
|
29
|
+
- name: Install gems
|
30
|
+
run: |
|
31
|
+
bundle config path vendor/bundle
|
32
|
+
bundle install --jobs 4 --retry 3
|
33
|
+
- name: Lint
|
34
|
+
run: bin/lint
|
@@ -0,0 +1,34 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches:
|
6
|
+
- "*"
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- main
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
tests:
|
13
|
+
name: Rspec Tests
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- name: Set up Ruby 2.6
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: 2.6.6
|
22
|
+
- name: Cache gems
|
23
|
+
uses: actions/cache@v2
|
24
|
+
with:
|
25
|
+
path: vendor/bundle
|
26
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
27
|
+
restore-keys: |
|
28
|
+
${{ runner.os }}-gems-
|
29
|
+
- name: Install gems
|
30
|
+
run: |
|
31
|
+
bundle config path vendor/bundle
|
32
|
+
bundle install --jobs 4 --retry 3
|
33
|
+
- name: Run Rspec
|
34
|
+
run: bin/rspec
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.6
|
data/.standard.yml
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
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.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
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
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
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
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
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.
|
39
|
+
|
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.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
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.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
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.
|
63
|
+
|
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.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
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]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
structurely (0.1.0)
|
5
|
+
api_struct (~> 1.0)
|
6
|
+
dry-configurable (~> 0.11)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.7.0)
|
12
|
+
public_suffix (>= 2.0.2, < 5.0)
|
13
|
+
api_struct (1.0.5)
|
14
|
+
dry-configurable
|
15
|
+
dry-inflector
|
16
|
+
dry-monads (~> 1)
|
17
|
+
hashie
|
18
|
+
http
|
19
|
+
ast (2.4.1)
|
20
|
+
coderay (1.1.3)
|
21
|
+
concurrent-ruby (1.1.7)
|
22
|
+
crack (0.4.4)
|
23
|
+
diff-lcs (1.4.4)
|
24
|
+
domain_name (0.5.20190701)
|
25
|
+
unf (>= 0.0.5, < 1.0.0)
|
26
|
+
dry-configurable (0.11.6)
|
27
|
+
concurrent-ruby (~> 1.0)
|
28
|
+
dry-core (~> 0.4, >= 0.4.7)
|
29
|
+
dry-equalizer (~> 0.2)
|
30
|
+
dry-core (0.4.9)
|
31
|
+
concurrent-ruby (~> 1.0)
|
32
|
+
dry-equalizer (0.3.0)
|
33
|
+
dry-inflector (0.2.0)
|
34
|
+
dry-monads (1.3.5)
|
35
|
+
concurrent-ruby (~> 1.0)
|
36
|
+
dry-core (~> 0.4, >= 0.4.4)
|
37
|
+
dry-equalizer
|
38
|
+
ffi (1.13.1)
|
39
|
+
ffi-compiler (1.0.1)
|
40
|
+
ffi (>= 1.0.0)
|
41
|
+
rake
|
42
|
+
hashdiff (1.0.1)
|
43
|
+
hashie (4.1.0)
|
44
|
+
http (4.4.1)
|
45
|
+
addressable (~> 2.3)
|
46
|
+
http-cookie (~> 1.0)
|
47
|
+
http-form_data (~> 2.2)
|
48
|
+
http-parser (~> 1.2.0)
|
49
|
+
http-cookie (1.0.3)
|
50
|
+
domain_name (~> 0.5)
|
51
|
+
http-form_data (2.3.0)
|
52
|
+
http-parser (1.2.1)
|
53
|
+
ffi-compiler (>= 1.0, < 2.0)
|
54
|
+
method_source (1.0.0)
|
55
|
+
parallel (1.19.2)
|
56
|
+
parser (2.7.2.0)
|
57
|
+
ast (~> 2.4.1)
|
58
|
+
pry (0.13.1)
|
59
|
+
coderay (~> 1.1)
|
60
|
+
method_source (~> 1.0)
|
61
|
+
public_suffix (4.0.6)
|
62
|
+
rainbow (3.0.0)
|
63
|
+
rake (13.0.1)
|
64
|
+
regexp_parser (1.8.2)
|
65
|
+
rexml (3.2.4)
|
66
|
+
rspec (3.9.0)
|
67
|
+
rspec-core (~> 3.9.0)
|
68
|
+
rspec-expectations (~> 3.9.0)
|
69
|
+
rspec-mocks (~> 3.9.0)
|
70
|
+
rspec-core (3.9.3)
|
71
|
+
rspec-support (~> 3.9.3)
|
72
|
+
rspec-expectations (3.9.2)
|
73
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
74
|
+
rspec-support (~> 3.9.0)
|
75
|
+
rspec-mocks (3.9.1)
|
76
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
77
|
+
rspec-support (~> 3.9.0)
|
78
|
+
rspec-support (3.9.3)
|
79
|
+
rubocop (0.92.0)
|
80
|
+
parallel (~> 1.10)
|
81
|
+
parser (>= 2.7.1.5)
|
82
|
+
rainbow (>= 2.2.2, < 4.0)
|
83
|
+
regexp_parser (>= 1.7)
|
84
|
+
rexml
|
85
|
+
rubocop-ast (>= 0.5.0)
|
86
|
+
ruby-progressbar (~> 1.7)
|
87
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
88
|
+
rubocop-ast (0.8.0)
|
89
|
+
parser (>= 2.7.1.5)
|
90
|
+
rubocop-performance (1.8.1)
|
91
|
+
rubocop (>= 0.87.0)
|
92
|
+
rubocop-ast (>= 0.4.0)
|
93
|
+
ruby-progressbar (1.10.1)
|
94
|
+
standard (0.7)
|
95
|
+
rubocop (= 0.92)
|
96
|
+
rubocop-performance (= 1.8.1)
|
97
|
+
unf (0.1.4)
|
98
|
+
unf_ext
|
99
|
+
unf_ext (0.0.7.7)
|
100
|
+
unicode-display_width (1.7.0)
|
101
|
+
webmock (3.9.3)
|
102
|
+
addressable (>= 2.3.6)
|
103
|
+
crack (>= 0.3.2)
|
104
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
105
|
+
|
106
|
+
PLATFORMS
|
107
|
+
ruby
|
108
|
+
|
109
|
+
DEPENDENCIES
|
110
|
+
bundler (>= 1.5)
|
111
|
+
pry
|
112
|
+
rake
|
113
|
+
rspec (~> 3.0)
|
114
|
+
standard
|
115
|
+
structurely!
|
116
|
+
webmock (~> 3.9)
|
117
|
+
|
118
|
+
BUNDLED WITH
|
119
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Andrew Mason
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# Structurely
|
2
|
+
|
3
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
|
4
|
+
|
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
|
+
|
7
|
+
TODO: Delete this and the text above, and describe your gem
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'structurely'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install structurely
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
```rb
|
28
|
+
Structurely::Settings.configure do |config|
|
29
|
+
config.api_key = 'your_api_key'
|
30
|
+
config.api_endpoint = 'https://api.structurely.com/v1'
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
## Development
|
35
|
+
|
36
|
+
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
|
+
|
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).
|
39
|
+
|
40
|
+
### Code Style
|
41
|
+
|
42
|
+
Ruby linting and formatting is handled via [standard](https://github.com/testdouble/standard).
|
43
|
+
|
44
|
+
#### Lint
|
45
|
+
|
46
|
+
```sh
|
47
|
+
bin/lint
|
48
|
+
```
|
49
|
+
|
50
|
+
#### Format
|
51
|
+
|
52
|
+
```sh
|
53
|
+
bin/format
|
54
|
+
```
|
55
|
+
|
56
|
+
## Contributing
|
57
|
+
|
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.
|
59
|
+
|
60
|
+
## License
|
61
|
+
|
62
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
63
|
+
|
64
|
+
## Code of Conduct
|
65
|
+
|
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).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "structurely"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
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__)
|
data/bin/format
ADDED
data/bin/lint
ADDED
data/bin/rspec
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 'rspec' 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("rspec-core", "rspec")
|
data/bin/setup
ADDED
data/bin/standardrb
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 'standardrb' 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("standard", "standardrb")
|
data/exe/structurely
ADDED
data/lib/structurely.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require "structurely/version"
|
2
|
+
require "api_struct"
|
3
|
+
require "dry-configurable"
|
4
|
+
|
5
|
+
require "structurely/settings"
|
6
|
+
require "structurely/api_struct_settings"
|
7
|
+
|
8
|
+
require "structurely/clients/conversations"
|
9
|
+
|
10
|
+
require "structurely/entities/conversation_settings"
|
11
|
+
require "structurely/entities/message_meta_data"
|
12
|
+
require "structurely/entities/conversation_message"
|
13
|
+
require "structurely/entities/conversation_item"
|
14
|
+
require "structurely/entities/conversation_slot"
|
15
|
+
|
16
|
+
require "structurely/conversation"
|
17
|
+
|
18
|
+
module Structurely
|
19
|
+
class Error < StandardError; end
|
20
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
ApiStruct::Settings.configure do |config|
|
2
|
+
config.endpoints = {
|
3
|
+
structurely_api: {
|
4
|
+
root: Structurely::Settings.config.api_endpoint,
|
5
|
+
headers: {
|
6
|
+
"Content-Type": "application/json",
|
7
|
+
"X-Api-Authorization": Structurely::Settings.config.api_key
|
8
|
+
}
|
9
|
+
}
|
10
|
+
}
|
11
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Structurely
|
2
|
+
module Clients
|
3
|
+
class Conversations < ApiStruct::Client
|
4
|
+
structurely_api :conversations
|
5
|
+
|
6
|
+
# Calls GET /conversations/:id
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# Structurely::Clients::Conversations.new.show('test-conversation-id')
|
10
|
+
# @see https://docs.structurely.com/#conversations-get-conversation
|
11
|
+
def show(id)
|
12
|
+
get(id)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Calls POST /conversations
|
16
|
+
#
|
17
|
+
# @example
|
18
|
+
# Structurely::Clients::Conversations.new.create(**options)
|
19
|
+
# @see https://docs.structurely.com/#conversations-create-conversation
|
20
|
+
def create(options)
|
21
|
+
post(json: options)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Structurely
|
2
|
+
class Conversation < ApiStruct::Entity
|
3
|
+
client_service Structurely::Clients::Conversations
|
4
|
+
|
5
|
+
attr_entity :muted, :id
|
6
|
+
attr_entity :stages, &:to_a
|
7
|
+
|
8
|
+
has_entity :settings, as: Structurely::Entities::ConversationSettings
|
9
|
+
has_entities :slots, as: Structurely::Entities::ConversationSlot
|
10
|
+
has_entities :messages, as: Structurely::Entities::ConversationItem
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Structurely
|
2
|
+
module Entities
|
3
|
+
class ConversationItem < ApiStruct::Entity
|
4
|
+
attr_entity :context
|
5
|
+
|
6
|
+
has_entity :message, as: Structurely::Entities::ConversationMessage
|
7
|
+
has_entity :response, as: Structurely::Entities::ConversationMessage
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/structurely.gemspec
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "structurely/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "structurely"
|
7
|
+
spec.version = Structurely::VERSION
|
8
|
+
spec.authors = ["Andrew Mason"]
|
9
|
+
spec.email = ["andrewmcodes@protonmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Client for accessing Structurely's API"
|
12
|
+
spec.homepage = "https://github.com/magnet-team/structurely"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
if spec.respond_to?(:metadata)
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
18
|
+
else
|
19
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
20
|
+
"public gem pushes."
|
21
|
+
end
|
22
|
+
|
23
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
spec.add_dependency "api_struct", "~> 1.0"
|
32
|
+
spec.add_dependency "dry-configurable", "~> 0.11"
|
33
|
+
|
34
|
+
spec.add_development_dependency "bundler", ">= 1.5"
|
35
|
+
spec.add_development_dependency "rake"
|
36
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
37
|
+
spec.add_development_dependency "webmock", "~> 3.9"
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: structurely
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Mason
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-10-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: api_struct
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dry-configurable
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.11'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.11'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.9'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.9'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
- andrewmcodes@protonmail.com
|
100
|
+
executables:
|
101
|
+
- structurely
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".env.example"
|
106
|
+
- ".github/workflows/linters.yml"
|
107
|
+
- ".github/workflows/tests.yml"
|
108
|
+
- ".gitignore"
|
109
|
+
- ".rspec"
|
110
|
+
- ".ruby-version"
|
111
|
+
- ".standard.yml"
|
112
|
+
- ".travis.yml"
|
113
|
+
- CODE_OF_CONDUCT.md
|
114
|
+
- Gemfile
|
115
|
+
- Gemfile.lock
|
116
|
+
- LICENSE.txt
|
117
|
+
- README.md
|
118
|
+
- Rakefile
|
119
|
+
- bin/console
|
120
|
+
- bin/format
|
121
|
+
- bin/lint
|
122
|
+
- bin/rspec
|
123
|
+
- bin/setup
|
124
|
+
- bin/standardrb
|
125
|
+
- exe/structurely
|
126
|
+
- lib/structurely.rb
|
127
|
+
- lib/structurely/api_struct_settings.rb
|
128
|
+
- lib/structurely/clients/conversations.rb
|
129
|
+
- lib/structurely/conversation.rb
|
130
|
+
- lib/structurely/entities/conversation_item.rb
|
131
|
+
- lib/structurely/entities/conversation_message.rb
|
132
|
+
- lib/structurely/entities/conversation_settings.rb
|
133
|
+
- lib/structurely/entities/conversation_slot.rb
|
134
|
+
- lib/structurely/entities/message_meta_data.rb
|
135
|
+
- lib/structurely/settings.rb
|
136
|
+
- lib/structurely/version.rb
|
137
|
+
- structurely.gemspec
|
138
|
+
homepage: https://github.com/magnet-team/structurely
|
139
|
+
licenses:
|
140
|
+
- MIT
|
141
|
+
metadata:
|
142
|
+
homepage_uri: https://github.com/magnet-team/structurely
|
143
|
+
source_code_uri: https://github.com/magnet-team/structurely
|
144
|
+
post_install_message:
|
145
|
+
rdoc_options: []
|
146
|
+
require_paths:
|
147
|
+
- lib
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
requirements: []
|
159
|
+
rubygems_version: 3.0.3
|
160
|
+
signing_key:
|
161
|
+
specification_version: 4
|
162
|
+
summary: Client for accessing Structurely's API
|
163
|
+
test_files: []
|