novu 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0fc42d2af18f6aaf2fec816e562d11e87564ed50b2c553536c6a04acbf91fc57
4
+ data.tar.gz: efac155226cf82453269bf17f5a01ecbe202914eb4291329d044df7f4d3f6133
5
+ SHA512:
6
+ metadata.gz: 3d97dbeb4725243fb3437208fcb825ea8fd5dcc927bbfc5b11a02dfb0f4eeb054f69a8018da3f1aba39538db92fdc450ccc65c2375ca76c3ed453a428e04fe10
7
+ data.tar.gz: c1a0e10ac3c364ade53a4d93e33e9046a37b6a9244e9d35a85f502c6df4c3c47d22e80a79c70a8625c6805ce0c3f62a98f761789a221ab4cdd1a90bacf54ee89
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-02-28
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at aman.saini@cogoport.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in novu.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ group :test do
11
+ gem 'rspec'
12
+ gem "webmock"
13
+ end
14
+
15
+ gem "rubocop", "~> 1.21"
16
+
17
+ gem 'pry-debugger-jruby'
data/Gemfile.lock ADDED
@@ -0,0 +1,102 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ novu (0.1.0)
5
+ activesupport
6
+ httparty
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (6.1.7.2)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (>= 1.6, < 2)
14
+ minitest (>= 5.1)
15
+ tzinfo (~> 2.0)
16
+ zeitwerk (~> 2.3)
17
+ addressable (2.8.1)
18
+ public_suffix (>= 2.0.2, < 6.0)
19
+ ast (2.4.2)
20
+ coderay (1.1.3)
21
+ concurrent-ruby (1.2.2)
22
+ crack (0.4.5)
23
+ rexml
24
+ diff-lcs (1.5.0)
25
+ ffi (1.15.5-java)
26
+ hashdiff (1.0.1)
27
+ httparty (0.21.0)
28
+ mini_mime (>= 1.0.0)
29
+ multi_xml (>= 0.5.2)
30
+ i18n (1.12.0)
31
+ concurrent-ruby (~> 1.0)
32
+ json (2.6.3-java)
33
+ method_source (1.0.0)
34
+ mini_mime (1.1.2)
35
+ minitest (5.17.0)
36
+ multi_xml (0.6.0)
37
+ parallel (1.22.1)
38
+ parser (3.2.1.0)
39
+ ast (~> 2.4.1)
40
+ pry (0.14.2-java)
41
+ coderay (~> 1.1)
42
+ method_source (~> 1.0)
43
+ spoon (~> 0.0)
44
+ pry-debugger-jruby (2.1.1-java)
45
+ pry (>= 0.13, < 0.15)
46
+ ruby-debug-base (>= 0.10.4, < 0.12)
47
+ public_suffix (5.0.1)
48
+ rainbow (3.1.1)
49
+ rake (13.0.6)
50
+ regexp_parser (2.7.0)
51
+ rexml (3.2.5)
52
+ rspec (3.12.0)
53
+ rspec-core (~> 3.12.0)
54
+ rspec-expectations (~> 3.12.0)
55
+ rspec-mocks (~> 3.12.0)
56
+ rspec-core (3.12.1)
57
+ rspec-support (~> 3.12.0)
58
+ rspec-expectations (3.12.2)
59
+ diff-lcs (>= 1.2.0, < 2.0)
60
+ rspec-support (~> 3.12.0)
61
+ rspec-mocks (3.12.3)
62
+ diff-lcs (>= 1.2.0, < 2.0)
63
+ rspec-support (~> 3.12.0)
64
+ rspec-support (3.12.0)
65
+ rubocop (1.46.0)
66
+ json (~> 2.3)
67
+ parallel (~> 1.10)
68
+ parser (>= 3.2.0.0)
69
+ rainbow (>= 2.2.2, < 4.0)
70
+ regexp_parser (>= 1.8, < 3.0)
71
+ rexml (>= 3.2.5, < 4.0)
72
+ rubocop-ast (>= 1.26.0, < 2.0)
73
+ ruby-progressbar (~> 1.7)
74
+ unicode-display_width (>= 2.4.0, < 3.0)
75
+ rubocop-ast (1.27.0)
76
+ parser (>= 3.2.1.0)
77
+ ruby-debug-base (0.11.0-java)
78
+ ruby-progressbar (1.11.0)
79
+ spoon (0.0.6)
80
+ ffi
81
+ tzinfo (2.0.6)
82
+ concurrent-ruby (~> 1.0)
83
+ unicode-display_width (2.4.2)
84
+ webmock (3.18.1)
85
+ addressable (>= 2.8.0)
86
+ crack (>= 0.3.2)
87
+ hashdiff (>= 0.4.0, < 2.0.0)
88
+ zeitwerk (2.6.7)
89
+
90
+ PLATFORMS
91
+ universal-java-17
92
+
93
+ DEPENDENCIES
94
+ novu!
95
+ pry-debugger-jruby
96
+ rake (~> 13.0)
97
+ rspec
98
+ rubocop (~> 1.21)
99
+ webmock
100
+
101
+ BUNDLED WITH
102
+ 2.4.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Aman Saini
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,156 @@
1
+ # Novu ruby client library
2
+
3
+ This is a Ruby client library for communicating with the [Novu API](https://api.novu.co/api).
4
+
5
+ ## Installation
6
+
7
+ You can install the client library via RubyGems:
8
+
9
+ ```ruby
10
+ gem install novu
11
+ ```
12
+
13
+ Or add it to your Gemfile:
14
+
15
+ ```ruby
16
+ gem 'novu'
17
+ ```
18
+
19
+ Then run `bundle install`.
20
+
21
+ ## Usage
22
+
23
+ To use the library, first initialize the client with your API token:
24
+
25
+ ```ruby
26
+ require 'novu'
27
+
28
+ client = Novu::Client.new('MY_API_TOKEN')
29
+ ```
30
+
31
+ You can then call methods on the client to interact with the Novu API:
32
+
33
+ ```ruby
34
+ client.notifications
35
+ ```
36
+
37
+ ## List of all methods
38
+
39
+ The client methods map directly to the Novu API endpoints. Here's a list of all the available methods. Check [the API docs](https://docs.novu.co/api/overview) for list of available `methods`.
40
+
41
+ ### Changes
42
+
43
+ - `changes(query = {})`
44
+ - `count_changes()`
45
+ - `apply_bulk_changes()`
46
+ - `apply_change(change_id)`
47
+
48
+ ### Environments
49
+
50
+ - `current_environment()`
51
+ - `create_environment(body)`
52
+ - `environments()`
53
+ - `update_environment(environment_id, body)`
54
+ - `api_keys()`
55
+ - `regenerate_api_keys()`
56
+ - `update_widget_settings(body)`
57
+
58
+ ### Events
59
+
60
+ - `trigger_event(body)`
61
+ - `trigger_bulk_event(body)`
62
+ - `broadcast_event(body)`
63
+ - `cancel_triggered_event(transaction_id)`
64
+
65
+ ### Execution Details
66
+
67
+ - `execution_details(query = {})`
68
+
69
+ ### Feeds
70
+
71
+ - `create_feed(body)`
72
+ - `feeds()`
73
+ - `delete_feed(feed_id)`
74
+
75
+ ### Inbound Parse
76
+
77
+ - `validate_mx_record_setup_for_inbound_parse()`
78
+
79
+ ### Integrations
80
+
81
+ - `integrations()`
82
+ - `create_integration(body)`
83
+ - `active_integrations()`
84
+ - `webhook_provider_status(provider_id)`
85
+ - `update_integration(integration_id, body)`
86
+ - `delete_integration(integration_id)`
87
+ - `channel_limit(channel_type)`
88
+ - `in_app_status()`
89
+
90
+ ### Layouts
91
+
92
+ - `create_layout(body) `
93
+ - `layouts(query = {})`
94
+ - `layout(layout_id)`
95
+ - `delete_layout(layout_id)`
96
+ - `update_layout(layout_id, body)`
97
+ - `make_default_layout(layout_id)`
98
+
99
+ ### Messages
100
+
101
+ - `messages(query = {})`
102
+ - `delete_message(message_id)`
103
+
104
+ ### Notification Groups
105
+
106
+ - `create_notification_group(body)`
107
+ - `notification_groups()`
108
+
109
+ ### Notification Templates
110
+
111
+ - `notification_templates(query = {})`
112
+ - `create_notification_template(body)`
113
+ - `update_notification_template(template_id, body)`
114
+ - `delete_notification_template(template_id)`
115
+ - `notification_template(template_id)`
116
+ - `notification_template_blueprint(template_id)`
117
+ - `create_notification_template_blueprint(template_id)`
118
+ - `update_notification_template_status(template_id, body)`
119
+
120
+ ### Notification
121
+
122
+ - `notifications(query = {})`
123
+ - `notifications_stats()`
124
+ - `notifications_graph_stats(query = {})`
125
+ - `notification(notification_id)`
126
+
127
+ ### Subscribers
128
+
129
+ - `subscribers(query = {}) `
130
+ - `create_subscriber(body)`
131
+ - `subscriber(subscriber_id)`
132
+ - `update_subscriber(subscriber_id, body)`
133
+ - `delete_subscriber(subscriber_id)`
134
+ - `update_subscriber_credentials(subscriber_id, body)`
135
+ - `update_subscriber_online_status(subscriber_id, body)`
136
+ - `subscriber_preferences(subscriber_id)`
137
+ - `update_subscriber_preference(subscriber_id, template_id, body)`
138
+ - `subscriber_notification_feed(subscriber_id, query = {})`
139
+ - `subscriber_unseen_notification_count(subscriber_id, query = {})`
140
+ - `mark_subscriber_feed_seen(subscriber_id, body)`
141
+ - `mark_message_action_seen(subscriber_id, message_id, type)`
142
+
143
+ ### Topics
144
+
145
+ - `create_topic(body)`
146
+ - `topics(query = {})`
147
+ - `add_subscribers(topic_key, body)`
148
+ - `remove_subscribers(topic_key, body)`
149
+ - `topic(topic_key)`
150
+ - `rename_topic(topic_key, body)`
151
+
152
+ ### For more information about these methods and their parameters, see the [API documentation](https://docs.novu.co/api/overview).
153
+
154
+ ## Contributing
155
+
156
+ Bug reports and pull requests are welcome on GitHub at https://
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Novu
4
+ class Api
5
+ # Module Novu::Api::Changes provides an API for managing changes in the Novu application.
6
+ #
7
+ # This module includes methods for retrieving, count, and applying bulk changes.
8
+ #
9
+ # For more information on the Novu API(https://api.novu.co/api#/Changes), see https://docs.novu.co/api/get-changes/.
10
+ module Changes
11
+ # Returns a list of changes that can be paginated using the `page` query parameter
12
+ #
13
+ # @queryparams:
14
+ # @param `page` [Integer(optional)] Number of page for the pagination.
15
+ # @param `limit` [Integer(optional)]
16
+ # @param `promoted` [String]
17
+ #
18
+ # @return [Hash] The list of changes that match the criteria of the query params are successfully returned.
19
+ # @return [number] status
20
+ # - Returns 200 if successful
21
+ def changes(query = {})
22
+ get("/changes", query: query)
23
+ end
24
+
25
+ # Returns changes count
26
+ #
27
+ # @return [Hash] changes count
28
+ # @return [number] status
29
+ # - Returns 200 if successful
30
+ def count_changes
31
+ get("/changes/count")
32
+ end
33
+
34
+ # Apply Bulk Change
35
+ #
36
+ # @return [Hash] updated change.
37
+ # @return [number] status
38
+ # - Returns 201 if the bulk change has been updated correctly.
39
+ def apply_bulk_changes
40
+ post("/changes/bulk/apply")
41
+ end
42
+
43
+ # Apply change
44
+ #
45
+ # @pathparams:
46
+ # @param `change_id` [Integer] The ID of the change to update.
47
+ #
48
+ # @return [Hash] updated change.
49
+ # @return [number] status
50
+ # - Returns 201 if the change with the change_id provided has been updated correctly.
51
+ def apply_change(change_id)
52
+ post("/changes/#{change_id}/apply")
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Novu
4
+ class Api
5
+ module Connection
6
+ def get(path, options = {})
7
+ request :get, path, options
8
+ end
9
+
10
+ def post(path, options = {})
11
+ request :post, path, options
12
+ end
13
+
14
+ def put(path, options = {})
15
+ request :put, path, options
16
+ end
17
+
18
+ def patch(path, options = {})
19
+ request :patch, path, options
20
+ end
21
+
22
+ def delete(path, options = {})
23
+ request :delete, path, options
24
+ end
25
+
26
+ private
27
+
28
+ def request(http_method, path, options)
29
+ response = self.class.send(http_method, path, options)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Novu
4
+ class Api
5
+ # Module Novu::Api::Environments provides an API for managing environments in the Novu application.
6
+ #
7
+ # This module includes methods for creating, retrieving, and updating environments.
8
+ # It also includes methods for getting and regenerating the api keys also for updatation of widget settings .
9
+ #
10
+ # For more information on the Novu API(https://api.novu.co/api#/Environments), see https://docs.novu.co/api/get-current-environment/.
11
+ module Environments
12
+ # Retrieves the current environment
13
+ #
14
+ # @return [Hash] The retrieved environment.
15
+ # @return [number] status
16
+ # - Returns 200 if successful
17
+ def current_environment
18
+ get("/environments/me")
19
+ end
20
+
21
+ # Creates a new environment.
22
+ #
23
+ # @bodyparams:
24
+ # @param `name` [String]
25
+ # @param `parentId` [String(optional)]
26
+ #
27
+ # @return [Hash] The created environment entity.
28
+ # @return [number] status - The status code. Returns 201 if the environment has been successfully created.
29
+ def create_environment(body)
30
+ post("/environments", body: body)
31
+ end
32
+
33
+ # Returns a list of environments
34
+ #
35
+ # @return [Hash] The list of environments.
36
+ # @return [number] status
37
+ # - Returns 200 if successful
38
+ def environments
39
+ get("/environments")
40
+ end
41
+
42
+ # Update the environment.
43
+ #
44
+ # @pathparams:
45
+ # @param `environment_id` [String] The ID of the environment to update.
46
+ #
47
+ # @bodyparams
48
+ # @param `name` [String(optional)]
49
+ # @param `identifier` [String(optional)]
50
+ # @param `parentId` [String(optional)]
51
+ # @param `dns` [Hash]
52
+ #
53
+ # @return [Hash] The updated environment.
54
+ # @return [number] status
55
+ # - Returns 200 if the environment with the environment_id provided has been updated correctly.
56
+ def update_environment(environment_id, body)
57
+ put("/environments/#{environment_id}", body: body)
58
+ end
59
+
60
+ # Returns a list of api keys
61
+ #
62
+ # @return [Hash] The list of api keys.
63
+ # @return [number] status
64
+ # - Returns 200 if successful
65
+ def api_keys
66
+ get("/environments/api-keys")
67
+ end
68
+
69
+ # Return regenerated api keys
70
+ #
71
+ # @return [Hash] Api keys.
72
+ # @return [number] status
73
+ # - Returns 200 if successful
74
+ def regenerate_api_keys
75
+ post("/environments/api-keys/regenerate")
76
+ end
77
+
78
+ # Update the widget settings.
79
+ #
80
+ # @bodyparams
81
+ # @param `notificationCenterEncryption` [Boolean]
82
+ #
83
+ # @return [Hash] The updated environment entity.
84
+ # @return [number] status
85
+ # - Returns 200 if the environment entity updated.
86
+ def update_widget_settings(body)
87
+ put("/environments/widget/settings", body: body)
88
+ end
89
+ end
90
+ end
91
+ end