mailerlite 0.3.0 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8778460cc49d8f082a725d64b698686907432a79
4
- data.tar.gz: 7172a78894facf2a778c839158c3f0521419ec2a
3
+ metadata.gz: 843af19f90d52a10946d15d6e01a18145ea9d42f
4
+ data.tar.gz: dab4fc1e6262cd7534ce338603c5f8229a845d1c
5
5
  SHA512:
6
- metadata.gz: dff75234d4a7540eeb19c19e8646f1a106c10a3818ff4471fa030417c196672e388f0d270749616649b1a9075ee2dbaa7bfd1d39177584b56f150048a8e7dd4d
7
- data.tar.gz: c4cb1b149695aadbde493de0dd305edc51e796ba54e5b54f6e6306b92295049c92ee28285eed72b22d9db97e23675dec08042dfd3228acc178ed59c5dc83ccda
6
+ metadata.gz: afa2abd88a4f60d9b6ef7062fc1f6e403ebea6d5e07bfdd52d95620d5871a5e80b256a281e2fc85ff87c33fb285f5bdb6ccd82f89a8eb44daedf365363c83ba9
7
+ data.tar.gz: 4c8e17942c01e12c5806f05b758cd67e6f461bc1f9641a5dcc2cb8b34c5be7944fd8d49490c81466b8de9333ace95633c574fc4d1babaa47716911859052a276
data/.hound.yml ADDED
@@ -0,0 +1,3 @@
1
+ ruby:
2
+ enabled: true
3
+ config_file: .rubocop.yml
data/.rubocop.yml ADDED
@@ -0,0 +1,30 @@
1
+ AllCops:
2
+ Include:
3
+ - '**/Rakefile'
4
+ - '**/Gemfile'
5
+
6
+ Style/Documentation:
7
+ Enabled: false
8
+
9
+ Style/AlignParameters:
10
+ Enabled: true
11
+ EnforcedStyle: with_fixed_indentation
12
+
13
+ Style/MultilineOperationIndentation:
14
+ Enabled: true
15
+ EnforcedStyle: indented
16
+
17
+ Style/MultilineMethodCallIndentation:
18
+ Enabled: true
19
+ EnforcedStyle: indented
20
+
21
+ Style/CaseIndentation:
22
+ Enabled: true
23
+ IndentWhenRelativeTo: end
24
+
25
+ Lint/EndAlignment:
26
+ Enabled: true
27
+ AlignWith: variable
28
+
29
+ Style/FrozenStringLiteralComment:
30
+ Enabled: false
data/.travis.yml CHANGED
@@ -8,18 +8,12 @@ bundler_args: --without development
8
8
  language: ruby
9
9
 
10
10
  rvm:
11
- - 1.9.3
12
11
  - 2.0.0
13
12
  - 2.1.0
14
13
  - 2.2.0
15
14
  - 2.3.0
16
15
  - ruby-head
17
- - jruby-19mode
18
- - jruby-head
19
- - rbx
20
16
 
21
17
  matrix:
22
18
  allow_failures:
23
19
  - rvm: ruby-head
24
- - rvm: jruby-head
25
- - rvm: rbx
data/Gemfile CHANGED
@@ -1,16 +1,21 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ group :development do
4
+ gem 'guard-rspec', '~> 4.7.3'
5
+ gem 'rubocop', '~> 0.42'
6
+ end
7
+
3
8
  group :development, :test do
4
9
  gem 'pry'
5
10
  end
6
11
 
7
12
  group :test do
8
13
  gem 'codeclimate-test-reporter', require: false
9
- gem 'coveralls', '~> 0.8.13', require: false
10
- gem 'guard-rspec', '~> 4.6.5'
14
+ gem 'coveralls', '~> 0.8.15', require: false
11
15
  gem 'rake' # For Travis CI
12
- gem 'simplecov', '~> 0.11.2', require: false
13
- gem 'webmock', '~> 1.24.3'
16
+ gem 'rspec', '~> 3.5'
17
+ gem 'simplecov', '~> 0.12', require: false
18
+ gem 'webmock', '~> 2.1'
14
19
  end
15
20
 
16
21
  gemspec
data/README.md CHANGED
@@ -41,7 +41,6 @@ end
41
41
  This library aims to support and is [tested against][travis] the following Ruby
42
42
  implementations:
43
43
 
44
- * Ruby 1.9.3
45
44
  * Ruby 2.0.0
46
45
  * Ruby 2.1.0
47
46
  * Ruby 2.2.0
data/lib/mailerlite.rb CHANGED
@@ -17,5 +17,9 @@ module MailerLite
17
17
  return super unless client.respond_to?(method_name)
18
18
  client.send(method_name, *args, &block)
19
19
  end
20
+
21
+ def respond_to_missing?(method_name, include_private = false)
22
+ client.respond_to?(method_name, include_private)
23
+ end
20
24
  end
21
25
  end
@@ -2,30 +2,39 @@ require 'mailerlite/connection'
2
2
  require 'mailerlite/configuration'
3
3
 
4
4
  require 'mailerlite/clients/campaigns'
5
- require 'mailerlite/clients/lists'
5
+ require 'mailerlite/clients/fields'
6
+ require 'mailerlite/clients/groups'
6
7
  require 'mailerlite/clients/subscribers'
7
8
 
8
9
  module MailerLite
9
10
  # Wrapper class for all actions.
10
11
  class Client
11
12
  include MailerLite::Clients::Campaigns
12
- include MailerLite::Clients::Lists
13
+ include MailerLite::Clients::Fields
14
+ include MailerLite::Clients::Groups
13
15
  include MailerLite::Clients::Subscribers
14
16
 
17
+ # Initialize client.
18
+ #
19
+ # @param options [Hash] A customizable set of options.
20
+ # @option options [String] :api_key API Key provider from MailerLite.
15
21
  def initialize(options = {})
16
22
  config.api_key = options[:api_key] if options[:api_key]
17
23
  end
18
24
 
25
+ # @return [Configuration]
19
26
  def config
20
27
  @config ||= Configuration.new
21
28
  end
22
29
  alias configuration config
23
30
 
31
+ # Configure client with a block of settings.
24
32
  def configure
25
33
  yield(config) if block_given?
26
34
  true
27
35
  end
28
36
 
37
+ # @return [Connection]
29
38
  def connection
30
39
  @connection ||= Connection.new(self)
31
40
  end
@@ -1,42 +1,54 @@
1
1
  module MailerLite
2
2
  module Clients
3
- # Get information about MailerLite Campaigns.
4
- #
5
- # You can official documentation at
6
- # https://docs.mailerlite.com/pages/campaigns
3
+ # MailerLite Campaigns.
7
4
  module Campaigns
8
- def campaigns(options = {})
9
- connection.get('campaigns/', options)
5
+ # Create campaign where you will use your custom HTML template
6
+ #
7
+ # @see https://developers.mailerlite.com/docs/campaigns
8
+ #
9
+ # @param options [Hash] A customizable set of options.
10
+ # @option options [String] :type Type of campaign. Available values:
11
+ # regular, ab.
12
+ # @option options [String] :subject Mail subject. Required if campaign
13
+ # type is regular.
14
+ # @option options [String] :from Email of sender
15
+ # @option options [String] :from_name Name of sender
16
+ # @option options [String] :language ISO 639-1
17
+ # @option options [Array] :groups IDs of groups
18
+ # @option options [Hash] :ab_settings Required if campaign type is ab.
19
+ #
20
+ # @return [Hash] Response from API.
21
+ def create_campaign(options = {})
22
+ connection.post('campaigns', options)
10
23
  end
11
24
 
12
- def campaign(id)
13
- connection.get("campaigns/#{id}/")
25
+ # Upload your HTML template to created campaign
26
+ #
27
+ # @see https://developers.mailerlite.com/docs/put-custom-content-to-campaign
28
+ #
29
+ # @param id [Integer] ID of campaign
30
+ # @param options [Hash] A customizable set of options.
31
+ # @option options [String] :html HTML template source
32
+ # @option options [String] :plain Plain text of email
33
+ # @option options [Boolean] :auto_inline Defines if it is needed to
34
+ # convert available CSS to inline CSS (excluding media queries)
35
+ #
36
+ # @return [Hash] Response from API.
37
+ def update_campaign_content(id, options = {})
38
+ connection.put("campaigns/#{id}/content", options)
14
39
  end
15
40
 
16
- def campaign_recipients(id, options = {})
17
- connection.get("campaigns/#{id}/recipients/", options)
41
+ # Send, schedule or cancel campaign
42
+ #
43
+ # @see https://developers.mailerlite.com/docs/campaign-actions-and-triggers
44
+ #
45
+ # @param id [Integer] ID of campaign
46
+ # @param action [String] Action type. Possible values: send, cancel
47
+ #
48
+ # @return [Hash] Response from API.
49
+ def campaign_action(id, action)
50
+ connection.post("campaigns/#{id}/actions/#{action}")
18
51
  end
19
-
20
- def campaign_opens(id, options = {})
21
- connection.get("campaigns/#{id}/opens/", options)
22
- end
23
-
24
- def campaign_clicks(id, options = {})
25
- connection.get("campaigns/#{id}/clicks/", options)
26
- end
27
-
28
- def campaign_unsubscribes(id, options = {})
29
- connection.get("campaigns/#{id}/unsubscribes/", options)
30
- end
31
-
32
- def campaign_bounces(id, options = {})
33
- connection.get("campaigns/#{id}/bounces/", options)
34
- end
35
-
36
- def campaign_junk(id, options = {})
37
- connection.get("campaigns/#{id}/junk/", options)
38
- end
39
- alias campaign_spam_complaints campaign_junk
40
52
  end
41
53
  end
42
54
  end
@@ -0,0 +1,53 @@
1
+ module MailerLite
2
+ module Clients
3
+ # Get information about MailerLite Fields
4
+ module Fields
5
+ # Get subscriber fields of account
6
+ #
7
+ # @see https://developers.mailerlite.com/docs/all-fields
8
+ #
9
+ # @return [Array] Response from API.
10
+ def fields
11
+ connection.get('fields')
12
+ end
13
+
14
+ # Create new custom field in account
15
+ #
16
+ # @see https://developers.mailerlite.com/docs/create-field
17
+ #
18
+ # @param options [Hash] A customizable set of options.
19
+ # @option options [String] :title Title of field
20
+ # @option options [String] :type Type of field. Available values:
21
+ # TEXT, INTEGER, DATE
22
+ #
23
+ # @return [Hash] Response from API.
24
+ def create_field(options = {})
25
+ connection.post('fields', options)
26
+ end
27
+
28
+ # Update custom field in account
29
+ #
30
+ # @see https://developers.mailerlite.com/docs/update-field
31
+ #
32
+ # @param id [Integer] ID of field.
33
+ # @param options [Hash] A customizable set of options.
34
+ # @option options [String] :title Title of field
35
+ #
36
+ # @return [Hash] Response from API.
37
+ def update_field(id, options = {})
38
+ connection.put("fields/#{id}", options)
39
+ end
40
+
41
+ # Remove custom field from account
42
+ #
43
+ # @see https://developers.mailerlite.com/docs/remove-field
44
+ #
45
+ # @param id [Integer] ID of field.
46
+ #
47
+ # @return [Hash] Response from API.
48
+ def delete_field(id)
49
+ connection.delete("fields/#{id}")
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,49 @@
1
+ module MailerLite
2
+ module Clients
3
+ # Get information about MailerLite Lists.
4
+ #
5
+ # You can official documentation at
6
+ # https://developers.mailerlite.com/docs/groups
7
+ module Groups
8
+ def groups
9
+ connection.get('groups')
10
+ end
11
+
12
+ def group(id)
13
+ result = connection.get("groups/#{id}")
14
+ result.is_a?(Array) ? result[0] : result
15
+ end
16
+
17
+ def create_group(name)
18
+ connection.post('groups', name: name)
19
+ end
20
+
21
+ def update_group(id, options = {})
22
+ connection.put("groups/#{id}", options)
23
+ end
24
+
25
+ def delete_group(id)
26
+ connection.delete("groups/#{id}")
27
+ end
28
+
29
+ def group_subscribers(group_id, options = {})
30
+ connection.get("groups/#{group_id}/subscribers", options)
31
+ end
32
+
33
+ def create_group_subscriber(group_id, options = {})
34
+ connection.post("groups/#{group_id}/subscribers", options)
35
+ end
36
+
37
+ def import_group_subscribers(group_id, subscribers, options = {})
38
+ options[:subscribers] = subscribers
39
+ connection.post("groups/#{group_id}/subscribers/import", options)
40
+ end
41
+
42
+ def delete_group_subscriber(group_id, subscriber_id_or_email)
43
+ connection.delete(
44
+ "groups/#{group_id}/subscribers/#{subscriber_id_or_email}"
45
+ )
46
+ end
47
+ end
48
+ end
49
+ end
@@ -2,32 +2,74 @@ module MailerLite
2
2
  module Clients
3
3
  # Get information about MailerLite Subscribers.
4
4
  #
5
- # You can official documentation at
6
- # https://docs.mailerlite.com/pages/subscribers
5
+ # @see https://docs.mailerlite.com/pages/subscribers
7
6
  module Subscribers
8
- def create_subscriber(list_id, email, options = {})
9
- options[:email] = email
10
-
11
- connection.post("subscribers/#{list_id}/", options)
7
+ # Get single subscriber
8
+ #
9
+ # @see https://developers.mailerlite.com/docs/single-subscriber
10
+ #
11
+ # @param identifier [Integer,String] ID or email of subscriber.
12
+ #
13
+ # @return [Hash] Response from API.
14
+ def subscriber(identifier)
15
+ connection.get("subscribers/#{identifier}")
12
16
  end
13
17
 
14
- def create_subscribers(list_id, options = {})
15
- connection.post("subscribers/#{list_id}/import/", options)
18
+ # Update single subscriber
19
+ #
20
+ # @see https://developers.mailerlite.com/docs/update-subscriber
21
+ #
22
+ # @param identifier [Integer,String] ID or email of subscriber.
23
+ # @param options [Hash] A customizable set of options.
24
+ # @option options [Array] :fields Associated array where key is the same
25
+ # as field key.
26
+ # @option options [String] :type Available values: unsubscribed, active
27
+ # @option options [Boolean] :resend_autoresponders Defines if it is
28
+ # needed to resend autoresponders
29
+ #
30
+ # @return [Hash] Response from API.
31
+ def update_subscriber(identifier, options = {})
32
+ connection.put("subscribers/#{identifier}", options)
16
33
  end
17
34
 
18
- def subscriber(email, options = {})
19
- options[:email] = email
20
-
21
- connection.get('subscribers/', options)
35
+ # Search for subscribers
36
+ #
37
+ # @see https://developers.mailerlite.com/docs/search-for-subscribers
38
+ #
39
+ # @param query [String] Search query
40
+ # @param options [Hash] A customizable set of options.
41
+ # @option options [Integer] :offset
42
+ # @option options [Integer] :limit
43
+ # @option options [Boolean] :minimized
44
+ #
45
+ # @return [Array] Response from API.
46
+ def search_subscribers(query, options = {})
47
+ options[:query] = query
48
+ connection.get('subscribers/search', options)
22
49
  end
23
50
 
24
- def delete_subscriber(list_id, email)
25
- connection.delete("subscribers/#{list_id}/", email: email)
51
+ # Get groups subscriber belongs to
52
+ #
53
+ # @see https://developers.mailerlite.com/docs/groups-subscriber-belongs-to
54
+ #
55
+ # @param identifier [Integer,String] ID or email of subscriber.
56
+ #
57
+ # @return [Array] Response from API.
58
+ def subscriber_groups(identifier)
59
+ connection.get("subscribers/#{identifier}/groups")
26
60
  end
27
61
 
28
- def unsubscribe_subscriber(email)
29
- connection.post('subscribers/unsubscribe/', email: email)
62
+ # Get activity (clicks, opens, etc) of selected subscriber
63
+ #
64
+ # @see https://developers.mailerlite.com/docs/activity-of-single-subscriber
65
+ #
66
+ # @param identifier [Integer,String] ID or email of subscriber.
67
+ #
68
+ # @return [Array] Response from API.
69
+ def subscriber_activities(identifier)
70
+ connection.get("subscribers/#{identifier}/activity")
30
71
  end
72
+ alias subscriber_activity subscriber_activities
31
73
  end
32
74
  end
33
75
  end
@@ -1,20 +1,27 @@
1
1
  module MailerLite
2
2
  # A class responsible for all configurations.
3
3
  class Configuration
4
- # Default API endpoint
5
- API_ENDPOINT = 'https://app.mailerlite.com/api/v1'.freeze
4
+ # Default API endpoint.
5
+ API_ENDPOINT = 'https://api.mailerlite.com/api/v2'.freeze
6
6
 
7
- # Default User Agent header string
7
+ # Default User Agent header string.
8
8
  USER_AGENT = "MailerLite Ruby v#{MailerLite::VERSION}".freeze
9
9
 
10
10
  attr_accessor :api_key
11
+ attr_writer :url, :user_agent
11
12
 
13
+ # Takes url provided from configuration or uses default one.
14
+ #
15
+ # @return [String] An API Endpoint url which will be used for connection.
12
16
  def url
13
- API_ENDPOINT
17
+ @url || API_ENDPOINT
14
18
  end
15
19
 
20
+ # Takes user agent from configuration or uses default one.
21
+ #
22
+ # @return [String] User agent which will be used for connection headers.
16
23
  def user_agent
17
- USER_AGENT
24
+ @user_agent || USER_AGENT
18
25
  end
19
26
  end
20
27
  end
@@ -4,6 +4,7 @@ require 'json'
4
4
 
5
5
  require 'mailerlite/middleware/raise_error'
6
6
  require 'mailerlite/middleware/underscore_keys'
7
+ require 'mailerlite/middleware/fix_unparsed_json'
7
8
 
8
9
  module MailerLite
9
10
  # A class responsible for connecting to MailerLite API and making requests.
@@ -18,29 +19,26 @@ module MailerLite
18
19
  request(:get, path, options).body
19
20
  end
20
21
 
21
- def delete(path, options = {})
22
- request(:delete, path, options).body
22
+ def put(path, options = {})
23
+ request(:put, path, {}, options).body
23
24
  end
24
25
 
25
26
  def post(path, options = {})
26
- options['apiKey'] = client.config.api_key
27
-
28
- response = connection.post do |req|
29
- req.url(path)
30
- req.headers['Content-Type'] = 'application/json'
31
- req.body = options.to_json
32
- end
27
+ request(:post, path, {}, options).body
28
+ end
33
29
 
34
- response.body
30
+ def delete(path, options = {})
31
+ request(:delete, path, options).body
35
32
  end
36
33
 
37
34
  private
38
35
 
39
- def request(method, path, options = {})
40
- options['apiKey'] = client.config.api_key
41
-
36
+ def request(method, path, query_params = {}, body_params = {})
42
37
  response = connection.send(method) do |request|
43
- request.url(path, options)
38
+ request.url(path, query_params)
39
+ request.headers['Content-Type'] = 'application/json'
40
+ request.headers['X-MailerLite-ApiKey'] = client.config.api_key
41
+ request.body = body_params.to_json
44
42
  end
45
43
 
46
44
  response
@@ -64,6 +62,7 @@ module MailerLite
64
62
  builder.use FaradayMiddleware::Mashify
65
63
  builder.use MailerLite::Middleware::UnderscoreKeys
66
64
  builder.use FaradayMiddleware::ParseJson
65
+ builder.use MailerLite::Middleware::FixUnparsedJson
67
66
  builder.use MailerLite::Middleware::RaiseError
68
67
 
69
68
  builder.adapter Faraday.default_adapter
@@ -1,20 +1,21 @@
1
1
  module MailerLite
2
2
  # Base MailerLite error.
3
3
  class Error < StandardError
4
- # Returns the appropriate MailerLite::Error sublcass based
5
- # on status and response message.
4
+ # Returns the appropriate MailerLite::Error sublcass based on status and
5
+ # response message.
6
6
  #
7
- # response - The Hash of HTTP response.
7
+ # @param response [Hash] HTTP response.
8
8
  #
9
- # Returns the MailerLite::Error.
9
+ # @return [MailerLite::Error]
10
10
  def self.from_response(response)
11
11
  status = response[:status].to_i
12
12
 
13
13
  klass = case status
14
- when 400 then MailerLite::BadRequest
15
- when 401 then MailerLite::Unauthorized
16
- when 404 then MailerLite::NotFound
17
- end
14
+ when 400 then MailerLite::BadRequest
15
+ when 401 then MailerLite::Unauthorized
16
+ when 404 then MailerLite::NotFound
17
+ when 500 then MailerLite::InternalServerError
18
+ end
18
19
 
19
20
  klass.new if klass
20
21
  end
@@ -22,6 +23,7 @@ module MailerLite
22
23
 
23
24
  # Raised when MailerLite returns a 400 HTTP status code
24
25
  class BadRequest < Error
26
+ # Default error message.
25
27
  def to_s
26
28
  'Missing a required parameter or calling invalid method'
27
29
  end
@@ -29,6 +31,7 @@ module MailerLite
29
31
 
30
32
  # Raised when MailerLite returns a 401 HTTP status code
31
33
  class Unauthorized < Error
34
+ # Default error message.
32
35
  def to_s
33
36
  'Invalid API key provided'
34
37
  end
@@ -36,8 +39,17 @@ module MailerLite
36
39
 
37
40
  # Raised when MailerLite returns a 404 HTTP status code
38
41
  class NotFound < Error
42
+ # Default error message.
39
43
  def to_s
40
44
  "Can't find requested items"
41
45
  end
42
46
  end
47
+
48
+ # Raised when MailerLite returns a 500 HTTP status code
49
+ class InternalServerError < Error
50
+ # Default error message.
51
+ def to_s
52
+ 'The server encountered an unexpected condition'
53
+ end
54
+ end
43
55
  end
@@ -0,0 +1,12 @@
1
+ module MailerLite
2
+ module Middleware
3
+ # This middleware will convert empty response to {}
4
+ class FixUnparsedJson < Faraday::Response::Middleware
5
+ private
6
+
7
+ def on_complete(response)
8
+ response[:body] = {} if response[:body] == ''
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,4 @@
1
1
  module MailerLite
2
- VERSION = '0.3.0'.freeze
2
+ # @return [String] Version number.
3
+ VERSION = '1.0.0'.freeze
3
4
  end
data/mailerlite.gemspec CHANGED
@@ -29,5 +29,4 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_development_dependency 'bundler', '~> 1.11'
31
31
  spec.add_development_dependency 'rake', '~> 10.0'
32
- spec.add_development_dependency 'rspec', '~> 3.4'
33
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailerlite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justas Palumickas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-18 00:00:00.000000000 Z
11
+ date: 2016-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '10.0'
83
- - !ruby/object:Gem::Dependency
84
- name: rspec
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.4'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '3.4'
97
83
  description: Ruby gem for MailerLite API
98
84
  email:
99
85
  - jpalumickas@gmail.com
@@ -102,7 +88,9 @@ extensions: []
102
88
  extra_rdoc_files: []
103
89
  files:
104
90
  - ".gitignore"
91
+ - ".hound.yml"
105
92
  - ".rspec"
93
+ - ".rubocop.yml"
106
94
  - ".travis.yml"
107
95
  - CONTRIBUTING.md
108
96
  - Gemfile
@@ -112,16 +100,17 @@ files:
112
100
  - bin/console
113
101
  - bin/setup
114
102
  - examples/authentication.md
115
- - examples/campaigns.md
116
103
  - lib/mailerlite.rb
117
104
  - lib/mailerlite/client.rb
118
105
  - lib/mailerlite/clients/campaigns.rb
119
- - lib/mailerlite/clients/lists.rb
106
+ - lib/mailerlite/clients/fields.rb
107
+ - lib/mailerlite/clients/groups.rb
120
108
  - lib/mailerlite/clients/subscribers.rb
121
109
  - lib/mailerlite/configuration.rb
122
110
  - lib/mailerlite/connection.rb
123
111
  - lib/mailerlite/core_ext/string.rb
124
112
  - lib/mailerlite/error.rb
113
+ - lib/mailerlite/middleware/fix_unparsed_json.rb
125
114
  - lib/mailerlite/middleware/raise_error.rb
126
115
  - lib/mailerlite/middleware/underscore_keys.rb
127
116
  - lib/mailerlite/version.rb
@@ -146,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
135
  version: '0'
147
136
  requirements: []
148
137
  rubyforge_project:
149
- rubygems_version: 2.6.3
138
+ rubygems_version: 2.5.1
150
139
  signing_key:
151
140
  specification_version: 4
152
141
  summary: Ruby wrapper for MailerLite API
@@ -1,62 +0,0 @@
1
- # Campaigns
2
-
3
- ## Get all campaigns
4
-
5
- Returns all campaigns you have in your account.
6
- Also basic summary for each campaign including the ID.
7
-
8
- #### Example:
9
-
10
- ```ruby
11
- client.campaigns
12
- ```
13
-
14
- You can specify **limit** and **page** options:
15
-
16
- ```ruby
17
- client.campaings(limit: 200, page: 2)
18
- ```
19
-
20
- ## Campaign details
21
-
22
- Retrieve stats about selected campaign with specified ID.
23
-
24
- #### Example:
25
-
26
- ```ruby
27
- campaign_id = 123
28
- client.campaign(campaign_id)
29
- ```
30
-
31
- ## Campaign recipients
32
-
33
- Retrieves a paged result representing all the subscribers that a given campaign was sent to.
34
-
35
- #### Example:
36
-
37
- ```ruby
38
- client.campaign_recipients(123)
39
- ```
40
-
41
- You can specify **limit** and **page** options:
42
-
43
- ```ruby
44
- client.campaing_recipients(123, limit: 200, page: 2)
45
- ```
46
-
47
-
48
- ## Campaign opens
49
-
50
- Retrieves a paged result representing all the subscribers that opened a given campaign.
51
-
52
- #### Example:
53
-
54
- ```ruby
55
- client.campaign_opens(123)
56
- ```
57
-
58
- You can specify **limit** and **page** options:
59
-
60
- ```ruby
61
- client.campaing_opens(123, limit: 200, page: 2)
62
- ```
@@ -1,41 +0,0 @@
1
- module MailerLite
2
- module Clients
3
- # Get information about MailerLite Lists.
4
- #
5
- # You can official documentation at
6
- # https://docs.mailerlite.com/pages/lists
7
- module Lists
8
- def lists(options = {})
9
- connection.get('lists/', options)
10
- end
11
-
12
- def list(id)
13
- connection.get("lists/#{id}/")
14
- end
15
-
16
- def create_list(name)
17
- connection.post('lists/', name: name)
18
- end
19
-
20
- def update_list(id, name)
21
- connection.post("lists/#{id}/", name: name)
22
- end
23
-
24
- def delete_list(id)
25
- connection.delete("lists/#{id}/")
26
- end
27
-
28
- def list_active_subscribers(id, options = {})
29
- connection.get("lists/#{id}/active/", options)
30
- end
31
-
32
- def list_unsubscribed_subscribers(id, options = {})
33
- connection.get("lists/#{id}/unsubscribed/", options)
34
- end
35
-
36
- def list_bounced_subscribers(id, options = {})
37
- connection.get("lists/#{id}/bounced/", options)
38
- end
39
- end
40
- end
41
- end