station 0.1.3 → 0.1.4

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
  SHA256:
3
- metadata.gz: 5926822fe8259f4fb2bd31b2793558f10c08e5ce1cf0695f42e616cd5241d88b
4
- data.tar.gz: 4b4c2d3445813f8947ab0716c9371a9619cfd535c0b71fe11b41f7e869001034
3
+ metadata.gz: e57cef8b99fc5de087836a46ab7a69c43ebeb3f1d28b9701a22c4bd2425718d6
4
+ data.tar.gz: 3f5ba033e140a2498c51e1422f31e421934cbf97f9deb988e50df54ef940713d
5
5
  SHA512:
6
- metadata.gz: db372d28208b5201b6d1a7626ec9054c5db1c219a9d6d1bb8b618d3427e73a8942ccc2c344053e5d7dd5874d44b9f4302980b22b91d160d2c9f2dfe17f16624b
7
- data.tar.gz: 16761f939f0feba10f6e96d56df8fc1600fed5561db30c283cc34482ff90176147fd5f82d17dd487007fc6627a3ee9cc0693fe1d3e67df43e7984a497e67c5e8
6
+ metadata.gz: 18c63b890a842b0633de6f326dc1520aeae33713525bd8068df29bc0c7abe8795dc0c84f241cb91450b59f8864a0cfa8a5e9d0f8d9f6091266c97cc1b04c2dc0
7
+ data.tar.gz: 7b7fb3dad1317994145a8d4648e7cc431801f5b068f8bda0cad602528ae48e14a87fbce840dbb4f6a62d866cc8e876a7a4f779186ffd449d96b3ca3cf9d8c9d1
@@ -3,8 +3,8 @@ class Blog::Blogpost
3
3
  :updated_at, :category, :tags, :link, :locale, :slug, :spotlight,
4
4
  :filename, :content, :header_img_url
5
5
 
6
- CLOUDFRONT_BLOG_URL = 'https://d226lax1qjow5r.cloudfront.net/blog/'.freeze
7
- DEFAULT_HEADER_IMG_URL = 'https://s3.eu-west-1.amazonaws.com/developer.vonage.com/vonage-logo-images/vonage-wide-logo.png'.freeze
6
+ CLOUDFRONT_BLOG_URL = 'https://d226lax1qjow5r.cloudfront.net/blog/'.freeze
7
+ DEFAULT_VONAGE_LOGO_URL = 'https://s3.eu-west-1.amazonaws.com/developer.vonage.com/vonage-logo-images/vonage-wide-logo.png'.freeze
8
8
 
9
9
  def initialize(attributes)
10
10
  @title = attributes['title']
@@ -24,7 +24,7 @@ class Blog::Blogpost
24
24
  @category = Blog::Category.new(attributes['category'])
25
25
 
26
26
  @content = ''
27
- @header_img_url = build_header_img_url
27
+ @header_img_url = build_bucket_img_url_from_thumbnail
28
28
 
29
29
  @replacement_url = attributes['replacement_url']
30
30
  end
@@ -36,7 +36,9 @@ class Blog::Blogpost
36
36
 
37
37
  default_not_found_page(path) unless File.exist?(path)
38
38
 
39
- document = File.read(path)
39
+ document = File.read(path).gsub('/content/blog/') do |match| # gsub Netlify img urls
40
+ "#{Blog::Blogpost::CLOUDFRONT_BLOG_URL}blogposts/#{match.gsub('/content/blog/', '')}"
41
+ end
40
42
 
41
43
  blogpost = new(BlogpostParser.build_show_with_locale(path, locale))
42
44
  blogpost.content = Nexmo::Markdown::Renderer.new({}).call(document)
@@ -44,17 +46,21 @@ class Blog::Blogpost
44
46
  blogpost
45
47
  end
46
48
 
47
- def build_header_img_url
49
+ def build_bucket_img_url_from_thumbnail
48
50
  require 'net/http'
49
51
  require 'addressable'
50
52
 
51
- url = Addressable::URI.parse("#{Blog::Blogpost::CLOUDFRONT_BLOG_URL}blogposts/#{thumbnail.gsub('/content/blog/', '')}")
53
+ @thumbnail = @thumbnail.gsub('/content/blog/') do |match| # gsub Netlify img urls
54
+ "#{Blog::Blogpost::CLOUDFRONT_BLOG_URL}blogposts/#{match.gsub('/content/blog/', '')}"
55
+ end
56
+
57
+ url = Addressable::URI.parse(@thumbnail)
52
58
 
53
59
  Net::HTTP.start(url.host, url.port, use_ssl: true) do |http|
54
60
  if http.head(url.request_uri)['Content-Type'].start_with? 'image'
55
- url
61
+ @thumbnail
56
62
  else
57
- DEFAULT_HEADER_IMG_URL
63
+ DEFAULT_VONAGE_LOGO_URL
58
64
  end
59
65
  end
60
66
  end
@@ -49,13 +49,3 @@ class AuthorParser
49
49
  end
50
50
  end
51
51
  end
52
-
53
- # :"abdul-ajetunmobi"=>
54
- # {"team"=>true,
55
- # "name"=>"Abdul Ajetunmobi",
56
- # "image_url"=>"https://github.com/abdulajet.png",
57
- # "bio"=>
58
- # "Abdul is a Developer Advocate for Vonage. He has a background working in consumer products as an iOS Engineer. In his spare time, he enjoys biking, listening to music and mentoring those who are just beginning their journey in tech",
59
- # "website_url"=>"https://abdulajet.me",
60
- # "twitter"=>"abdulajet",
61
- # "title"=>"Vonage Developer Advocate"},
@@ -47,9 +47,10 @@ class BlogpostParser
47
47
  end
48
48
 
49
49
  def self.build_show_with_locale(filename, locale = 'en')
50
- document = File.read(filename)
50
+ document = File.read(filename).gsub('/content/blog/') do |match| # gsub Netlify img urls
51
+ "#{Blog::Blogpost::CLOUDFRONT_BLOG_URL}blogposts/#{match.gsub('/content/blog/', '')}"
52
+ end
51
53
 
52
- # body = Nexmo::Markdown::Renderer.new.call(document)
53
54
  frontmatter = YAML.safe_load(document, [Time])
54
55
 
55
56
  frontmatter.merge!(build_custom_attributes(frontmatter, filename, locale))
@@ -1 +1 @@
1
- {"files":{"manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js":{"logical_path":"manifest.js","mtime":"2022-03-01T16:39:25+00:00","size":2,"digest":"75a11da44c802486bc6f65640aa48a730f0f684c5c07a42ba3cd1735eb3fb070","integrity":"sha256-daEdpEyAJIa8b2VkCqSKcw8PaExcB6Qro80XNes/sHA="},"application-aa88b3c7bd34ec529f43849541752fda7c9c202aa9fff905be578ef88d103b46.js":{"logical_path":"application.js","mtime":"2022-03-01T16:39:25+00:00","size":3172,"digest":"67f1fd16f949c2794341a44cf839e5436bbef74436e043ead39890d1c3b2e583","integrity":"sha256-Z/H9FvlJwnlDQaRM+DnlQ2u+90Q24EPq05iQ0cOy5YM="},"application-e3c324ace3db5c0bf10139460f7f1efb017f04bbeb729bd8d34b308de0852c20.css":{"logical_path":"application.css","mtime":"2022-03-01T16:39:25+00:00","size":16653,"digest":"7bba29977bdaa394d9d33788c5c59026cebf41f7290009d61391a0a645e2272b","integrity":"sha256-e7opl3vao5TZ0zeIxcWQJs6/QfcpAAnWE5GgpkXiJys="}},"assets":{"manifest.js":"manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js","application.js":"application-aa88b3c7bd34ec529f43849541752fda7c9c202aa9fff905be578ef88d103b46.js","application.css":"application-e3c324ace3db5c0bf10139460f7f1efb017f04bbeb729bd8d34b308de0852c20.css"}}
1
+ {"files":{"manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js":{"logical_path":"manifest.js","mtime":"2022-03-11T12:24:04+00:00","size":2,"digest":"75a11da44c802486bc6f65640aa48a730f0f684c5c07a42ba3cd1735eb3fb070","integrity":"sha256-daEdpEyAJIa8b2VkCqSKcw8PaExcB6Qro80XNes/sHA="},"application-aa88b3c7bd34ec529f43849541752fda7c9c202aa9fff905be578ef88d103b46.js":{"logical_path":"application.js","mtime":"2022-03-11T12:24:04+00:00","size":3172,"digest":"67f1fd16f949c2794341a44cf839e5436bbef74436e043ead39890d1c3b2e583","integrity":"sha256-Z/H9FvlJwnlDQaRM+DnlQ2u+90Q24EPq05iQ0cOy5YM="},"application-e3c324ace3db5c0bf10139460f7f1efb017f04bbeb729bd8d34b308de0852c20.css":{"logical_path":"application.css","mtime":"2022-03-11T12:24:04+00:00","size":16653,"digest":"7bba29977bdaa394d9d33788c5c59026cebf41f7290009d61391a0a645e2272b","integrity":"sha256-e7opl3vao5TZ0zeIxcWQJs6/QfcpAAnWE5GgpkXiJys="}},"assets":{"manifest.js":"manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js","application.js":"application-aa88b3c7bd34ec529f43849541752fda7c9c202aa9fff905be578ef88d103b46.js","application.css":"application-e3c324ace3db5c0bf10139460f7f1efb017f04bbeb729bd8d34b308de0852c20.css"}}
@@ -1,3 +1,3 @@
1
1
  module NexmoDeveloper
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: station
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vonage DevRel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-01 00:00:00.000000000 Z
11
+ date: 2022-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeadmin
@@ -731,7 +731,7 @@ files:
731
731
  - "./lib/nexmo_developer/public/android-chrome-512x512.png"
732
732
  - "./lib/nexmo_developer/public/apple-touch-icon-precomposed.png"
733
733
  - "./lib/nexmo_developer/public/apple-touch-icon.png"
734
- - "./lib/nexmo_developer/public/assets/.sprockets-manifest-e617b99e46b29623e15c9f5bcfcaaae1.json"
734
+ - "./lib/nexmo_developer/public/assets/.sprockets-manifest-0755d814d9d7e74921317c4c1de183c0.json"
735
735
  - "./lib/nexmo_developer/public/assets/application-aa88b3c7bd34ec529f43849541752fda7c9c202aa9fff905be578ef88d103b46.js"
736
736
  - "./lib/nexmo_developer/public/assets/application-aa88b3c7bd34ec529f43849541752fda7c9c202aa9fff905be578ef88d103b46.js.gz"
737
737
  - "./lib/nexmo_developer/public/assets/application-e3c324ace3db5c0bf10139460f7f1efb017f04bbeb729bd8d34b308de0852c20.css"