gophish-ruby 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: 59b79d410ed7e2467c187c89992d394ee71d911da58524ecc3cc4b4eb5fb2a39
4
+ data.tar.gz: 62ca19b3ecdfb8cc88bfedc2bd4f53fca272db9a9f5de8846398573413daf4ae
5
+ SHA512:
6
+ metadata.gz: 78d1964ebcb0d3caba10c53d0f78e819b356b88961af7dfe48dde8611469e4c1919991cf7dec2aae991ccccea30e66a2f0bfea56f51420ebec4e8e0bbb07807e
7
+ data.tar.gz: 321297b58bdd280855faf6d988bfc9f4d2c062a5569a41316371c501bafabc7c8175e9312f5cb22f10fd0df1452ee439b65fe5c0475f01bd5243125868ab2c28
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,295 @@
1
+ plugins:
2
+ - rubocop-performance
3
+
4
+ inherit_mode:
5
+ merge:
6
+ - Exclude
7
+
8
+ AllCops:
9
+ NewCops: enable
10
+ SuggestExtensions: false
11
+
12
+ # All cops except your using extensions are disabled by default.
13
+ Bundler:
14
+ Enabled: false
15
+ Gemspec:
16
+ Enabled: false
17
+ Layout:
18
+ Enabled: false
19
+ Lint:
20
+ Enabled: false
21
+ Metrics:
22
+ Enabled: false
23
+ Naming:
24
+ Enabled: false
25
+ Performance:
26
+ Enabled: false
27
+ Exclude:
28
+ - "test/**/*"
29
+ - "spec/**/*"
30
+ Security:
31
+ Enabled: false
32
+ Style:
33
+ Enabled: false
34
+
35
+ # Align `when` with `end`.
36
+ Layout/CaseIndentation:
37
+ Enabled: true
38
+ EnforcedStyle: end
39
+
40
+ # Align comments with method definitions.
41
+ Layout/CommentIndentation:
42
+ Enabled: true
43
+
44
+ Layout/ElseAlignment:
45
+ Enabled: true
46
+
47
+ Layout/EmptyLineAfterMagicComment:
48
+ Enabled: true
49
+
50
+ Layout/EmptyLinesAroundBlockBody:
51
+ Enabled: true
52
+
53
+ # In a regular class definition, no empty lines around the body.
54
+ Layout/EmptyLinesAroundClassBody:
55
+ Enabled: true
56
+
57
+ # In a regular method definition, no empty lines around the body.
58
+ Layout/EmptyLinesAroundMethodBody:
59
+ Enabled: true
60
+
61
+ # In a regular module definition, no empty lines around the body.
62
+ Layout/EmptyLinesAroundModuleBody:
63
+ Enabled: true
64
+
65
+ # Align `end` with the matching keyword or starting expression except for
66
+ # assignments, where it should be aligned with the LHS.
67
+ Layout/EndAlignment:
68
+ Enabled: true
69
+ EnforcedStyleAlignWith: variable
70
+
71
+ # Method definitions after `private` or `protected` isolated calls need one
72
+ # extra level of indentation.
73
+ #
74
+ # We break this rule in context, though, e.g. for private-only concerns,
75
+ # so we leave it disabled.
76
+ Layout/IndentationConsistency:
77
+ Enabled: false
78
+ EnforcedStyle: indented_internal_methods
79
+
80
+ # Detect hard tabs, no hard tabs.
81
+ Layout/IndentationStyle:
82
+ Enabled: true
83
+
84
+ # Two spaces, no tabs (for indentation).
85
+ #
86
+ # Doesn't behave properly with private-only concerns, so it's disabled.
87
+ Layout/IndentationWidth:
88
+ Enabled: false
89
+
90
+ Layout/LeadingCommentSpace:
91
+ Enabled: true
92
+
93
+ Layout/SpaceAfterColon:
94
+ Enabled: true
95
+
96
+ Layout/SpaceAfterComma:
97
+ Enabled: true
98
+
99
+ Layout/SpaceAroundEqualsInParameterDefault:
100
+ Enabled: true
101
+
102
+ Layout/SpaceAroundKeyword:
103
+ Enabled: true
104
+
105
+ # Use `foo {}` not `foo{}`.
106
+ Layout/SpaceBeforeBlockBraces:
107
+ Enabled: true
108
+
109
+ Layout/SpaceBeforeComma:
110
+ Enabled: true
111
+
112
+ Layout/SpaceBeforeFirstArg:
113
+ Enabled: true
114
+
115
+ # Use `[ a, [ b, c ] ]` not `[a, [b, c]]`
116
+ # Use `[]` not `[ ]`
117
+ Layout/SpaceInsideArrayLiteralBrackets:
118
+ Enabled: true
119
+ EnforcedStyle: no_space
120
+ EnforcedStyleForEmptyBrackets: no_space
121
+
122
+ # Use `%w[ a b ]` not `%w[ a b ]`.
123
+ Layout/SpaceInsideArrayPercentLiteral:
124
+ Enabled: true
125
+
126
+ # Use `foo { bar }` not `foo {bar}`.
127
+ # Use `foo { }` not `foo {}`.
128
+ Layout/SpaceInsideBlockBraces:
129
+ Enabled: true
130
+ EnforcedStyleForEmptyBraces: space
131
+
132
+ # Use `{ a: 1 }` not `{a:1}`.
133
+ # Use `{}` not `{ }`.
134
+ Layout/SpaceInsideHashLiteralBraces:
135
+ Enabled: true
136
+ EnforcedStyle: space
137
+ EnforcedStyleForEmptyBraces: no_space
138
+
139
+ # Use `foo(bar)` not `foo( bar )`
140
+ Layout/SpaceInsideParens:
141
+ Enabled: true
142
+
143
+ # Requiring a space is not yet supported as of 0.59.2
144
+ # Use `%w[ foo ]` not `%w[foo]`
145
+ Layout/SpaceInsidePercentLiteralDelimiters:
146
+ Enabled: false
147
+ #EnforcedStyle: space
148
+
149
+ # Use `hash[:key]` not `hash[ :key ]`
150
+ Layout/SpaceInsideReferenceBrackets:
151
+ Enabled: true
152
+
153
+ # Blank lines should not have any spaces.
154
+ Layout/TrailingEmptyLines:
155
+ Enabled: true
156
+
157
+ # No trailing whitespace.
158
+ Layout/TrailingWhitespace:
159
+ Enabled: true
160
+
161
+ Lint/RedundantStringCoercion:
162
+ Enabled: true
163
+
164
+ # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
165
+ Lint/RequireParentheses:
166
+ Enabled: true
167
+
168
+ Lint/UriEscapeUnescape:
169
+ Enabled: true
170
+
171
+ Performance/FlatMap:
172
+ Enabled: true
173
+
174
+ # We generally prefer &&/|| but like low-precedence and/or in context
175
+ Style/AndOr:
176
+ Enabled: false
177
+
178
+ # Prefer Foo.method over Foo::method
179
+ Style/ColonMethodCall:
180
+ Enabled: true
181
+
182
+ Style/DefWithParentheses:
183
+ Enabled: true
184
+
185
+ # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
186
+ Style/HashSyntax:
187
+ Enabled: true
188
+ EnforcedShorthandSyntax: either
189
+
190
+ # Defining a method with parameters needs parentheses.
191
+ Style/MethodDefParentheses:
192
+ Enabled: true
193
+
194
+ Style/ParenthesesAroundCondition:
195
+ Enabled: true
196
+
197
+ Style/PercentLiteralDelimiters:
198
+ Enabled: true
199
+ PreferredDelimiters:
200
+ default: "()"
201
+ "%i": "[]"
202
+ "%I": "[]"
203
+ "%r": "{}"
204
+ "%w": "[]"
205
+ "%W": "[]"
206
+
207
+ # Use quotes for string literals when they are enough.
208
+ Style/RedundantPercentQ:
209
+ Enabled: false
210
+
211
+ Style/RedundantReturn:
212
+ Enabled: true
213
+ AllowMultipleReturnValues: false
214
+
215
+ Style/Semicolon:
216
+ Enabled: true
217
+ AllowAsExpressionSeparator: true
218
+
219
+ Style/StabbyLambdaParentheses:
220
+ Enabled: true
221
+
222
+ # Use `"foo"` not `'foo'` unless escaping is required
223
+ Style/StringLiterals:
224
+ Enabled: true
225
+ EnforcedStyle: single_quotes
226
+ Include:
227
+ - "lib/**/*"
228
+ - "test/**/*"
229
+ - "spec/**/*"
230
+ - "Gemfile"
231
+
232
+ Style/TrailingCommaInArrayLiteral:
233
+ Enabled: true
234
+
235
+ Style/TrailingCommaInHashLiteral:
236
+ Enabled: true
237
+
238
+ Layout/EmptyLinesAroundAccessModifier:
239
+ Enabled: true
240
+
241
+ Layout/EmptyLineBetweenDefs:
242
+ Enabled: true
243
+
244
+ Layout/LineLength:
245
+ Enabled: true
246
+ Exclude:
247
+ - "bin/**/*"
248
+ - "*.gemspec"
249
+
250
+ Metrics/AbcSize:
251
+ Enabled: true
252
+ Max: 17
253
+ Exclude:
254
+ - "bin/**/*"
255
+
256
+ Metrics/BlockLength:
257
+ Enabled: true
258
+ Exclude:
259
+ - "spec/**/*"
260
+ - "bin/**/*"
261
+
262
+ Metrics/BlockNesting:
263
+ Enabled: true
264
+ Max: 1
265
+ Exclude:
266
+ - "bin/**/*"
267
+
268
+ Metrics/CyclomaticComplexity:
269
+ Enabled: true
270
+ Exclude:
271
+ - "bin/**/*"
272
+
273
+ Metrics/MethodLength:
274
+ Enabled: true
275
+ Max: 8
276
+ Exclude:
277
+ - "bin/**/*"
278
+
279
+ Metrics/PerceivedComplexity:
280
+ Enabled: true
281
+ Exclude:
282
+ - "bin/**/*"
283
+
284
+ Style/Documentation:
285
+ Enabled: false
286
+
287
+ Style/FrozenStringLiteralComment:
288
+ Enabled: false
289
+
290
+ Style/MethodCallWithArgsParentheses:
291
+ Enabled: true
292
+ EnforcedStyle: omit_parentheses
293
+
294
+ Layout/EmptyLineAfterGuardClause:
295
+ Enabled: true
data/CHANGELOG.md ADDED
@@ -0,0 +1,83 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+ - Comprehensive documentation with getting started guide, API reference, and examples
12
+ - Enhanced README with detailed usage instructions and configuration examples
13
+
14
+ ### Changed
15
+ - Improved error messages for validation failures
16
+ - Enhanced CSV import validation with better error reporting
17
+
18
+ ### Fixed
19
+ - Console script requiring wrong file name (`gophish_ruby` → `gophish-ruby`)
20
+ - Spec helper requiring wrong file name for consistent naming
21
+
22
+ ## [0.1.0] - 2025-08-29
23
+
24
+ ### Added
25
+ - **Core SDK Foundation**
26
+ - `Gophish::Configuration` class for managing API credentials and settings
27
+ - `Gophish::Base` abstract class providing common CRUD operations
28
+ - HTTParty integration for API communication with automatic authentication
29
+ - ActiveModel integration for attributes, validations, and callbacks
30
+
31
+ - **Group Management**
32
+ - `Gophish::Group` class for managing target groups
33
+ - Full CRUD operations (create, read, update, delete)
34
+ - Comprehensive validations for group name and target data
35
+ - Support for target attributes: first_name, last_name, email, position
36
+
37
+ - **CSV Import Functionality**
38
+ - `#import_csv` method for bulk target import
39
+ - Automatic parsing of CSV with standard headers (First Name, Last Name, Email, Position)
40
+ - Data validation during import process
41
+
42
+ - **Change Tracking**
43
+ - Automatic tracking of attribute changes using ActiveModel
44
+ - `#changed_attributes`, `#attribute_changed?`, and `#attribute_was` methods
45
+ - Support for detecting modifications before saving
46
+
47
+ - **Configuration Management**
48
+ - Block-style configuration with `Gophish.configure`
49
+ - Support for API URL, API key, SSL verification, and debug output
50
+ - Environment-friendly configuration options
51
+
52
+ - **Validation System**
53
+ - Required field validations for groups and targets
54
+ - Email format validation using regex pattern
55
+ - Comprehensive error reporting with detailed messages
56
+ - Integration with ActiveModel validations
57
+
58
+ - **API Integration**
59
+ - RESTful API endpoint mapping with automatic pluralization
60
+ - JSON request/response handling
61
+ - Error handling for API failures
62
+ - Support for SSL configuration including development environments
63
+
64
+ - **Development Tools**
65
+ - Interactive console (`bin/console`) for testing and exploration
66
+ - RSpec test framework integration
67
+ - RuboCop linting configuration
68
+ - Rake tasks for testing and quality checks
69
+
70
+ ### Technical Details
71
+ - **Dependencies**: HTTParty 0.23.1, ActiveSupport/ActiveModel/ActiveRecord 8.0+
72
+ - **Ruby Version**: Requires Ruby >= 3.1.0
73
+ - **Architecture**: Modular design with inheritance-based API resources
74
+ - **Security**: Built-in API key authentication for all requests
75
+
76
+ ### Development Infrastructure
77
+ - Bundler gem management with proper gemspec configuration
78
+ - GitHub integration with proper repository URLs and metadata
79
+ - MIT license for open source distribution
80
+ - Code of conduct and contributing guidelines
81
+ - Comprehensive test suite foundation with RSpec
82
+
83
+ This initial release provides a solid foundation for interacting with the Gophish API, focusing on group management as the primary use case while establishing patterns for future resource implementations.
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
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, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
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 overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
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.
45
+
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.
50
+
51
+ ## Scope
52
+
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 email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Eli Herrera
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.