Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1681899
Added requests management and documentation
fcarrega Apr 9, 2025
9098038
Initialized contact API endpoints
fcarrega Apr 9, 2025
84810de
Changed domain to client name to respect Ohme wording
fcarrega Apr 9, 2025
4bc31be
Updated code & version
fcarrega Apr 9, 2025
4623960
Renamed api_key to client_secret to match Ohme wording
fcarrega Apr 9, 2025
963fa4d
Improved code, specs and bumped version
fcarrega Apr 9, 2025
edd8ab6
Added payment code + specifications
fcarrega May 12, 2025
c8663f0
Removed timeout log
fcarrega May 14, 2025
90e90e0
Corrected lib requirements
fcarrega May 19, 2025
1d09e56
Corrected request
fcarrega May 20, 2025
c8f3746
Rollback on serialized body
fcarrega May 20, 2025
fe7503d
Corrected typo
fcarrega May 20, 2025
f1c651c
Corrected client calls
fcarrega May 20, 2025
537b4b3
Corrected payment api
fcarrega May 20, 2025
704c713
Corrected specs
fcarrega Jun 24, 2025
573e47e
Bump ohme to 0.2.0
fcarrega Jun 24, 2025
09adf85
Added documentation
fcarrega Jun 24, 2025
ff93c14
Corrected formatting issues
fcarrega Jun 24, 2025
a46edb9
Added platform to Gemfile.lock
fcarrega Jun 24, 2025
7e1c7ad
Code Climate
fcarrega Jun 25, 2025
70e43b1
Commited Qlty files
fcarrega Jun 26, 2025
5e5a876
Quality configuration and correction
fcarrega Jun 26, 2025
e1aee52
Corrected specs
fcarrega Jun 26, 2025
1f0b2ee
Corrected syntax
fcarrega Jun 27, 2025
e3b849e
Added gem host
fcarrega Jun 27, 2025
c76f184
Changed actions and added documentation
fcarrega Jun 27, 2025
09ae49a
Modified README.md
fcarrega Jun 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .qlty/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*
!configs
!configs/**
!hooks
!hooks/**
!qlty.toml
!.gitignore
5 changes: 5 additions & 0 deletions .qlty/configs/.standard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ignore:
- "**/*":
- Style/StringLiterals # Use single quotes for strings
- Layout/MultilineMethodCallIndentation # Indentation of multiline method calls
- Layout/SpaceInsideHashLiteralBraces # Allow space inside hash literal braces
8 changes: 8 additions & 0 deletions .qlty/configs/.yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rules:
document-start: disable
quoted-strings:
required: only-when-needed
extra-allowed: ["{|}"]
key-duplicates: {}
octal-values:
forbid-implicit-octal: true
101 changes: 101 additions & 0 deletions .qlty/qlty.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# This file was automatically generated by `qlty init`.
# You can modify it to suit your needs.
# We recommend you to commit this file to your repository.
#
# This configuration is used by both Qlty CLI and Qlty Cloud.
#
# Qlty CLI -- Code quality toolkit for developers
# Qlty Cloud -- Fully automated Code Health Platform
#
# Try Qlty Cloud: https://qlty.sh
#
# For a guide to configuration, visit https://qlty.sh/d/config
# Or for a full reference, visit https://qlty.sh/d/qlty-toml
config_version = "0"

exclude_patterns = [
"*_min.*",
"*-min.*",
"*.min.*",
"**/.yarn/**",
"**/*.d.ts",
"**/assets/**",
"**/bower_components/**",
"**/build/**",
"**/cache/**",
"**/config/**",
"**/db/**",
"**/deps/**",
"**/dist/**",
"**/extern/**",
"**/external/**",
"**/generated/**",
"**/Godeps/**",
"**/gradlew/**",
"**/mvnw/**",
"**/node_modules/**",
"**/protos/**",
"**/seed/**",
"**/target/**",
"**/templates/**",
"**/testdata/**",
"**/vendor/**",
]

test_patterns = [
"**/test/**",
"**/spec/**",
"**/*.test.*",
"**/*.spec.*",
"**/*_test.*",
"**/*_spec.*",
"**/test_*.*",
"**/spec_*.*",
]

[smells]
mode = "comment"

[[source]]
name = "default"
default = true


[[plugin]]
name = "actionlint"

[[plugin]]
name = "checkov"

[[plugin]]
name = "markdownlint"
mode = "comment"

[[plugin]]
name = "osv-scanner"

[[plugin]]
name = "prettier"

[[plugin]]
name = "ripgrep"
mode = "comment"

[[plugin]]
name = "rubocop"

[[plugin]]
name = "standardrb"

[[plugin]]
name = "trivy"
drivers = [
"config",
"fs-vuln",
]

[[plugin]]
name = "trufflehog"

[[plugin]]
name = "yamllint"
3 changes: 0 additions & 3 deletions .standard.yml

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## [Unreleased]

## [0.2.0] - 2025-06-27

- Added contacts and payment API calls
- Improved configuration and specifications

## [0.1.0] - 2024-12-12

- Initial release
86 changes: 86 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
PATH
remote: .
specs:
ohme (0.2.0)
typhoeus (>= 1.4)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.3)
diff-lcs (1.6.1)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.15.5)
json (2.10.2)
language_server-protocol (3.17.0.4)
lint_roller (1.1.0)
parallel (1.26.3)
parser (3.3.7.4)
ast (~> 2.4.1)
racc
prism (1.4.0)
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.10.0)
rexml (3.4.1)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.3)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.2)
rubocop (1.64.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.44.0)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-performance (1.21.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (1.13.0)
standard (1.37.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.64.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.4)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.4.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.21.0)
typhoeus (1.4.0)
ethon (>= 0.9.0)
unicode-display_width (2.6.0)

PLATFORMS
x86_64-darwin-20
x86_64-linux

DEPENDENCIES
ohme!
rake (~> 13.0)
rspec (~> 3.0)
standard (~> 1.3)

BUNDLED WITH
2.3.12
40 changes: 32 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,46 @@
# Ohme

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/ohme`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem
A Ruby connector for the Ohme API, a tool for integrating with the Ohme CRM platform. This gem simplifies interaction with the Ohme API, allowing developers to easily perform operations such as retrieving data, creating resources, and managing entities within the Ohme ecosystem.

## Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add ohme
bundle add ohme

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install ohme
gem install ohme

## Usage

TODO: Write usage instructions here
### Configuration Initialization

First, configure the Ohme client with your credentials and settings:

```ruby
require 'ohme'
require 'json'

config = Ohme::Configuration.new do |c|
c.client_name = 'your_client_name'
c.client_secret = 'your_client_secret'
end
```

Then, initialize the client using your configuration:

```ruby
client = Ohme::Client.new(config)
```

You can now use the API endpoints. For example, to list contacts:

```ruby
contact_api = Ohme::API::Contact.new(client)
contacts = contact_api.index
puts contacts
```

## Development

Expand All @@ -26,12 +50,12 @@ To install this gem onto your local machine, run `bundle exec rake install`. To

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ohme. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/ohme/blob/main/CODE_OF_CONDUCT.md).
Bug reports and pull requests are welcome on GitHub at <https://github.com/Treize37/ohme>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/Treize37/ohme/blob/main/CODE_OF_CONDUCT.md).

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

## Code of Conduct

Everyone interacting in the Ohme project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/ohme/blob/main/CODE_OF_CONDUCT.md).
Everyone interacting in the Ohme project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Treize37/ohme/blob/main/CODE_OF_CONDUCT.md).
8 changes: 4 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

require "standard/rake"
require 'standard/rake'

task default: %i[spec standard]
task default: %i[spec]
7 changes: 6 additions & 1 deletion lib/ohme.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# frozen_string_literal: true

require_relative "ohme/version"
require_relative 'ohme/version'
require_relative 'ohme/configuration'
require_relative 'ohme/client'
require_relative 'ohme/api/contact'
require_relative 'ohme/api/payment'

# Ohme API client gem main module.
module Ohme
class Error < StandardError; end
# Your code goes here...
Expand Down
60 changes: 60 additions & 0 deletions lib/ohme/api/contact.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# frozen_string_literal: true

module Ohme
module API
# The Contact class provides methods to interact with the Ohme API's
# contacts endpoint.
# It allows you to list, create, read, update, and delete contacts.
class Contact
# Initializes a new Contact instance with a client.
#
# @param client [Ohme::Client] An instance of the Ohme client to
# make API requests
# @return [Ohme::API::Contact] A new instance of the Contact class
def initialize(client = Ohme::Client.new)
@client = client
end

# Fetches the list of contacts
#
# @param params [Hash] Optional query parameters
# @return [Hash] The response from the API
def index(params = {})
@client.get('contacts', params)
end

# Creates a new contact
#
# @param body [Hash] The contact data to be sent in the request body
# @return [Hash] The response from the API
def create(body)
@client.post('contacts', body)
end

# Updates a contact by ID
#
# @param id [String] The ID of the contact to update
# @param body [Hash] The contact data to be updated
# @return [Hash] The response from the API
def update(id, body)
@client.put("contacts/#{id}", body)
end

# Fetches a contact by ID
#
# @param id [String] The ID of the contact to retrieve
# @return [Hash] The response from the API
def show(id)
@client.get("contacts/#{id}")
end

# Deletes a contact by ID
#
# @param id [String] The ID of the contact to delete
# @return [nil] The response from the API
def delete(id)
@client.delete("contacts/#{id}")
end
end
end
end
Loading