adn 0.3.7 → 0.3.8

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: 1b76bc2d8bb0dbd16f14658a2f62f2c0e85aacb8
4
- data.tar.gz: e347e0817b8494b9ee63f15c63635221ba196e86
3
+ metadata.gz: 518aadf5ddcdc8511065efd631cdba5b7116be0a
4
+ data.tar.gz: b7216d37b02ff2cf0b745edfd9a3a7b080dba61e
5
5
  SHA512:
6
- metadata.gz: f833b54adb6692f0ad6872d63ba2dbcbf0b01c204851d9670f83da23913004c336fe5068750a1189be5a7a754e876135b43871d29178f83e6fff5138b3329085
7
- data.tar.gz: 2ac0643e86d7166ed3ec9f57c243523931cad2fca878fcf0963c8cc1690235faa4a24c40e04edb2a9d84a928c3835af6687dc83b508afcbe6c8aceed5d3195f5
6
+ metadata.gz: 0c44e509395ec3b2288f1fa6e812d71c13c76ccaf55a4c49eda585ad0d57f9cabba6741116c03efc5ffb5c52719a3cb3bc883a7377d4db24567f3ad2fd8ba8b7
7
+ data.tar.gz: d30456cc7394ea2c5b017ce1a7bf36a671fb9a4282e56b5daba732cb10d31f05f2cbc2e9f0113859931dc09671e3549985e975033b72447890b094c7e67d4b91
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ### Changelog
2
2
 
3
+ * **Version 0.3.8** (31 December 2013)
4
+ * Removed all style violations (cane --no-doc)
5
+ * Added files to broadcast builder
3
6
  * **Version 0.3.7** (15 December 2013)
4
7
  * Recipes now use the builder pattern
5
8
  * Basic file functionality
@@ -7,14 +10,14 @@
7
10
  * Added recipe for easy broadcast creation
8
11
  * **Version 0.3.5** (23 October 2012)
9
12
  * Added the unified stream
10
- * **Version 0.3.1** (28 August 2012)
13
+ * **Version 0.3.1** (28 August 2012)
11
14
  * Fixed naming conflict.
12
- * **Version 0.3** (28 August 2012)
13
- * Now includes a Post class that describes each post along with a bunch of new methods of accessing a post's replies and the post's original post.
14
- * Users methods that return user details (follow, unfollow, following, followers, mute, unmute, mute_list) will now return either a User object back, or an array of User objects.
15
- * Similarly, User methods that return post details (posts, mentions, stream) will return a Post object, or an array of Post objects.
16
- * To accomplish all this, I've had to change the module structure which will break existing code if you've relied on the modules to access any data. Basically, all modules begin with ADN::API:: now (eg. ADN::API::Post, ADN::API::User).
17
- * **Version 0.2** (27 August 2012)
15
+ * **Version 0.3** (28 August 2012)
16
+ * Now includes a Post class that describes each post along with a bunch of new methods of accessing a post's replies and the post's original post.
17
+ * Users methods that return user details (follow, unfollow, following, followers, mute, unmute, mute_list) will now return either a User object back, or an array of User objects.
18
+ * Similarly, User methods that return post details (posts, mentions, stream) will return a Post object, or an array of Post objects.
19
+ * To accomplish all this, I've had to change the module structure which will break existing code if you've relied on the modules to access any data. Basically, all modules begin with ADN::API:: now (eg. ADN::API::Post, ADN::API::User).
20
+ * **Version 0.2** (27 August 2012)
18
21
  * Changed all existing classes to modules and introduced the User class for easily accessing user details.
19
- * **Version 0.1** (26 August 2012)
22
+ * **Version 0.1** (26 August 2012)
20
23
  * Really basic functionality for all existing App.new API methods as per the spec.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- adn (0.3.7)
4
+ adn (0.3.8)
5
5
  mime-types (~> 2.0)
6
6
  multipart-post (~> 1.2.0)
7
7
 
data/lib/adn.rb CHANGED
@@ -27,7 +27,7 @@ require 'uri'
27
27
  require 'json'
28
28
  require 'date'
29
29
 
30
- %w{constants api message post user version recipes}.each do |f|
30
+ %w{constants api file message post user version recipes}.each do |f|
31
31
  require_relative "adn/#{f}"
32
32
  end
33
33
 
data/lib/adn/api/file.rb CHANGED
@@ -6,11 +6,17 @@ module ADN
6
6
  module API
7
7
  module File
8
8
  def self.create(filename, params)
9
+ string_io = StringIO.new(params.to_json)
10
+
11
+ content = UploadIO.new(filename, MIME::Types.type_for(filename)[0])
12
+ metadata = UploadIO.new(string_io, "application/json", "data")
13
+
9
14
  http_params = {
10
- "content" => UploadIO.new(filename, MIME::Types.type_for(filename)[0]),
15
+ "content" => content,
11
16
  # make a fake file so we can still pass json
12
- "metadata" => UploadIO.new(StringIO.new(params.to_json), "application/json", "data"),
17
+ "metadata" => metadata
13
18
  }
19
+
14
20
  ADN::API.post_multipart("#{ADN::API_ENDPOINT_FILES}", http_params)
15
21
  end
16
22
 
@@ -4,11 +4,15 @@ module ADN
4
4
  module API
5
5
  module Message
6
6
  def self.create(channel_id, params)
7
- ADN::API.post("#{ADN::API_ENDPOINT_CHANNELS}/#{channel_id}/messages", params)
7
+ path = "/#{channel_id}/messages"
8
+
9
+ ADN::API.post(ADN::API_ENDPOINT_CHANNELS + path, params)
8
10
  end
9
11
 
10
12
  def self.retrieve(channel_id, message_id)
11
- ADN::API.get("#{ADN::API_ENDPOINT_CHANNELS}/#{channel_id}/messages/#{message_id}")
13
+ path = "/#{channel_id}/messages/#{message_id}"
14
+
15
+ ADN::API.get(ADN::API_ENDPOINT_CHANNELS + path)
12
16
  end
13
17
 
14
18
  def self.by_id(channel_id, message_id)
@@ -16,7 +20,9 @@ module ADN
16
20
  end
17
21
 
18
22
  def self.delete(channel_id, message_id)
19
- ADN::API.delete("#{ADN::API_ENDPOINT_CHANNELS}/#{channel_id}/messages/#{message_id}")
23
+ path = "/#{channel_id}/messages/#{message_id}"
24
+
25
+ ADN::API.delete(ADN::API_ENDPOINT_CHANNELS + path)
20
26
  end
21
27
  end
22
28
  end
@@ -6,7 +6,9 @@ module ADN
6
6
  module API
7
7
  class Response < SimpleDelegator
8
8
  def has_error?
9
- self['meta'].nil? || self['meta']['code'].nil? || self['meta']['code'] >= HTTP_ERROR
9
+ self['meta'].nil? ||
10
+ self['meta']['code'].nil? ||
11
+ self['meta']['code'] >= HTTP_ERROR
10
12
  end
11
13
 
12
14
  def error_message
data/lib/adn/file.rb CHANGED
@@ -2,10 +2,9 @@
2
2
 
3
3
  module ADN
4
4
  class File
5
- attr_accessor(
6
- :id, :file_id, :file_token, :sha1, :name, :source, :url, :kind, :total_size,
7
- :url_expires, :size, :type, :public, :mime_type, :complete
8
- )
5
+ attr_accessor :id, :file_id, :file_token, :sha1, :name, :source,
6
+ :url, :kind, :total_size, :url_expires, :size,
7
+ :type, :public, :mime_type, :complete
9
8
 
10
9
  attr_writer :user, :created_at
11
10
 
data/lib/adn/message.rb CHANGED
@@ -26,9 +26,14 @@ module ADN
26
26
  set_values(raw_message)
27
27
  message_id = id
28
28
 
29
- if raw_message.length == 2 and raw_message.key? :id and raw_message.key? :channel_id
30
- # If we only have the bare minimum data, assume we want to get values from the server
29
+ if raw_message.length == 2 and
30
+ raw_message.key? :id and
31
+ raw_message.key? :channel_id
32
+
33
+ # If we only have the bare minimum data,
34
+ # assume we want to get values from the server
31
35
  message_details = details
36
+
32
37
  if message_details.has_key? "data"
33
38
  set_values(message_details["data"])
34
39
  end
@@ -36,11 +41,13 @@ module ADN
36
41
  end
37
42
 
38
43
  def details
39
- # if we have a source, then we've loaded stuff from the server
44
+ # if we have a source, then we've loaded
45
+ # stuff from the server
40
46
  if source
41
47
  value = self.instance_variables.map do |i|
42
48
  [i.to_s.slice(1..-1), self.instance_variable_get(i)]
43
49
  end
50
+
44
51
  Hash[value]
45
52
  else
46
53
  ADN::API::Message.by_id(channel_id, message_id)
@@ -61,7 +68,9 @@ module ADN
61
68
  end
62
69
 
63
70
  def set_values(values)
64
- values.each_pair { |k, v| send("#{k}=", v) if respond_to?("#{k}=") }
71
+ values.each_pair do |k, v|
72
+ send("#{k}=", v) if respond_to?("#{k}=")
73
+ end
65
74
  end
66
75
  end
67
76
  end
@@ -3,14 +3,16 @@
3
3
  module ADN
4
4
  module Recipes
5
5
  class BroadcastMessageBuilder
6
- attr_accessor(
7
- :headline, :text, :read_more_link, :channel_id, :parse_links, :parse_markdown_links, :photo, :attachment
8
- )
6
+ attr_accessor :headline, :text, :read_more_link, :channel_id,
7
+ :parse_links, :parse_markdown_links, :photo, :attachment
9
8
 
10
9
  def initialize(params = {})
11
10
  if params.respond_to? :each_pair
12
- params.each_pair { |k, v| send("#{k}=", v) if respond_to?("#{k}=") }
11
+ params.each_pair do |k, v|
12
+ send("#{k}=", v) if respond_to?("#{k}=")
13
+ end
13
14
  end
15
+
14
16
  yield self if block_given?
15
17
  end
16
18
 
@@ -33,23 +35,68 @@ module ADN
33
35
  }
34
36
  end
35
37
 
38
+ if self.photo
39
+ file = ADN::File.upload_file(self.photo, {
40
+ type: 'net.app.adnrb.upload'
41
+ })
42
+
43
+
44
+ annotations << {
45
+ type: 'net.app.core.oembed',
46
+ value: {
47
+ "+net.app.core.file" => {
48
+ file_id: file.id,
49
+ file_token: file.file_token,
50
+ format: 'oembed',
51
+ }
52
+ }
53
+ }
54
+ end
55
+
56
+ if self.attachment
57
+ file = ADN::File.upload_file(self.attachment, {
58
+ type: 'net.app.adnrb.upload'
59
+ })
60
+
61
+ annotations << {
62
+ type: 'net.app.core.attachments',
63
+ value: {
64
+ "+net.app.core.file_list" => [
65
+ {
66
+ file_id: file.id,
67
+ file_token: file.file_token,
68
+ format: 'metadata',
69
+ }
70
+ ]
71
+ }
72
+ }
73
+ end
74
+
36
75
  annotations
37
76
  end
38
77
 
39
78
  def message
40
- {
79
+ message = {
41
80
  annotations: self.annotations,
42
- text: self.text,
43
- machine_only: (not self.text),
44
81
  entities: {
45
- parse_links: (self.parse_links or self.parse_markdown_links),
82
+ parse_links: !!(self.parse_links or self.parse_markdown_links),
46
83
  parse_markdown_links: !!self.parse_markdown_links
47
84
  }
48
85
  }
86
+
87
+ if self.text
88
+ message[:text] = self.text
89
+ else
90
+ message[:machine_only] = true
91
+ end
92
+
93
+ message
49
94
  end
50
95
 
51
96
  def send
52
- Message.new ADN::API::Message.create(self.channel_id, self.message)["data"]
97
+ api_message = ADN::API::Message.create(self.channel_id, self.message)
98
+
99
+ Message.new api_message["data"]
53
100
  end
54
101
  end
55
102
  end
data/lib/adn/version.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module ADN
4
4
  MAJOR = 0
5
5
  MINOR = 3
6
- TINY = 7
6
+ TINY = 8
7
7
  VERSION = [MAJOR, MINOR, TINY].join('.')
8
8
  end
9
9
 
@@ -6,17 +6,25 @@ describe ADN::API::File do
6
6
  subject { ADN::API::File }
7
7
 
8
8
  let(:base_path) { '/stream/0/files' }
9
- let(:error_message) {
10
- 'Call requires authentication: This view requires authentication and no token was provided.'
11
- }
12
9
 
13
- let(:error_response) {
14
- OpenStruct.new(:body => %Q{ { "meta" : {
15
- "code" : 401,
16
- "error_id" : "6f5137beac6c4b9ea8dbec8e50aa9f38$32a85f1c22e98de98ea2ddabaf76c5ae",
17
- "error_message" : "#{error_message}"
18
- }} })
19
- }
10
+ let(:error_id) do
11
+ '6f5137beac6c4b9ea8dbec8e50aa9f38$32a85f1c22e98de98ea2ddabaf76c5ae'
12
+ end
13
+
14
+ let(:error_message) do
15
+ 'Call requires authentication: This view requires' +
16
+ ' authentication and no token was provided.'
17
+ end
18
+
19
+ let(:error_response) do
20
+ OpenStruct.new(:body => %Q{ {
21
+ "meta" : {
22
+ "code" : 401,
23
+ "error_id" : "#{error_id}",
24
+ "error_message" : "#{error_message}"
25
+ }}
26
+ })
27
+ end
20
28
 
21
29
  describe "new" do
22
30
  it "passes the file content in params to the API" do
@@ -27,6 +35,7 @@ describe ADN::API::File do
27
35
  params["content"].local_path.must_equal __FILE__
28
36
  params["content"].content_type.must_equal "application/x-ruby"
29
37
  params["metadata"].content_type.must_equal "application/json"
38
+
30
39
  JSON.parse(params["metadata"].read).must_equal({"type" => 'foo'})
31
40
  }
32
41
  end
@@ -6,16 +6,24 @@ describe ADN::API::Message do
6
6
  subject { ADN::API::Message }
7
7
 
8
8
  let(:base_path) { '/stream/0/channels' }
9
- let(:error_message) {
10
- 'Call requires authentication: This view requires authentication and no token was provided.'
11
- }
9
+
10
+ let(:error_id) do
11
+ '6f5137beac6c4b9ea8dbec8e50aa9f38$32a85f1c22e98de98ea2ddabaf76c5ae'
12
+ end
13
+
14
+ let(:error_message) do
15
+ 'Call requires authentication: This view requires' +
16
+ ' authentication and no token was provided.'
17
+ end
12
18
 
13
19
  let(:error_response) {
14
- OpenStruct.new(:body => %Q{ { "meta" : {
15
- "code" : 401,
16
- "error_id" : "6f5137beac6c4b9ea8dbec8e50aa9f38$32a85f1c22e98de98ea2ddabaf76c5ae",
17
- "error_message" : "#{error_message}"
18
- }} })
20
+ OpenStruct.new(:body =>
21
+ %Q{ { "meta" : {
22
+ "code" : 401,
23
+ "error_id" : "#{error_id}",
24
+ "error_message" : "#{error_message}"
25
+ }}
26
+ })
19
27
  }
20
28
 
21
29
  describe "new" do
@@ -41,7 +49,9 @@ describe ADN::API::Message do
41
49
 
42
50
  describe "retrieve" do
43
51
  it "retrieves the message" do
44
- arg(:get) { subject.retrieve(8, 22).must_equal base_path + "/8/messages/22" }
52
+ arg(:get) {
53
+ subject.retrieve(8, 22).must_equal base_path + "/8/messages/22"
54
+ }
45
55
  end
46
56
  end
47
57
 
@@ -55,7 +65,9 @@ describe ADN::API::Message do
55
65
 
56
66
  describe "delete" do
57
67
  it "deletes the message" do
58
- arg(:delete) { subject.delete(5, 77).must_equal base_path + "/5/messages/77" }
68
+ arg(:delete) {
69
+ subject.delete(5, 77).must_equal base_path + "/5/messages/77"
70
+ }
59
71
  end
60
72
  end
61
73
  end
@@ -6,12 +6,25 @@ describe ADN::API::Post do
6
6
  subject { ADN::API::Post }
7
7
 
8
8
  let(:base_path) { '/stream/0/posts' }
9
- let(:error_message) {'Call requires authentication: This view requires authentication and no token was provided.'}
10
- let(:error_response) { OpenStruct.new(:body => %Q{ { "meta" : {
11
- "code" : 401,
12
- "error_id" : "6f5137beac6c4b9ea8dbec8e50aa9f38$32a85f1c22e98de98ea2ddabaf76c5ae",
13
- "error_message" : "#{error_message}"
14
- }} }) }
9
+
10
+ let(:error_message) do
11
+ 'Call requires authentication: This view requires' +
12
+ ' authentication and no token was provided.'
13
+ end
14
+
15
+ let(:error_id) do
16
+ "6f5137beac6c4b9ea8dbec8e50aa9f38$32a85f1c22e98de98ea2ddabaf76c5ae"
17
+ end
18
+
19
+ let(:error_response) do
20
+ OpenStruct.new(:body => %Q{ {
21
+ "meta" : {
22
+ "code" : 401,
23
+ "error_id" : "#{error_id}",
24
+ "error_message" : "#{error_message}"
25
+ }}
26
+ })
27
+ end
15
28
 
16
29
  describe "new" do
17
30
  it "posts the passed in params to the API" do
@@ -32,12 +45,13 @@ describe ADN::API::Post do
32
45
  error.message.must_equal error_message
33
46
  end
34
47
  end
35
-
36
48
  end
37
49
 
38
50
  describe "retrieve" do
39
51
  it "retrieves the post" do
40
- arg(:get) { subject.retrieve(22).must_equal base_path + "/22" }
52
+ arg(:get) {
53
+ subject.retrieve(22).must_equal base_path + "/22"
54
+ }
41
55
  end
42
56
  end
43
57
 
@@ -51,7 +65,9 @@ describe ADN::API::Post do
51
65
 
52
66
  describe "delete" do
53
67
  it "deletes the post" do
54
- arg(:delete) { subject.delete(77).must_equal base_path + "/77" }
68
+ arg(:delete) {
69
+ subject.delete(77).must_equal base_path + "/77"
70
+ }
55
71
  end
56
72
  end
57
73
 
@@ -57,8 +57,22 @@ describe ADN::File do
57
57
  describe "details" do
58
58
  it "returns the details for the file" do
59
59
  file.details.keys.must_equal [
60
- "created_at", "id", "user", "file_token", "sha1", "name", "source", "url", "kind", "total_size",
61
- "url_expires", "size", "type", "public", "mime_type", "complete"
60
+ "created_at",
61
+ "id",
62
+ "user",
63
+ "file_token",
64
+ "sha1",
65
+ "name",
66
+ "source",
67
+ "url",
68
+ "kind",
69
+ "total_size",
70
+ "url_expires",
71
+ "size",
72
+ "type",
73
+ "public",
74
+ "mime_type",
75
+ "complete"
62
76
  ]
63
77
  end
64
78
  end
@@ -9,11 +9,27 @@ end
9
9
  describe ADN::Message do
10
10
  subject { ADN::Message }
11
11
 
12
- let(:empty_message) { subject.new({}) }
13
- let(:message_with_id) { subject.new({ channel_id: '456', message_id: '123' }) }
14
- let(:msg) { subject.new(message_data) }
12
+ let(:empty_message) do
13
+ subject.new({})
14
+ end
15
+
16
+ let(:message_with_id) do
17
+ subject.new({
18
+ channel_id: '456',
19
+ message_id: '123'
20
+ })
21
+ end
22
+
23
+ let(:msg) do
24
+ subject.new(message_data)
25
+ end
26
+
27
+ let(:example_user) do
28
+ {
29
+ username: 'peterhellberg'
30
+ }
31
+ end
15
32
 
16
- let(:example_user) { { username: 'peterhellberg' } }
17
33
  let(:message_data) {
18
34
  {
19
35
  created_at: '1999-12-31T23:59:59Z',
@@ -32,7 +48,9 @@ describe ADN::Message do
32
48
 
33
49
  describe "send_message" do
34
50
  it "creates a message via the API" do
35
- ADN::API::Message.stub(:create, ADN::API::Response.new(d(message_data))) do
51
+ api_response = ADN::API::Response.new(d(message_data))
52
+
53
+ ADN::API::Message.stub(:create, api_response) do
36
54
  m = subject.send_message({})
37
55
  m.text.must_equal 'The sky above the port…'
38
56
  end
@@ -47,7 +65,9 @@ describe ADN::Message do
47
65
 
48
66
  # TODO: Change this behavior (Add a find method instead)
49
67
  it "populates the accessors based on the passed in id" do
50
- ADN::API::Message.stub(:by_id, ->(c_id, i){ d({ "text" => 'bar'}) }) do
68
+ by_id = ->(c_id, i){ d({ "text" => 'bar'}) }
69
+
70
+ ADN::API::Message.stub(:by_id, by_id) do
51
71
  m = subject.new id: 123, channel_id: 456
52
72
  m.text.must_equal 'bar'
53
73
  end
@@ -64,10 +84,15 @@ describe ADN::Message do
64
84
  end
65
85
 
66
86
  it "returns the message from the api if it has no id" do
67
-
68
- ADN::API::Message.stub(:by_id, ->(c_id, i){ d({ "id" => i, "channel_id" => c_id}) }) do
69
- message_with_id.details.
70
- must_equal({ "data" => { "id" => '123', "channel_id" => '456' } })
87
+ by_id = ->(c_id, i){ d({ "id" => i, "channel_id" => c_id}) }
88
+
89
+ ADN::API::Message.stub(:by_id, by_id) do
90
+ message_with_id.details.must_equal({
91
+ "data" => {
92
+ "id" => '123',
93
+ "channel_id" => '456'
94
+ }
95
+ })
71
96
  end
72
97
  end
73
98
  end
@@ -87,7 +112,10 @@ describe ADN::Message do
87
112
  describe "delete" do
88
113
  it "deletes the message via the API and returns the message" do
89
114
  delete_stub = ->(c_id, id){
90
- ADN::API::Response.new("data" => { "channel_id" => c_id, "id" => id })
115
+ ADN::API::Response.new("data" => {
116
+ "channel_id" => c_id,
117
+ "id" => id
118
+ })
91
119
  }
92
120
 
93
121
  ADN::API::Message.stub(:delete, delete_stub) do
@@ -34,6 +34,68 @@ describe ADN::Recipes::BroadcastMessageBuilder do
34
34
  ])
35
35
  end
36
36
  end
37
+
38
+ describe "with a photo" do
39
+ it "generates an oembed annotation" do
40
+ api_response = ADN::API::Response.new({
41
+ "data" => {
42
+ id: "1",
43
+ file_token: "1234"
44
+ }
45
+ })
46
+
47
+ ADN::API::File.stub(:create, api_response) do
48
+ subject.headline = "foo"
49
+ subject.photo = "foo.jpg"
50
+ subject.annotations.must_equal([
51
+ {
52
+ type: "net.app.core.broadcast.message.metadata",
53
+ value: { subject: "foo" }
54
+ },
55
+ {
56
+ type: "net.app.core.oembed",
57
+ value: { "+net.app.core.file" => {
58
+ file_id: "1",
59
+ file_token: "1234",
60
+ format: "oembed"
61
+ }}
62
+ }
63
+ ])
64
+ end
65
+ end
66
+ end
67
+
68
+ describe "with an attachment" do
69
+ it "generates an attachment annotation" do
70
+ api_response = ADN::API::Response.new({
71
+ "data" => {
72
+ id: "1",
73
+ file_token: "1234"
74
+ }
75
+ })
76
+
77
+ ADN::API::File.stub(:create, api_response) do
78
+ subject.headline = "foo"
79
+ subject.attachment = "foo.txt"
80
+ subject.annotations.must_equal([
81
+ {
82
+ type: "net.app.core.broadcast.message.metadata",
83
+ value: { subject: "foo" }
84
+ },
85
+ {
86
+ type: "net.app.core.attachments",
87
+ value: { "+net.app.core.file_list" => [
88
+ {
89
+ file_id: "1",
90
+ file_token: "1234",
91
+ format: "metadata"
92
+ }
93
+ ]}
94
+ }
95
+ ])
96
+ end
97
+ end
98
+ end
37
99
  end
38
100
 
39
101
  describe "message" do
@@ -42,7 +104,7 @@ describe ADN::Recipes::BroadcastMessageBuilder do
42
104
  subject.headline = "foo"
43
105
  subject.text = "bar"
44
106
  subject.message[:text].must_equal("bar")
45
- subject.message[:machine_only].must_equal(false)
107
+ subject.message[:machine_only].must_equal(nil)
46
108
  end
47
109
  end
48
110
 
@@ -52,6 +114,7 @@ describe ADN::Recipes::BroadcastMessageBuilder do
52
114
  subject.message[:text].must_be_nil
53
115
  subject.message[:machine_only].must_equal(true)
54
116
  end
117
+
55
118
  it "includes the annotations" do
56
119
  subject.headline = "bar"
57
120
  subject.message[:annotations].must_equal([
@@ -100,6 +163,7 @@ describe ADN::Recipes::BroadcastMessageBuilder do
100
163
  "channel_id": "#{channel_id}"
101
164
  }
102
165
  }}
166
+
103
167
  response = OpenStruct.new(:body => response_body)
104
168
 
105
169
  ADN::HTTP.stub(:request, response) do
data/spec/adn_spec.rb CHANGED
@@ -19,7 +19,7 @@ describe ADN do
19
19
  ADN::API_HOST.must_equal 'alpha-api.app.net'
20
20
  end
21
21
 
22
- it "has constants containing the API endpoints for posts, users, channels, and files" do
22
+ it "has constants for the API endpoints posts, users, channels, and files" do
23
23
  ADN::API_ENDPOINT_POSTS.must_equal '/stream/0/posts'
24
24
  ADN::API_ENDPOINT_USERS.must_equal '/stream/0/users'
25
25
  ADN::API_ENDPOINT_CHANNELS.must_equal '/stream/0/channels'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kishyr Ramdial
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-12-15 00:00:00.000000000 Z
13
+ date: 2013-12-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multipart-post