mailchimp_api_v3 0.0.8 → 0.0.9

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: 463b5715b8ca2923efd8eb8575ca8179929caf6d
4
- data.tar.gz: d34a2023fa0fcf9cd1dc0bb9c81b40c4ed1429ad
3
+ metadata.gz: 4c1376959bbf12d3dd6d2b66f5f62d65c31b497a
4
+ data.tar.gz: 9ba4d57d1ae8da47f06aea84e01c17afc0e75e6d
5
5
  SHA512:
6
- metadata.gz: cc6bfd5203a5daa249d6ce42ef1278f9e2d881e2b5a45497a4faa08c943099a05a1c342bc98b3698049eff5188b4715315559a2b1abedc03ba5c969c866f4f37
7
- data.tar.gz: b3e97220a895b9505e8730118f07502c090647143da541b1368bfec2ea0f9cb1df08ca8cbe86969194a399b41bf52e568001038258edbd7667a80fef61748f0f
6
+ metadata.gz: 77b72cce05b1c2fd59f64b8853055a61114b25b15229b4a486320ef2feb52bac86e359c8c4b0678d367fc44f3e95487498bbefed86e7dab0fe188bf7d3aba6cd
7
+ data.tar.gz: 43fa198702a8dbd22cb0c0e1fd26cf86a4a2874463b49135eda4368f087ce1a4a7f0ceda1e0377c233148d7e7860b20e1faf1acf3d1d0c4ba51a422857be2629
@@ -1,5 +1,15 @@
1
1
  require 'mailchimp_api_v3/version'
2
+ require 'mailchimp_api_v3/collection/paging'
3
+ require 'mailchimp_api_v3/collection'
4
+ require 'mailchimp_api_v3/instance'
5
+ require 'mailchimp_api_v3/exception'
6
+ require 'mailchimp_api_v3/client/remote'
2
7
  require 'mailchimp_api_v3/client'
8
+ require 'mailchimp_api_v3/account'
9
+ require 'mailchimp_api_v3/list'
10
+ require 'mailchimp_api_v3/member'
11
+ require 'mailchimp_api_v3/interest_category'
12
+ require 'mailchimp_api_v3/interest'
3
13
 
4
14
  module Mailchimp
5
15
  def self.connect(api_key = nil)
@@ -1,12 +1,5 @@
1
- require 'mailchimp_api_v3/collection'
2
- require 'mailchimp_api_v3/instance'
3
- require 'mailchimp_api_v3/exception'
4
- require 'mailchimp_api_v3/account'
5
- require 'mailchimp_api_v3/list'
6
- require 'mailchimp_api_v3/client/remote'
7
-
8
1
  module Mailchimp
9
- class Client
2
+ class Client < Instance
10
3
  include Remote
11
4
 
12
5
  def account
@@ -14,7 +7,8 @@ module Mailchimp
14
7
  end
15
8
 
16
9
  def lists(filter = {})
17
- data = filter.is_a?(String) ? { name: filter.dup } : filter.dup
10
+ raw_data = filter.respond_to?(:dup) ? filter.dup : filter
11
+ data = raw_data.is_a?(String) ? { name: raw_data } : raw_data
18
12
  lists = Lists.new(self)
19
13
  data.empty? ? lists : lists.find_by(data)
20
14
  end
@@ -2,7 +2,7 @@ require 'yaml'
2
2
  require 'restclient'
3
3
 
4
4
  module Mailchimp
5
- class Client
5
+ class Client < Instance
6
6
  module Remote
7
7
  def get(path = '', options = {})
8
8
  managed_remote path, :get, options
@@ -1,6 +1,5 @@
1
1
  module Mailchimp
2
2
  class Collection < Array
3
- require 'mailchimp_api_v3/collection/paging' # Don't require before class inherits from Array
4
3
  include Paging
5
4
 
6
5
  def initialize(client, parent_path = '', options = {})
@@ -1,5 +1,5 @@
1
1
  module Mailchimp
2
- class Collection
2
+ class Collection < Array
3
3
  module Paging
4
4
  DEFAULT_PAGE_SIZE = 500
5
5
 
@@ -1,8 +1,11 @@
1
1
  module Mailchimp
2
2
  class List
3
3
  class InterestCategory < Instance
4
- require 'mailchimp_api_v3/interest_category/subclasses'
5
- include Subclasses
4
+ #- VALID_TYPES = %w(checkboxes dropdown radio hidden)
5
+
6
+ def interests(options = {})
7
+ subclass_from Interests, options
8
+ end
6
9
  end
7
10
 
8
11
  class InterestCategories < Collection
@@ -1,7 +1,17 @@
1
1
  module Mailchimp
2
2
  class List < Instance
3
- require 'mailchimp_api_v3/list/subclasses'
4
- include Subclasses
3
+ def members(options = {})
4
+ # Turn an email into an id
5
+ if options.is_a?(String) && (options =~ /\A[^@]+@[^@]+\z/)
6
+ options = OpenSSL::Digest.digest('MD5', options).unpack('H*').first
7
+ end
8
+
9
+ subclass_from Members, options
10
+ end
11
+
12
+ def interest_categories(options = {})
13
+ subclass_from InterestCategories, options
14
+ end
5
15
 
6
16
  def id_and_name
7
17
  "#{id}___#{name}"
@@ -1,3 +1,3 @@
1
1
  module Mailchimp
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailchimp_api_v3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xenapto
@@ -231,9 +231,7 @@ files:
231
231
  - lib/mailchimp_api_v3/instance.rb
232
232
  - lib/mailchimp_api_v3/interest.rb
233
233
  - lib/mailchimp_api_v3/interest_category.rb
234
- - lib/mailchimp_api_v3/interest_category/subclasses.rb
235
234
  - lib/mailchimp_api_v3/list.rb
236
- - lib/mailchimp_api_v3/list/subclasses.rb
237
235
  - lib/mailchimp_api_v3/member.rb
238
236
  - lib/mailchimp_api_v3/version.rb
239
237
  - mailchimp_api_v3.gemspec
@@ -1,14 +0,0 @@
1
- require 'mailchimp_api_v3/interest'
2
-
3
- module Mailchimp
4
- class List
5
- class InterestCategory
6
- module Subclasses
7
- #- VALID_TYPES = %w(checkboxes dropdown radio hidden)
8
- def interests(options = {})
9
- subclass_from Interests, options
10
- end
11
- end
12
- end
13
- end
14
- end
@@ -1,21 +0,0 @@
1
- require 'mailchimp_api_v3/member'
2
- require 'mailchimp_api_v3/interest_category'
3
-
4
- module Mailchimp
5
- class List
6
- module Subclasses
7
- def members(options = {})
8
- # Turn an email into an id
9
- if options.is_a?(String) && (options =~ /\A[^@]+@[^@]+\z/)
10
- options = OpenSSL::Digest.digest('MD5', options).unpack('H*').first
11
- end
12
-
13
- subclass_from Members, options
14
- end
15
-
16
- def interest_categories(options = {})
17
- subclass_from InterestCategories, options
18
- end
19
- end
20
- end
21
- end