device_cloud 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,10 @@
1
1
  module DeviceCloud
2
2
  class PushNotification::DataNotification < PushNotification::BaseNotification
3
+
4
+ def raw_data
5
+ @file_data.fdData
6
+ end
7
+
3
8
  def handle!
4
9
  DeviceCloud.data_notification_handler.call(self)
5
10
  end
@@ -51,7 +51,7 @@ module DeviceCloud
51
51
  end
52
52
 
53
53
  def unencoded_data
54
- @unencode_data ||= Base64.decode64(fdData)
54
+ @unencoded_data ||= Base64.decode64(fdData)
55
55
  end
56
56
 
57
57
  def validate_content!
@@ -1,3 +1,3 @@
1
1
  module DeviceCloud
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -1,19 +1,24 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe DeviceCloud::PushNotification::DataNotification do
4
- let(:data) do
4
+ let(:raw_file_data) do
5
5
  {
6
- 'id' => {
7
- 'fdPath' => '/db/MadGlory/Meter/data/',
8
- 'fdName' => 'foobar_1.jpg'
6
+ "id" => {
7
+ "fdPath" => " /db/4044_MadGlory_Interactive/00000000-00000000-001395FF-FF0E6012/alert/",
8
+ "fdName" => "foo-0966595cdcdd11e2abf50013950e6012.json"
9
9
  },
10
- 'device_id' => 'm:1392301029',
11
- 'type' => 'some type',
12
- 'queued_dt' => '2013-06-24T14:52:55.421Z',
13
- 'value' => {'this' => 'is a value'}
10
+ "fdLastModifiedDate" => "2013-06-24T14:52:55.421Z",
11
+ "fdSize" => 156,
12
+ "fdContentType" => "application/json",
13
+ "fdData" => "eyJ2YWx1ZSI6IHt9LCAiY2xhc3MiOiAiYWxlcnQiLCAicXVldWVkX2R0IjogIjIwMTMtMDYtMjRUMTQ6NDc6NDdaIiwgInR5cGUiOiAiZm9vIiwgImlkIjogIjA5NjY1OTVjZGNkZDExZTJhYmY1MDAxMzk1MGU2MDEyIiwgImRldmljZV9pZCI6ICJtOjAwMTM5NTBFNjAxMiJ9",
14
+ "fdArchive" => false,
15
+ "cstId" => 4044,
16
+ "fdType" => "file",
17
+ "fdCreatedDate" => "2013-06-24T14:52:55.421Z"
14
18
  }
15
19
  end
16
- let(:file_data) { OpenStruct.new(data: data, full_path: '/foo/bar/baz.json') }
20
+
21
+ let(:file_data) { DeviceCloud::PushNotification::Message::FileData.new raw_file_data }
17
22
 
18
23
  subject { DeviceCloud::PushNotification::DataNotification.new file_data }
19
24
 
@@ -27,4 +32,8 @@ describe DeviceCloud::PushNotification::DataNotification do
27
32
  expect(handled_data).to eq subject
28
33
  end
29
34
  end
35
+
36
+ describe "#raw_data" do
37
+ its(:raw_data) { should eq raw_file_data['fdData'] }
38
+ end
30
39
  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.10'
5
+ DeviceCloud::VERSION.should == '0.0.11'
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.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: