cartero 0.0.1 → 0.0.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: 40b697a16855c665371ffadc0fef5fff1a893e5f
4
- data.tar.gz: d93bac7a1bf236a47fb36b29daffedc40f77a280
3
+ metadata.gz: 7a35e28ca62b224a8ea2e564e672a18dc0e2995a
4
+ data.tar.gz: 3fbf78488e423351e7843d5304b3f0e2d34eb7ff
5
5
  SHA512:
6
- metadata.gz: db2cab1ded1f0e4be5b7af69c7046fb5927833463febd9a160f74d5edad305ff06a83f54cab2e6db3f39814783d8434ce8c8c5256f8ae753a721683e92cdfabb
7
- data.tar.gz: 947c1b63d91a374cd6e9f429988b13dec934572af5ef4ee3becedebbf55821b2ba8ae42cebef40d5a80a9ae71570d0c93855b1259237b671262d8ed95c845b24
6
+ metadata.gz: ab927b62d6141b17111f1cf53bf0996e1a5286c4f492d245fc8933fbc0eb4361f66f258220a7789c1cddbd993c69d19bd6bcf5546aa88a71448107c64ad0d7ec
7
+ data.tar.gz: 1b67a65f5bd44985d513a83a0755382dec042b4e28e77f6e3af7b9c14a7433b6ce606dfc1bea4d5a4b9889264d53c41c1a26b3fa64bc3fbe0d6aab336cda23cc
@@ -12,15 +12,20 @@ module Cartero
12
12
  @original_html = File.read path
13
13
  @original_path = path
14
14
  @processed = {}
15
- # premailer
15
+ premailer
16
16
  end
17
17
 
18
18
  def premailer
19
19
  response = Net::HTTP.post_form(
20
20
  @@premailer_uri,
21
- {html: @original_html}
21
+ {
22
+ html: @original_html,
23
+ adapter: "nokogiri",
24
+ preserve_styles: false
25
+ }
22
26
  )
23
27
  documents = JSON.parse(response.body)['documents']
28
+ puts documents
24
29
  premailer_html_url = documents['html']
25
30
  premailer_text_url = documents['txt']
26
31
 
@@ -29,20 +34,12 @@ module Cartero
29
34
  end
30
35
 
31
36
  def save_processed_html path
32
- if @processed[:html] == nil
33
- premailer
34
- end
35
-
36
37
  File.open(File.expand_path(path), 'wb') do |f|
37
38
  f.write @processed[:html]
38
39
  end
39
40
  end
40
41
 
41
42
  def save_processed_text path
42
- if @processed[:text] == nil
43
- premailer
44
- end
45
-
46
43
  File.open(File.expand_path(path), 'wb') do |f|
47
44
  f.write @processed[:text]
48
45
  end
@@ -1,3 +1,3 @@
1
1
  module Cartero
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
3
  describe Cartero::Document do
4
- before do
4
+ before :all do
5
5
  @path = File.expand_path 'test/fixtures/31_140311.html'
6
6
  @doc = Cartero::Document.new @path
7
7
  end
@@ -19,9 +19,6 @@ describe Cartero::Document do
19
19
  end
20
20
 
21
21
  describe '#premailer' do
22
- before :all do
23
- @doc.premailer
24
- end
25
22
 
26
23
  it 'sets processed[:html] to the premailer HTML' do
27
24
  #@doc.processed[:html].must_equal File.read File.expand_path('test/fixtures/31_140311-premailer.html')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cartero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Dawkins
@@ -76,7 +76,6 @@ files:
76
76
  - test/fixtures/premailer_2.html
77
77
  - test/lib/cartero/document_test.rb
78
78
  - test/lib/cartero/version_test.rb
79
- - test/output/new_premailer_test.html
80
79
  - test/test_helper.rb
81
80
  homepage: ''
82
81
  licenses:
@@ -109,5 +108,4 @@ test_files:
109
108
  - test/fixtures/premailer_2.html
110
109
  - test/lib/cartero/document_test.rb
111
110
  - test/lib/cartero/version_test.rb
112
- - test/output/new_premailer_test.html
113
111
  - test/test_helper.rb