mailchimp_api 1.0.0.pre.0 → 1.0.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb99723d02a7f76f16621524c27aab231833eb8b1f06f5d44377809a6d3dbccd
4
- data.tar.gz: e0cd26d1801ba7a088e711cfccce24b9508667b6f657ed131e472c99b3a744c8
3
+ metadata.gz: c8d245b2405f92b674684d1ac51f0839db53b404e2c03e15ec2a6e83a0c74d6d
4
+ data.tar.gz: 3a10cd629ef44a525ed053870fe25b0ff670df6059e77fd0125d06d3b8145a1e
5
5
  SHA512:
6
- metadata.gz: 359bcaa56a36af4145627b393ead3442179e700c746f91191890f27a2c9d293b9cd758103b90e814d46a4d577a18f266a94cdb8bba482b0931f89de16d47f430
7
- data.tar.gz: bdffffb268459ac74b5c5c22adb25cb20d17f0f12746fb9209684aff41063d57e79db5c61618e1cd49add201d4abeccfe5bbe3b9d039c0d9b7e670831cedee91
6
+ metadata.gz: '01941110419582f86cb09c13fa5e7828cef92decd1c9ffa0f4e4205ca3c0f4e76a3eee6f71f7fdd4f2e943bffe7d6f1f9d6eb6bac1be9e0e95c55284378b14d8'
7
+ data.tar.gz: e59b628296e0fb9521a80f29d8c619b49384c3a6a6ff5b7be1b6c0226f2349abdafdfa9a6bb9875ed4eb93600f1d5d104bf1f62d3ba4f8040964724a7cd088b4
data/CHANGELOG.md CHANGED
@@ -5,4 +5,5 @@
5
5
  ### Added
6
6
  - Support of `/`
7
7
  - Support of `/lists`
8
+ - Support of '/lists/<id>/interest-categories'
8
9
  - `.count` support
data/README.md CHANGED
@@ -45,7 +45,13 @@ account.with_mailchimp_session { MailchimpAPI::List.all }
45
45
 
46
46
  ## Development
47
47
 
48
- After checking out the repository, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
+ After checking out the repository, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
49
+
50
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment. You can create a file in the root of the project called `dev-config.yml` and add your API key to it:
51
+ ```
52
+ api_key: <your-api-key>
53
+ ```
54
+ This will tell the console to pre-authenticate the Mailchimp session, making it easier to test.
49
55
 
50
56
  ## Contributing
51
57
 
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MailchimpAPI::CollectionParsers
4
+ class InterestCategory < Base
5
+ protected
6
+
7
+ def element_key
8
+ 'categories'
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MailchimpAPI
4
+ class InterestCategory < Base
5
+ extend MailchimpAPI::Support::Countable
6
+
7
+ self.collection_parser = CollectionParsers::InterestCategory
8
+
9
+ self.prefix = '/3.0/lists/:list_id/'
10
+ self.element_name = 'interest-category'
11
+ self.collection_name = 'interest-categories'
12
+
13
+ protected
14
+
15
+ # Overridden - This resource only accepts updates via PATCH requests, not standard ActiveResource PUT requests
16
+ def update
17
+ run_callbacks :update do
18
+ connection.patch(element_path(prefix_options), encode, self.class.headers).tap do |response|
19
+ load_attributes_from_response(response)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -5,5 +5,7 @@ module MailchimpAPI
5
5
  extend MailchimpAPI::Support::Countable
6
6
 
7
7
  self.collection_parser = CollectionParsers::List
8
+
9
+ has_many :interest_categories, class_name: 'MailchimpAPI::InterestCategory'
8
10
  end
9
11
  end
@@ -2,8 +2,10 @@
2
2
 
3
3
  module MailchimpAPI::Support
4
4
  module Countable
5
- def count
6
- all(params: { fields: 'total_items', count: 0 }).total_items
5
+ def count(params = {})
6
+ all_params = params.deep_merge(params: { fields: 'total_items', count: 0 })
7
+
8
+ all(all_params).total_items
7
9
  end
8
10
  end
9
11
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MailchimpAPI
4
- VERSION = '1.0.0.pre.0'
4
+ VERSION = '1.0.0.pre.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailchimp_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.0
4
+ version: 1.0.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - rewind.io
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-22 00:00:00.000000000 Z
11
+ date: 2019-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -178,6 +178,7 @@ files:
178
178
  - lib/mailchimp_api.rb
179
179
  - lib/mailchimp_api/collection_parsers.rb
180
180
  - lib/mailchimp_api/collection_parsers/base.rb
181
+ - lib/mailchimp_api/collection_parsers/interest_category.rb
181
182
  - lib/mailchimp_api/collection_parsers/link.rb
182
183
  - lib/mailchimp_api/collection_parsers/list.rb
183
184
  - lib/mailchimp_api/configuration.rb
@@ -188,6 +189,7 @@ files:
188
189
  - lib/mailchimp_api/resources.rb
189
190
  - lib/mailchimp_api/resources/account_information.rb
190
191
  - lib/mailchimp_api/resources/base.rb
192
+ - lib/mailchimp_api/resources/interest_category.rb
191
193
  - lib/mailchimp_api/resources/link.rb
192
194
  - lib/mailchimp_api/resources/list.rb
193
195
  - lib/mailchimp_api/resources/support/countable.rb