fanswatch 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c40f565b10a049a3fb8cf63845f5daa3f924119f
4
- data.tar.gz: 066952f2876c793a3c2cc283132170a302e69aa2
3
+ metadata.gz: 1e3637b918747c94553b75f4d9a57aa6e5e6b04e
4
+ data.tar.gz: c56ee9df0e9ef5728ed83751c83539d170f3e7b2
5
5
  SHA512:
6
- metadata.gz: 998449f6533d69fe92700d28747369cfb6e067c7ec8ecec45340fee60e94159bcdfe056fdc4f13e35295515472fd1a2147b8ac2b61fa87cae5291ed17b0a167a
7
- data.tar.gz: c7b823f582febb6066c0b5d4fb55ec942cda3589810a80a413f41f5154032bff05bea81d173280980ddd1cd5be60d093a1aac37944b2f532e41b7ab91b85ded7
6
+ metadata.gz: 11c00ee81bf709d61ea5d6c88f713b8e5f80c1f119f7a2049f7e5dd5ff2ec60dad038511933aced09982b04a09a50d34dbc0f2e3d46855d3298660bd981fc03a
7
+ data.tar.gz: 34e2afcfa01de3148f3d93cf34b76c67d426b0e6c1633c2c5b28a977b514545fbd9e8cf6bc17cd07058d3bb375aa6c79bb4a3b5c1a8c2ee6c6a9cec298fbcad0
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  config/
2
- spec/fixtures
2
+ spec/fixtures/cassettes
3
+ spec/fixtures/fb_response.yml
3
4
  Gemfile.lock
4
5
  coverage/
5
6
  *.gem
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.1
4
+ branches:
5
+ only:
6
+ - master
7
+ script: bundle exec rake spec
8
+
data/Rakefile CHANGED
@@ -1,3 +1,30 @@
1
+ # frozen_string_literal: true
2
+ require 'rake/testtask'
3
+
4
+ task default: :spec
5
+
6
+ namespace :credentials do
7
+ require 'yaml'
8
+
9
+ desc 'generate access_token to STDOUT'
10
+ task :get_access_token do
11
+ credentials = YAML.load(File.read('config/credentials.yml'))
12
+ require_relative 'lib/fanswatch/fb_api'
13
+ ENV['FBAPI_CLIENT_ID'] = credentials[:client_id]
14
+ ENV['FBAPI_CLIENT_SECRET'] = credentials[:client_secret]
15
+
16
+ puts "Access Token: #{FansWatch::FbApi.access_token}"
17
+ end
18
+
19
+ desc 'Export sample credentials from file to bash'
20
+ task :export do
21
+ credentials = YAML.load(File.read('config/credentials.yml'))
22
+ puts 'Please run the following in bash:'
23
+ puts "export FB_CLIENT_ID=#{credentials[:client_id]}"
24
+ puts "export FB_CLIENT_SECRET=#{credentials[:client_secret]}"
25
+ end
26
+ end
27
+
1
28
  desc 'run tests'
2
29
  task :spec do
3
30
  sh 'ruby spec/fanswatch_spec.rb'
@@ -1,7 +1,7 @@
1
1
  module FansWatch
2
2
  # Attached URL to Posting
3
3
  class Attachment
4
- attr_reader :description, :url
4
+ attr_reader :description, :url, :title, :image_url
5
5
 
6
6
  def initialize(data)
7
7
  return unless data
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FansWatch
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
@@ -0,0 +1,109 @@
1
+ ---
2
+ :page:
3
+ name: Inside 硬塞的網路趨勢觀察
4
+ id: '159425621565'
5
+ :feed:
6
+ - message: 關鍵在於這次 Airbnb Open 2016 房東大會發佈的新服務「Trips」,它到底是什麼?
7
+ created_time: '2016-11-18T14:05:00+0000'
8
+ id: '159425621565_10153830904546566'
9
+ - message: 硬體創新一向引人注目,這次硬體項目在 Meet Taipei 嘉年華也吸引了不少人氣,熱門相機 LUNA 360 的創辦人也帶著剛出爐的成品來到現場。
10
+ created_time: '2016-11-18T13:09:01+0000'
11
+ id: '159425621565_10153831143186566'
12
+ - message: Uber 是被罰怕了嗎?前幾天 Uber 亞太區總經理 Mike Brown 發布了公開信給總統蔡英文。
13
+ created_time: '2016-11-18T10:02:01+0000'
14
+ id: '159425621565_10153830965366566'
15
+ - message: IBM 靠的是雲端分析服務。在它們的設想中,未來醫護人員只需利用皮膚鏡拍攝一張病變患處的圖片並上傳到雲端分析服務中心,不久後就能獲得詳細的檢測報告。隨後,醫生只需詳細分析報告中的數據,就能判斷病人是否患了黑色素瘤。
16
+ created_time: '2016-11-18T09:20:00+0000'
17
+ id: '159425621565_10153830810446566'
18
+ - message: 如果成功,這 4425 顆 SpaceX 衛星可為全球每人提供最高達 1Gbps 的寬頻服務!
19
+ created_time: '2016-11-18T08:12:08+0000'
20
+ id: '159425621565_10153830753371566'
21
+ - message: 各位用 MAC 的同學,我們終於等到這一天了....
22
+ created_time: '2016-11-18T07:20:00+0000'
23
+ id: '159425621565_10153829065756566'
24
+ - message: 聽起來很酷,但想買這個自拍瓶?可能有點難。
25
+ created_time: '2016-11-18T06:25:06+0000'
26
+ id: '159425621565_10153830768716566'
27
+ - message: iPhone 的價格至少要漲 100 美元;但更可怕的是在那之後掀起的多邊貿易災難。
28
+ created_time: '2016-11-18T05:30:26+0000'
29
+ id: '159425621565_10153829052191566'
30
+ - message: 先別管郭董要不要選總統了,你知道鴻海被 APPLE 押著進美國嗎?
31
+ created_time: '2016-11-18T03:18:51+0000'
32
+ id: '159425621565_10153830554236566'
33
+ - message: "「為了人類的未來,我們必須進入太空。在不離開這個脆弱的星球的情況下,我不認為我們能活過下一個 1000 年。」"
34
+ created_time: '2016-11-18T02:40:01+0000'
35
+ id: '159425621565_10153829023716566'
36
+ - message: "【NextDrive】徵 軟體工程師\n\nNextDrive 聯齊科技是台灣備受矚目的新創團隊,專注於家庭與個人物聯網領域。成立二年多來獲國內外多項大獎肯定和媒體報導,包含經濟部商業司《IDEAS
37
+ Show》評審團大獎、日本《Fukuoka Global Venture Awards》優秀賞\U0001F44D\U0001F3FC。\n\n【免費刊登網路職缺】\U0001F449\U0001F3FBhttp://bit.ly/2ensyAK"
38
+ created_time: '2016-11-18T02:03:01+0000'
39
+ id: '159425621565_10153826405066566'
40
+ - message: |-
41
+ 但你覺得真有機會嗎?
42
+
43
+ udn.com 聯合新聞網授權轉載
44
+ created_time: '2016-11-18T01:02:00+0000'
45
+ id: '159425621565_10153826862566566'
46
+ - message: 中國的 30 個獨角獸中有多少公司真的值 10 億美元?可能有幾個。但問題是當別人看起來成功了的時候,跟風者會蜂擁而上。在美國如此,在中國可能更極端。
47
+ created_time: '2016-11-17T13:59:49+0000'
48
+ id: '159425621565_10153829001551566'
49
+ - message: Google Earth VR 採用了和 Google 地圖一樣的 3D 渲染技術,讓使用者盡情「環遊世界」。目前已收錄了來自地球 5 億平方公里的真實地貌和街景,使用者可以戴上
50
+ HTC Vive 遊覽世界上的任何一個角落。
51
+ created_time: '2016-11-17T13:03:00+0000'
52
+ id: '159425621565_10153828375386566'
53
+ - message: |-
54
+ 你覺得 Uber 投書給總統蔡英文合理嗎?大家來投票!
55
+
56
+ 破壞式創新還是國際犯罪集團?Uber 寫給蔡英文總統的一封信:https://www.inside.com.tw/2016/11/17/uber-taiwan-president
57
+ story: Inside 硬塞的網路趨勢觀察 was live.
58
+ created_time: '2016-11-17T11:38:39+0000'
59
+ id: '159425621565_10153828741046566'
60
+ - message: Uber 是被罰怕了嗎?就在剛剛 Uber 亞太區總經理 Mike Brown 發布了公開信給總統蔡英文。
61
+ created_time: '2016-11-17T09:11:10+0000'
62
+ id: '159425621565_10153828611896566'
63
+ - message: 但千萬不要小看這個「遊戲」,它是 Google 近期發佈的一系列的其中一個 AI 試驗工具。它實際上使用了神經網路算法對玩家的塗鴉進行判斷。Google
64
+ 試圖用它來研究怎麼讓 AI 自學圖像識別和光學字元辨識——這兩項都是 AI 領域的核心課題。
65
+ created_time: '2016-11-17T08:35:43+0000'
66
+ id: '159425621565_10153828576096566'
67
+ - message: 世界上加速最快的車現在又要變得更快了。
68
+ created_time: '2016-11-17T07:11:25+0000'
69
+ id: '159425621565_10153828333821566'
70
+ - message: 三大更新包括 Facebook 將組織一個數據計量委員會、新增第三方效益評估機制、建立「Metrics FYI」官方部落格,以便隨時更新他們在數據計量機制所做的任何更新。
71
+ created_time: '2016-11-17T06:13:39+0000'
72
+ id: '159425621565_10153828335616566'
73
+ - message: "「反向思考」反能揮出全壘打?"
74
+ created_time: '2016-11-17T06:02:00+0000'
75
+ id: '159425621565_10153826852391566'
76
+ - message: 微軟現在是 Linux 基金會的白金會員了。
77
+ created_time: '2016-11-17T05:03:00+0000'
78
+ id: '159425621565_10153828216696566'
79
+ - message: 病毒、釣魚內容、詐騙個資等惡意網站,還有內容農場的末日要到了嗎?
80
+ created_time: '2016-11-17T04:03:00+0000'
81
+ id: '159425621565_10153828145771566'
82
+ - message: 以往 Tinder 中只有「男/女」兩種性別,在這次改版後,Tinder 有了男、女和「更多」,並且這個「更多」允許使用者自行填寫,以表示自己的性別狀況。
83
+ created_time: '2016-11-17T02:52:08+0000'
84
+ id: '159425621565_10153828098276566'
85
+ - message: "【SimplyBridal】徵 Full Stack Developer\n\n美婚禮服飾電商正在尋找ㄧ位經驗豐富且具結果導向的全端工程師,我們理想的人選需協助我們向世界傳遞企業目標及品牌,
86
+ \ SimplyBridal 是一個成長快速的公司,期待與喜愛高步調工作環境且與我們攜手成長的專業人士工作\U0001F470\U0001F3FB。\n\n【更多關於SimplyBridal報導】\U0001F449\U0001F3FBhttp://bit.ly/2f3zLY6\n\n【免費刊登網路職缺】\U0001F449\U0001F3FBhttp://bit.ly/2ensyAK"
87
+ created_time: '2016-11-17T02:03:01+0000'
88
+ id: '159425621565_10153826418236566'
89
+ - message: 家中有老照片的你也快來試試吧!
90
+ created_time: '2016-11-17T01:01:00+0000'
91
+ id: '159425621565_10153827097771566'
92
+ :attachement:
93
+ data:
94
+ - description: Airbnb 執行長 Brian Chesky :「那些明信片的圖片允諾我們,旅行體驗會充滿神奇。但現實卻並非如此。」
95
+ media:
96
+ image:
97
+ height: 468
98
+ src: https://external.xx.fbcdn.net/safe_image.php?d=AQAeZgVqK7SzxQ8K&w=468&h=468&url=https%3A%2F%2Fwww.inside.com.tw%2Fwp-content%2Fuploads%2F2016%2F11%2Fmyhdvuf0d4pz8r09.jpg&cfs=1&sx=160&sy=0&sw=468&sh=468
99
+ width: 468
100
+ target:
101
+ url: https://www.facebook.com/l.php?u=https%3A%2F%2Fwww.inside.com.tw%2F2016%2F11%2F18%2Fairbnb-adds-local-tours-and-activities&h=GAQG-lCeM&s=1&enc=AZMCnqL51zoY81UmJT_lDk23Tpdxn-iOD6DPUAdFi0dzndd42GwETlb8WjQe2Qj_Lhg3iEQJh9Fj12Hr22W9IR6K
102
+ title: 顛覆旅館業後,Airbnb 把箭頭對準了旅行社和導遊們
103
+ type: share
104
+ url: https://www.facebook.com/l.php?u=https%3A%2F%2Fwww.inside.com.tw%2F2016%2F11%2F18%2Fairbnb-adds-local-tours-and-activities&h=GAQG-lCeM&s=1&enc=AZMCnqL51zoY81UmJT_lDk23Tpdxn-iOD6DPUAdFi0dzndd42GwETlb8WjQe2Qj_Lhg3iEQJh9Fj12Hr22W9IR6K
105
+ :posting:
106
+ :body: 關鍵在於這次 Airbnb Open 2016 房東大會發佈的新服務「Trips」,它到底是什麼?
107
+ :attached:
108
+ :description: Airbnb 執行長 Brian Chesky :「那些明信片的圖片允諾我們,旅行體驗會充滿神奇。但現實卻並非如此。」
109
+ :url: https://www.facebook.com/l.php?u=https%3A%2F%2Fwww.inside.com.tw%2F2016%2F11%2F18%2Fairbnb-adds-local-tours-and-activities&h=GAQG-lCeM&s=1&enc=AZMCnqL51zoY81UmJT_lDk23Tpdxn-iOD6DPUAdFi0dzndd42GwETlb8WjQe2Qj_Lhg3iEQJh9Fj12Hr22W9IR6K
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # frozen_string_literal: true
2
+ require 'codeclimate-test-reporter'
3
+ CodeClimate::TestReporter.start
1
4
  require 'simplecov'
2
5
  SimpleCov.start
3
6
 
@@ -12,8 +15,6 @@ require_relative '../lib/fanswatch'
12
15
  FIXTURES_FOLDER = 'spec/fixtures'
13
16
  CASSETTES_FOLDER = "#{FIXTURES_FOLDER}/cassettes"
14
17
  CASSETTE_FILE = 'facebook_api'
15
- RESULT_FILE = "#{FIXTURES_FOLDER}/results.yml"
16
- FB_RESULT = YAML.load(File.read(RESULT_FILE))
17
18
 
18
19
  if File.file?('config/credentials.yml')
19
20
  credentials = YAML.load(File.read('config/credentials.yml'))
@@ -23,6 +24,8 @@ if File.file?('config/credentials.yml')
23
24
  ENV['FB_PAGE_ID'] = credentials[:page_id]
24
25
  end
25
26
 
27
+ RESULT_FILE = "#{FIXTURES_FOLDER}/results.yml"
28
+ FB_RESULT = YAML.load(File.read(RESULT_FILE))
26
29
  INVALID_PAGE_ID = 'error_page_id'
27
30
 
28
31
  VCR.configure do |c|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanswatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wei-Tang Lin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-25 00:00:00.000000000 Z
11
+ date: 2016-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -173,6 +173,7 @@ extensions: []
173
173
  extra_rdoc_files: []
174
174
  files:
175
175
  - ".gitignore"
176
+ - ".travis.yml"
176
177
  - Gemfile
177
178
  - LICENSE
178
179
  - README.md
@@ -187,6 +188,7 @@ files:
187
188
  - lib/fanswatch/posting.rb
188
189
  - lib/fanswatch/version.rb
189
190
  - spec/fanswatch_spec.rb
191
+ - spec/fixtures/results.yml
190
192
  - spec/spec_helper.rb
191
193
  homepage: https://github.com/wtlin1228/FansWatch
192
194
  licenses:
@@ -214,4 +216,5 @@ specification_version: 4
214
216
  summary: Gets posted content from public Facebook fans pages
215
217
  test_files:
216
218
  - spec/fanswatch_spec.rb
219
+ - spec/fixtures/results.yml
217
220
  - spec/spec_helper.rb