patient_zero 0.5.0 → 0.5.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d49fd07bcd3e866faa256583f312e87355d168bd
|
4
|
+
data.tar.gz: 250cae91773b9306b66b2f5ed7a78ab91d3f6c97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ae97e94c882a4de4e9e8496804e6dfc2e142a8a3b080cf73c7257ee1c36adae843e03fcaa8a6344d3a4e8db4d8c5f82220f1cf4fb8d5c064cd2dcd4543bbc13
|
7
|
+
data.tar.gz: aeab5f6d030dfa727dfccbd8242c758fd5b435511d1cf8c6c2c2501c13f80672bfde8640f31a02beeef9520a95595a446fe88e6de060b05b0e07a5f19a808243
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module PatientZero
|
2
|
+
module Monitoring
|
3
|
+
class Twitter
|
4
|
+
include Client
|
5
|
+
|
6
|
+
VALID_DAYS = [1,7,30]
|
7
|
+
attr_reader :profile_id, :days
|
8
|
+
|
9
|
+
def initialize profile_id:, days: nil
|
10
|
+
@profile_id = profile_id
|
11
|
+
@days = set_to_valid_days days
|
12
|
+
end
|
13
|
+
|
14
|
+
def top_cities
|
15
|
+
statistical_data['top_cities']
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def set_to_valid_days days
|
21
|
+
VALID_DAYS.fetch(VALID_DAYS.index(days) || VALID_DAYS.index(30))
|
22
|
+
end
|
23
|
+
|
24
|
+
def statistical_data
|
25
|
+
@statistical_data ||= get '/social/api/monitoring/twitter/stats', api_key: PatientZero.api_key,
|
26
|
+
profile_id: profile_id,
|
27
|
+
days: days
|
28
|
+
@statistical_data['stats']
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'patient_zero/monitoring/twitter'
|
data/lib/patient_zero/version.rb
CHANGED
data/lib/patient_zero.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
module PatientZero
|
2
|
+
module Monitoring
|
3
|
+
describe Twitter do
|
4
|
+
let(:profile_id) { 1 }
|
5
|
+
let(:days) { 1 }
|
6
|
+
let(:twitter_object) { Twitter.new(profile_id: profile_id, days: days) }
|
7
|
+
let(:twitter_response) { { 'top_cities' => { 'San Diego' => 121212 } } }
|
8
|
+
let(:twitter_response_with_body) { response_with_body stats: twitter_response }
|
9
|
+
|
10
|
+
describe '#initialize' do
|
11
|
+
it 'news up an object' do
|
12
|
+
expect(twitter_object).to be_a Twitter
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'invalid days' do
|
16
|
+
let(:days) { 2 }
|
17
|
+
it 'sets default days of 30 for invalid days' do
|
18
|
+
expect(twitter_object.days).to eql 30
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#top_cities' do
|
24
|
+
before { allow(Twitter.connection).to receive(:get).with('/social/api/monitoring/twitter/stats', anything) { twitter_response_with_body } }
|
25
|
+
it 'returns the top cities' do
|
26
|
+
expect(twitter_object.top_cities).to eql twitter_response['top_cities']
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Zaninovich
|
@@ -138,6 +138,8 @@ files:
|
|
138
138
|
- lib/patient_zero/message/facebook.rb
|
139
139
|
- lib/patient_zero/message/instagram.rb
|
140
140
|
- lib/patient_zero/message/twitter.rb
|
141
|
+
- lib/patient_zero/monitoring.rb
|
142
|
+
- lib/patient_zero/monitoring/twitter.rb
|
141
143
|
- lib/patient_zero/organization.rb
|
142
144
|
- lib/patient_zero/profile.rb
|
143
145
|
- lib/patient_zero/source.rb
|
@@ -154,6 +156,7 @@ files:
|
|
154
156
|
- spec/patient_zero/message/instagram_spec.rb
|
155
157
|
- spec/patient_zero/message/twitter_spec.rb
|
156
158
|
- spec/patient_zero/message_spec.rb
|
159
|
+
- spec/patient_zero/monitoring/twitter_spec.rb
|
157
160
|
- spec/patient_zero/organization_spec.rb
|
158
161
|
- spec/patient_zero/profile_spec.rb
|
159
162
|
- spec/patient_zero/source_spec.rb
|
@@ -178,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
181
|
version: '0'
|
179
182
|
requirements: []
|
180
183
|
rubyforge_project:
|
181
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.4.5
|
182
185
|
signing_key:
|
183
186
|
specification_version: 4
|
184
187
|
summary: A gem to use the Viral Heat API
|
@@ -194,6 +197,7 @@ test_files:
|
|
194
197
|
- spec/patient_zero/message/instagram_spec.rb
|
195
198
|
- spec/patient_zero/message/twitter_spec.rb
|
196
199
|
- spec/patient_zero/message_spec.rb
|
200
|
+
- spec/patient_zero/monitoring/twitter_spec.rb
|
197
201
|
- spec/patient_zero/organization_spec.rb
|
198
202
|
- spec/patient_zero/profile_spec.rb
|
199
203
|
- spec/patient_zero/source_spec.rb
|