yonoma 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 +7 -0
- data/README.md +79 -0
- data/Rakefile +4 -0
- data/lib/yonoma/client.rb +41 -0
- data/lib/yonoma/contacts.rb +20 -0
- data/lib/yonoma/lists.rb +23 -0
- data/lib/yonoma/tags.rb +23 -0
- data/lib/yonoma/version.rb +5 -0
- data/lib/yonoma.rb +19 -0
- data/yonoma.gemspec +45 -0
- metadata +84 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c456a17b6bc182674222649da8d078f1cbe9d2b3576272380ebdbcbe5fa016c4
|
|
4
|
+
data.tar.gz: fbe633b432234503323bd4160842db7c41519750d2fc1497df863b711c608b2e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: eb230d860b90c45d81d803ff66336746115d56ec39f02dd5044a63ca1ae1752d85670145c8f517ff9468f128da482cc655a8d9c3de7b8361b8d308cca8e02406
|
|
7
|
+
data.tar.gz: 269f0296fe4e848b8459b10c8107620e569143b567d9d39766a75c5a4a3f7ef8041537f0dadb6436530b26d463272fef2dfc07fd96a5d2b7576bc3e23ac49119
|
data/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Yonoma Ruby SDK
|
|
2
|
+
|
|
3
|
+
Welcome to the Yonoma Ruby SDK! This gem provides a simple and efficient way to integrate with the Yonoma Email Marketing API.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'yonoma'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then execute:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
bundle install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
gem install yonoma
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Configuration
|
|
26
|
+
|
|
27
|
+
To configure the SDK, initialize it with your API key:
|
|
28
|
+
|
|
29
|
+
```ruby
|
|
30
|
+
require 'yonoma'
|
|
31
|
+
|
|
32
|
+
Yonoma::Client.configure do |config|
|
|
33
|
+
config.api_key = 'your_api_key_here'
|
|
34
|
+
end
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
### Managing Contacts
|
|
40
|
+
|
|
41
|
+
```ruby
|
|
42
|
+
client = Yonoma::Client.new
|
|
43
|
+
contacts = client.contacts.all
|
|
44
|
+
client.contacts.create(email: 'test@example.com', name: 'John Doe')
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Managing Lists
|
|
48
|
+
|
|
49
|
+
```ruby
|
|
50
|
+
lists = client.lists.all
|
|
51
|
+
client.lists.create(name: 'Newsletter Subscribers')
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Managing Tags
|
|
55
|
+
|
|
56
|
+
```ruby
|
|
57
|
+
tags = client.tags.all
|
|
58
|
+
client.tags.create(name: 'VIP Customer')
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Development
|
|
62
|
+
|
|
63
|
+
To contribute to the SDK:
|
|
64
|
+
|
|
65
|
+
1. Clone the repository
|
|
66
|
+
```sh
|
|
67
|
+
git clone https://github.com/YonomaHQ/yonoma-email-marketing-ruby.git
|
|
68
|
+
```
|
|
69
|
+
2. Run `bin/setup` to install dependencies
|
|
70
|
+
3. Run `rake test` to execute tests
|
|
71
|
+
4. Submit a pull request with your changes
|
|
72
|
+
|
|
73
|
+
## GitHub Repository
|
|
74
|
+
Find the project on GitHub: [Yonoma Ruby SDK](https://github.com/YonomaHQ/yonoma-email-marketing-ruby)
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
This project is licensed under the MIT License. See the `LICENSE` file for details.
|
|
79
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require 'net/http'
|
|
2
|
+
require 'json'
|
|
3
|
+
require 'uri'
|
|
4
|
+
|
|
5
|
+
module Yonoma
|
|
6
|
+
class Client
|
|
7
|
+
BASE_URL = 'https://api.yonoma.io/v1'
|
|
8
|
+
|
|
9
|
+
def self.request(method, endpoint, params = {})
|
|
10
|
+
raise "API key not set. Use Yonoma.api_key = 'your_api_key'" unless Yonoma.api_key
|
|
11
|
+
|
|
12
|
+
uri = URI("#{BASE_URL}#{endpoint}")
|
|
13
|
+
# puts uri
|
|
14
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
15
|
+
http.use_ssl = true
|
|
16
|
+
|
|
17
|
+
request = case method
|
|
18
|
+
when :get
|
|
19
|
+
uri.query = URI.encode_www_form(params)
|
|
20
|
+
Net::HTTP::Get.new(uri)
|
|
21
|
+
when :post
|
|
22
|
+
Net::HTTP::Post.new(uri)
|
|
23
|
+
when :put
|
|
24
|
+
Net::HTTP::Put.new(uri)
|
|
25
|
+
when :delete
|
|
26
|
+
Net::HTTP::Delete.new(uri)
|
|
27
|
+
else
|
|
28
|
+
raise "Unsupported method: #{method}"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
request["Authorization"] = "Bearer #{Yonoma.api_key}"
|
|
32
|
+
request["Content-Type"] = "application/json"
|
|
33
|
+
request.body = params.to_json unless method == :get
|
|
34
|
+
|
|
35
|
+
response = http.request(request)
|
|
36
|
+
JSON.parse(response.body, symbolize_names: true)
|
|
37
|
+
rescue StandardError => e
|
|
38
|
+
{ error: "Request failed: #{e.message}" }
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Yonoma
|
|
2
|
+
class Contacts
|
|
3
|
+
def self.create(list_id,params)
|
|
4
|
+
Client.request(:post, "/contacts/#{list_id}/create", params)
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def self.unsubscribe(list_id,contact_id,params)
|
|
8
|
+
Client.request(:post, "/contacts/#{list_id}/status/#{contact_id}", params)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.add_tag(contact_id,params)
|
|
12
|
+
Client.request(:post, "/contacts/tags/#{contact_id}/add", params)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.remove_tag(contact_id,params)
|
|
16
|
+
Client.request(:post, "/contacts/tags/#{contact_id}/remove",params)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
data/lib/yonoma/lists.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Yonoma
|
|
2
|
+
class Lists
|
|
3
|
+
def self.list
|
|
4
|
+
Client.request(:get, "/lists/list")
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def self.create(params)
|
|
8
|
+
Client.request(:post, "/lists/create", params)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.update(list_id, params)
|
|
12
|
+
Client.request(:post, "/lists/#{list_id}/update", params)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.retrieve(list_id)
|
|
16
|
+
Client.request(:get, "/lists/#{list_id}")
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.delete(list_id)
|
|
20
|
+
Client.request(:post, "/lists/#{list_id}/delete")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
data/lib/yonoma/tags.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Yonoma
|
|
2
|
+
class Tags
|
|
3
|
+
def self.list
|
|
4
|
+
Client.request(:get, "/tags/list")
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def self.create(params)
|
|
8
|
+
Client.request(:post, "/tags/create", params)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.update(tag_id, params)
|
|
12
|
+
Client.request(:post, "/tags/#{tag_id}/update", params)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.retrieve(tag_id)
|
|
16
|
+
Client.request(:get, "/tags/#{tag_id}")
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.delete(tag_id)
|
|
20
|
+
Client.request(:post, "/tags/#{tag_id}/delete")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
data/lib/yonoma.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "yonoma/version"
|
|
4
|
+
require_relative "yonoma/client"
|
|
5
|
+
require_relative "yonoma/contacts"
|
|
6
|
+
require_relative "yonoma/lists"
|
|
7
|
+
require_relative "yonoma/tags"
|
|
8
|
+
|
|
9
|
+
module Yonoma
|
|
10
|
+
class Error < StandardError; end
|
|
11
|
+
# Your code goes here...
|
|
12
|
+
class << self
|
|
13
|
+
attr_accessor :api_key
|
|
14
|
+
|
|
15
|
+
def configure(api_key)
|
|
16
|
+
@api_key = api_key
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
data/yonoma.gemspec
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/yonoma/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "yonoma"
|
|
7
|
+
spec.version = Yonoma::VERSION
|
|
8
|
+
spec.authors = ["YonomaHQ"]
|
|
9
|
+
spec.email = ["tools@yonoma.io"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "A Ruby gem for managing and sending marketing emails."
|
|
12
|
+
spec.description = "A Ruby gem for managing and sending marketing emails. This gem provides an easy-to-use interface to create email campaigns, handle mailing lists, and track metrics such as open rates and clicks. Ideal for small businesses and individuals who need a straightforward, code-driven solution for their email marketing needs."
|
|
13
|
+
spec.homepage = "https://yonoma.io/"
|
|
14
|
+
spec.required_ruby_version = ">= 3.1.0"
|
|
15
|
+
|
|
16
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
17
|
+
|
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
19
|
+
spec.metadata["source_code_uri"] = "https://github.com/YonomaHQ/yonoma-email-marketing-ruby"
|
|
20
|
+
spec.metadata["changelog_uri"] = "https://github.com/YonomaHQ/yonoma-email-marketing-ruby/releases"
|
|
21
|
+
spec.license = "MIT"
|
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
24
|
+
gemspec = File.basename(__FILE__)
|
|
25
|
+
spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
|
|
26
|
+
ls.readlines("\x0", chomp: true).reject do |f|
|
|
27
|
+
(f == gemspec) ||
|
|
28
|
+
f.start_with?(*%w[bin/ test/ spec/ features/ .git appveyor Gemfile])
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
spec.files = Dir["lib/**/*", "README.md", "Rakefile", "yonoma.gemspec"]
|
|
32
|
+
spec.bindir = "exe"
|
|
33
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
34
|
+
spec.require_paths = ["lib"]
|
|
35
|
+
|
|
36
|
+
# Dependencies
|
|
37
|
+
spec.add_dependency "httparty", "~> 0.21"
|
|
38
|
+
spec.add_dependency "json", "~> 2.6"
|
|
39
|
+
|
|
40
|
+
# Uncomment to register a new dependency of your gem
|
|
41
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
|
42
|
+
|
|
43
|
+
# For more information and examples about making a new gem, check out our
|
|
44
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
|
45
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: yonoma
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- YonomaHQ
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2025-03-05 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: httparty
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0.21'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0.21'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: json
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '2.6'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '2.6'
|
|
40
|
+
description: A Ruby gem for managing and sending marketing emails. This gem provides
|
|
41
|
+
an easy-to-use interface to create email campaigns, handle mailing lists, and track
|
|
42
|
+
metrics such as open rates and clicks. Ideal for small businesses and individuals
|
|
43
|
+
who need a straightforward, code-driven solution for their email marketing needs.
|
|
44
|
+
email:
|
|
45
|
+
- tools@yonoma.io
|
|
46
|
+
executables: []
|
|
47
|
+
extensions: []
|
|
48
|
+
extra_rdoc_files: []
|
|
49
|
+
files:
|
|
50
|
+
- README.md
|
|
51
|
+
- Rakefile
|
|
52
|
+
- lib/yonoma.rb
|
|
53
|
+
- lib/yonoma/client.rb
|
|
54
|
+
- lib/yonoma/contacts.rb
|
|
55
|
+
- lib/yonoma/lists.rb
|
|
56
|
+
- lib/yonoma/tags.rb
|
|
57
|
+
- lib/yonoma/version.rb
|
|
58
|
+
- yonoma.gemspec
|
|
59
|
+
homepage: https://yonoma.io/
|
|
60
|
+
licenses:
|
|
61
|
+
- MIT
|
|
62
|
+
metadata:
|
|
63
|
+
allowed_push_host: https://rubygems.org
|
|
64
|
+
homepage_uri: https://yonoma.io/
|
|
65
|
+
source_code_uri: https://github.com/YonomaHQ/yonoma-email-marketing-ruby
|
|
66
|
+
changelog_uri: https://github.com/YonomaHQ/yonoma-email-marketing-ruby/releases
|
|
67
|
+
rdoc_options: []
|
|
68
|
+
require_paths:
|
|
69
|
+
- lib
|
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: 3.1.0
|
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
|
+
requirements:
|
|
77
|
+
- - ">="
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: '0'
|
|
80
|
+
requirements: []
|
|
81
|
+
rubygems_version: 3.6.5
|
|
82
|
+
specification_version: 4
|
|
83
|
+
summary: A Ruby gem for managing and sending marketing emails.
|
|
84
|
+
test_files: []
|