Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
This is a API interface to export email contact_group to Newsletter7. Accounts signed up Newsletter7 with Bonofa account can export Newsletter7 email contact_group directly on Bonofa sites.
Add this line to your application's Gemfile:
gem 'newsletter7_api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install newsletter7_api
You can use ContactGroup resources as normal models.
Newsletter7ApiResource.connection.set_header('ACCESS_TOKEN', account_promotion_code)
@contact_group = Newsletter7Api::ContactGroup.new(name: '', contacts: [])
@your_contact_group = ...
@your_contact_group.each do |member|
@contact_group.contacts << member
end
@contact_group.save
This will create a contact_group on Newsletter7.(Imagine memeber has attributes first_name, last_name, email)
You can configure Newsletter7 api url and http authentication name and password in initializer(config/initializers/newsletter7_api.rb)
Newsletter7ApiResource.site = 'http://localhost:3000/api/v1'
Newsletter7ApiResource.user = 'newsletter7'
Newsletter7ApiResource.password = 'defaultpw'
This settings should be match with those of Newsletter7.
Account promotion code will be encrypted and set in request header as access token. This promotion code will be used to find Newsletter7 account.
Coltroller code can be look like this;
class ContactGroupsController < ApplicationController
newsletter7_api
def new
begin
@contact_group = Newsletter7Api::ContactGroup.all
rescue => e
redirect_to root_path, alert: 'You are not authorized to access Newsletter7.'
return
end
@your_contact_group = ...
@your_contact_group.each do |member|
@contact_group.contacts << member
end
end
def create
@contact_group = Newsletter7Api::ContactGroup.new(params[:newsletter7_api_contact_group])
if @contact_group.save
redirect_to root_path, notice: 'Contacts were successfully exported.'
else
redirect_to root_path, alert: 'Error occured while exporting contacts.'
end
end
end
Form example(haml)
= form_for(@contact_group, url: url_for(:action => 'create')) do |f|
%fieldset
= f.label :name
= f.text_field :name
%h4
Contacts to export
%small (member with invalid email or not selected will not be exported.)
= render partial: 'contact', collection: @contact_group.contacts
= f.submit
Contact partial
.contact_field
%fieldset
= text_field_tag "newsletter7_api_contact_group[contacts][][first_name]", contact.first_name, placeholder: 'First Name'
%fieldset
= text_field_tag "newsletter7_api_contact_group[contacts][][last_name]", contact.last_name, placeholder: 'Last Name'
%fieldset
= text_field_tag "newsletter7_api_contact_group[contacts][][email]", contact.email, placeholder: 'Email'
%fieldset
= check_box_tag "newsletter7_api_contact_group[contacts][][selected]", true, checked: true
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that newsletter7_api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.