device_cloud 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,6 +21,11 @@ module DeviceCloud
21
21
  raise NotImplementedError
22
22
  end
23
23
 
24
+ def file_name
25
+ return '' unless id
26
+ id['fdName']
27
+ end
28
+
24
29
  def mac_address
25
30
  return '' unless device_id.size > 0
26
31
  device_id.sub(/\Am:/, '').scan(/.{2}|.+/).join(':')
@@ -1,15 +1,5 @@
1
1
  module DeviceCloud
2
2
  class PushNotification::DataNotification < PushNotification::BaseNotification
3
- def initialize(file_data)
4
- @file_data = file_data
5
- @id = data['id']
6
- end
7
-
8
- def file_name
9
- return '' unless id
10
- id['fdName']
11
- end
12
-
13
3
  def handle!
14
4
  DeviceCloud.data_notification_handler.call(self)
15
5
  end
@@ -1,3 +1,3 @@
1
1
  module DeviceCloud
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -29,6 +29,10 @@ describe DeviceCloud::PushNotification::BaseNotification do
29
29
  its(:value) { should eq data['value'] }
30
30
  end
31
31
 
32
+ describe "#data" do
33
+ its(:data) { should eq file_data.data }
34
+ end
35
+
32
36
  describe "#handle!" do
33
37
  it "should raise NotImplementedError" do
34
38
  expect{subject.handle!}.to raise_error NotImplementedError
@@ -48,4 +52,17 @@ describe DeviceCloud::PushNotification::BaseNotification do
48
52
  its(:mac_address) { should eq '' }
49
53
  end
50
54
  end
55
+
56
+ describe "#file_name" do
57
+ context 'when id is present' do
58
+ its(:file_name) { should eq data['id']['fdName']}
59
+ end
60
+
61
+ context 'when id is nil' do
62
+ before(:each) do
63
+ data['id'] = nil
64
+ end
65
+ its(:file_name) { should eq '' }
66
+ end
67
+ end
51
68
  end
@@ -27,17 +27,4 @@ describe DeviceCloud::PushNotification::DataNotification do
27
27
  expect(handled_data).to eq subject
28
28
  end
29
29
  end
30
-
31
- describe "#file_name" do
32
- context 'when id is present' do
33
- its(:file_name) { should eq data['id']['fdName']}
34
- end
35
-
36
- context 'when id is nil' do
37
- before(:each) do
38
- data['id'] = nil
39
- end
40
- its(:file_name) { should eq '' }
41
- end
42
- end
43
30
  end
data/spec/version_spec.rb CHANGED
@@ -2,6 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe 'DeviceCloud::VERSION' do
4
4
  it 'should be the correct version' do
5
- DeviceCloud::VERSION.should == '0.0.8'
5
+ DeviceCloud::VERSION.should == '0.0.9'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: device_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: