contextio 1.3.0 → 1.4.0

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
  SHA1:
3
- metadata.gz: b00b94fad97d70ae4c006085a1dd661dcd7bf70f
4
- data.tar.gz: e8aea7852b0d9714c8eb9bb032f8d55d41ae5b37
3
+ metadata.gz: d5d62101124ebb89c46b9b7c61525f7d8feb9e36
4
+ data.tar.gz: 99bc1cf63255499a00fe0c960cd2e8d4bce16db0
5
5
  SHA512:
6
- metadata.gz: e5b1d6724a66c976d8e26378daf7a4afeb2bf77dd5929cdb60254a4ff63c694c8198c7551a7d6c129d481bb07d695a15c826485730851af15deb5adacd3195f9
7
- data.tar.gz: 1a00bca596c838351e970b6962c1fe1feb228ae1f1ccfa1c67fdc06e92afe34d6f287c9ed078f551dc56ecbd21c71877fdfd77ca0b61e784d5b2e051952e1e7e
6
+ metadata.gz: a76056315bfe9234e4a32b5c772e36049736026a34584174f570d423af63e7d16a7e3fe3af30d95a4158e63f380ea187e05fcc16375a6fdeacdf82bbf1c4b9e0
7
+ data.tar.gz: e60081fa6e7c590fdb79156c6d6bd93afc816bcc211d2e2984000b86cf471596d97c462e07c7fa3070e668ef9784098968f9d089bee92f3b1c955eac590207bd
data/CHANGES.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changes
2
2
 
3
+ ## 1.4.0
4
+
5
+ * Normalize key names from the API to be valid Ruby variable names. - Ben Hamill
6
+ * Fix how `Folder` objects create their associated `MessageCollection` objects,
7
+ specifically with respect to passing around the handle to an appropriate
8
+ `Account` object. - Ben Hamill
9
+ * Convenience methods: `Message#to`,`#bcc`, `#cc` and `#reply_to`. - Aubrey
10
+ Holland
11
+
3
12
  ## 1.3.0
4
13
 
5
14
  * Add sugar `Message#from` method. - Andrew Harrison
data/README.md CHANGED
@@ -133,6 +133,9 @@ likely to get in (or get in faster) the closer you stick to these steps:
133
133
  1. Turn the Issue into a Pull Request. There are several ways to do this, but
134
134
  [hub](https://github.com/defunkt/hub) is probably the easiest.
135
135
  1. Make sure your Pull Request includes tests.
136
+ 1. Bonus points if your Pull Request updates `CHANGES.md` to include a summary
137
+ of your changes and your name like the other entries. If the last entry is
138
+ the last release, add a new `## Unreleased` heading.
136
139
 
137
140
  If you don't know how to fix something, even just a Pull Request that includes a
138
141
  failing test can be helpful. If in doubt, make an Issue to discuss.
@@ -24,6 +24,8 @@ class ContextIO
24
24
  @message = options.delete(:message) || options.delete('message')
25
25
 
26
26
  options.each do |key, value|
27
+ key = key.to_s.gsub('-', '_')
28
+
27
29
  instance_variable_set("@#{key}", value)
28
30
 
29
31
  unless self.respond_to?(key)
@@ -24,6 +24,8 @@ class ContextIO
24
24
  @account = options.delete(:account) || options.delete('account')
25
25
 
26
26
  options.each do |key, value|
27
+ key = key.to_s.gsub('-', '_')
28
+
27
29
  instance_variable_set("@#{key}", value)
28
30
 
29
31
  unless self.respond_to?(key)
@@ -131,6 +131,8 @@ class ContextIO
131
131
  attr_hashes = api.request(:get, resource_url, 'email' => email, 'source_type' => source_type)
132
132
 
133
133
  attr_hashes.each do |key, value|
134
+ key = key.to_s.gsub('-', '_')
135
+
134
136
  instance_variable_set("@#{key}", value)
135
137
 
136
138
  unless respond_to?(key)
@@ -25,6 +25,8 @@ class ContextIO
25
25
  @source = options.delete(:source) || options.delete('source')
26
26
 
27
27
  options.each do |key, value|
28
+ key = key.to_s.gsub('-', '_')
29
+
28
30
  instance_variable_set("@#{key}", value)
29
31
 
30
32
  unless self.respond_to?(key)
@@ -50,7 +52,7 @@ class ContextIO
50
52
  def messages
51
53
  association_class = ContextIO::API::AssociationHelpers.class_for_association_name(:messages)
52
54
 
53
- @messages ||= association_class.new(api, folder: self)
55
+ @messages ||= association_class.new(api, account: source.account).where(folder: self.name)
54
56
  end
55
57
  end
56
58
  end
@@ -48,8 +48,10 @@ class ContextIO
48
48
  api.request(:get, "#{resource_url}/headers")
49
49
  end
50
50
 
51
- def from
52
- addresses['from']
51
+ %w(from to bcc cc reply_to).each do |f|
52
+ define_method(f) do
53
+ addresses[f]
54
+ end
53
55
  end
54
56
 
55
57
  def raw
@@ -41,6 +41,8 @@ class ContextIO
41
41
 
42
42
  if it_worked
43
43
  options.each do |key, value|
44
+ key = key.to_s.gsub('-', '_')
45
+
44
46
  instance_variable_set("@#{key}", value)
45
47
  end
46
48
  end
@@ -1,6 +1,6 @@
1
1
  class ContextIO
2
2
  # @private
3
- VERSION = "1.3.0"
3
+ VERSION = "1.4.0"
4
4
 
5
5
  # The gem version.
6
6
  #
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+ require 'contextio'
3
+
4
+ describe "A MessageCollection created from a Folder" do
5
+ let(:api) { double(:api) }
6
+ let(:source) { double(:source, account: 'account') }
7
+ let(:folder) { ContextIO::Folder.new(api, source: source) }
8
+ let(:message_collection) { folder.messages }
9
+
10
+ it "has a handle on the right account" do
11
+ expect(message_collection.account).to eq('account')
12
+ end
13
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contextio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Hamill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-05 00:00:00.000000000 Z
11
+ date: 2013-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth
@@ -190,6 +190,7 @@ files:
190
190
  - lib/contextio/webhook_collection.rb
191
191
  - spec/config.yml.example
192
192
  - spec/integration/accounts_messages_spec.rb
193
+ - spec/integration/folders_messages_spec.rb
193
194
  - spec/spec_helper.rb
194
195
  - spec/unit/contextio/account_collection_spec.rb
195
196
  - spec/unit/contextio/account_spec.rb
@@ -234,6 +235,7 @@ summary: Provides interface to Context.IO
234
235
  test_files:
235
236
  - spec/config.yml.example
236
237
  - spec/integration/accounts_messages_spec.rb
238
+ - spec/integration/folders_messages_spec.rb
237
239
  - spec/spec_helper.rb
238
240
  - spec/unit/contextio/account_collection_spec.rb
239
241
  - spec/unit/contextio/account_spec.rb