patient_zero 0.5.9 → 0.5.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/patient_zero/source.rb +7 -0
- data/lib/patient_zero/version.rb +1 -1
- data/spec/patient_zero/source_spec.rb +31 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6458eedbb788f4f62cebcbdfd1c8db0b86d47d9c
|
4
|
+
data.tar.gz: c89a6ad61673fd8852f76996da09f29f622765d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4049f075c1fef5120c9527a9d7aaae02f20f1f8df5d54b8991a46adf10c2538c85e5cfe1a5f0e9ed3ec0b55bc33364defeb5d3a6bb19b50e8a569fd27f713b9
|
7
|
+
data.tar.gz: 08612800f3f93b1bcd3e2c9c829b204f3bf7add55b23f2f2760a767f044f6db2b9c371585449807d46e17392cbe090a08ce5138d4b94510d8ec24cee2c6a8dee
|
data/lib/patient_zero/source.rb
CHANGED
@@ -51,6 +51,13 @@ module PatientZero
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
+
def children
|
55
|
+
response = get '/mobile/api/v1/sources/linked_sources', social_object_uid: id, client_token: token
|
56
|
+
response['linked_sources'].map do |source_attributes|
|
57
|
+
Source.new(source_attributes.merge 'token' => token) unless source_attributes["id"] == id
|
58
|
+
end.compact
|
59
|
+
end
|
60
|
+
|
54
61
|
def analytics start_date: nil, end_date: nil
|
55
62
|
@analytics ||= {}
|
56
63
|
@analytics["#{start_date}#{end_date}"] ||= Analytics.for_platform platform, token: token, source_id: id, start_date: start_date, end_date: end_date
|
data/lib/patient_zero/version.rb
CHANGED
@@ -81,7 +81,7 @@ module PatientZero
|
|
81
81
|
end
|
82
82
|
context 'when using an invalid platform name' do
|
83
83
|
let(:platform) { 'myspace' }
|
84
|
-
let(:url) { '
|
84
|
+
let(:url) { 'https://app.viralheat.com?error=Invalid platform Myspace' }
|
85
85
|
it 'raises an InvalidPlatformError' do
|
86
86
|
expect{Source.creation_url platform, token, 678}.to raise_error InvalidPlatformError
|
87
87
|
end
|
@@ -119,6 +119,36 @@ module PatientZero
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
+
describe '#children' do
|
123
|
+
let(:sources) do
|
124
|
+
[ {'id'=> id,
|
125
|
+
'name' => 'account_name',
|
126
|
+
'is_invalid' => false,
|
127
|
+
'is_tracked' => true,
|
128
|
+
'platform' => 'facebook',
|
129
|
+
'delete_id' => id },
|
130
|
+
{'id'=> 'source_id',
|
131
|
+
'name' => 'account_page',
|
132
|
+
'is_invalid' => false,
|
133
|
+
'is_tracked' => true,
|
134
|
+
'platform' => 'facebook',
|
135
|
+
'delete_id' => id } ]
|
136
|
+
end
|
137
|
+
let(:children_response) { response_with_body linked_sources: sources }
|
138
|
+
before{ allow(Source.connection).to receive(:get).with('/mobile/api/v1/sources/linked_sources', anything).and_return children_response }
|
139
|
+
context 'when the source has children' do
|
140
|
+
it 'returns an array of sources that does not contain itself' do
|
141
|
+
expect(source.children.count).to be 1
|
142
|
+
end
|
143
|
+
end
|
144
|
+
context 'when the source has no children' do
|
145
|
+
let(:sources) { [] }
|
146
|
+
it 'returns an empty array' do
|
147
|
+
expect(source.children).to be_empty
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
122
152
|
describe '#analytics' do
|
123
153
|
it 'calls Analytics.for_platorm to create an analytics object' do
|
124
154
|
expect(Analytics).to receive(:for_platform).with(source.platform, { token: source.token, source_id: source.id, start_date: nil, end_date: nil })
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: patient_zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Zaninovich
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-05-
|
12
|
+
date: 2015-05-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|