lob 2.0.0 → 2.0.1

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: 4ceb1823e07362d2a8fbadfa23749bc78c6e49b8
4
- data.tar.gz: 2ac14476bb2ba3c2ab7bd76bb9f0d644ce90dad1
3
+ metadata.gz: 2f01880ce06eb67d59786cc40db2bf0aa0e0af4c
4
+ data.tar.gz: 0812fc81d12a70db6a2f74984dd52df3021dee02
5
5
  SHA512:
6
- metadata.gz: ca4df9c124eb0ff74fb7c048ff8ae58a3ef7b5caa273cb21c56a461985d856197f34e8f751ee92cee5cccd5d01d00017728cc7009df63acc18a7dbeb2e620b3a
7
- data.tar.gz: 080a64c572bed68a9c10ccd4e2a99b3ac93feb952003921fac1094bde74745fdd44594214a45317507aa31cfb1f574d930c079f20d5fd773461195c4457a9cc1
6
+ metadata.gz: a932ae52a9915c3d20c22c6ce27b8e87b618afff584c9dadf974d9b82bb90eb2a58a89b0251390e92810466c773805a8744bb2a2e17c252294e77cc42207a95b
7
+ data.tar.gz: 26ccd84ac9924f6e9bfc397b3290561bdfeb67ecf8d243ad0ef8930b5235a24a0b56bcdc30d1f96ecee4d8b4ce092607748f7abfaea487973bec94b7c562e159
data/examples/README.md CHANGED
@@ -10,10 +10,6 @@ An example showing how to dynamically create postcards from a CSV using HTML, a
10
10
 
11
11
  An example showing how to create a check using Lob's [Simple Check Service](https://lob.com/services/checks).
12
12
 
13
- ## /create_pdf.rb
14
-
15
- An example showing how to create PDF's with the Prawn library.
16
-
17
13
  ## /jobs.rb
18
14
 
19
15
  An example showing how to create objects and jobs using Lob's [Simple Print Service](https://lob.com/services/sps).
data/examples/checks.rb CHANGED
@@ -9,10 +9,10 @@ Lob.api_key = 'test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc'
9
9
  to_address = @lob.addresses.create(
10
10
  name: "John Doe",
11
11
  address_line1: "104 Printing Boulevard",
12
- city: "Boston",
13
- state: "MA",
14
- country: "US",
15
- zip: 12345
12
+ address_city: "Boston",
13
+ address_state: "MA",
14
+ address_country: "US",
15
+ address_zip: 12345
16
16
  )
17
17
 
18
18
  # create a bank account
@@ -23,18 +23,18 @@ bank_account = @lob.bank_accounts.create(
23
23
  bank_address: {
24
24
  name: "Bank Address",
25
25
  address_line1: "120 6th Ave",
26
- city: "Boston",
27
- state: "MA",
28
- country: "US",
29
- zip: 12345
26
+ address_city: "Boston",
27
+ address_state: "MA",
28
+ address_country: "US",
29
+ address_zip: 12345
30
30
  },
31
31
  account_address: {
32
32
  name: "Account Address",
33
33
  address_line1: "120 6th Ave",
34
- city: "Boston",
35
- state: "MA",
36
- country: "US",
37
- zip: 12345
34
+ address_city: "Boston",
35
+ address_state: "MA",
36
+ address_country: "US",
37
+ address_zip: 12345
38
38
  }
39
39
  )
40
40
 
@@ -1,3 +1,4 @@
1
+ $:.unshift File.expand_path("../../lib", File.dirname(__FILE__))
1
2
  require 'lob'
2
3
  require 'csv'
3
4
 
@@ -17,18 +18,18 @@ CSV.foreach(File.expand_path('../input.csv', __FILE__)) do |row|
17
18
  name: row[5],
18
19
  address_line1: row[6],
19
20
  address_line2: row[7],
20
- city: row[8],
21
- state: row[9],
22
- zip: row[10],
23
- country: row[11]
21
+ address_city: row[8],
22
+ address_state: row[9],
23
+ address_zip: row[10],
24
+ address_country: row[11]
24
25
  },
25
26
  from: {
26
27
  name: 'Lob',
27
28
  address_line1: '123 Main Street',
28
- city: 'San Francisco',
29
- state: 'CA',
30
- zip: '94185',
31
- country: 'US'
29
+ address_city: 'San Francisco',
30
+ address_state: 'CA',
31
+ address_zip: '94185',
32
+ address_country: 'US'
32
33
  },
33
34
  setting: 1002,
34
35
  front: front_html,
data/examples/jobs.rb CHANGED
@@ -1,23 +1,64 @@
1
1
  $:.unshift File.expand_path("../lib", File.dirname(__FILE__))
2
2
  require 'open-uri'
3
- require 'prawn'
4
3
  require 'lob'
5
4
 
6
5
  # initialize Lob object
7
6
  Lob.api_key = 'test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc'
8
7
  @lob = Lob.load
9
8
 
10
- POINTS_PER_INCH = 72 # 72 PostScript Points per Inch
9
+ html = %{
10
+ <html>
11
+ <head>
12
+ <title>Lob.com Sample Photo</title>
13
+ <style>
14
+ *, *:before, *:after {
15
+ -webkit-box-sizing: border-box;
16
+ -moz-box-sizing: border-box;
17
+ box-sizing: border-box;
18
+ }
11
19
 
12
- pdf = Prawn::Document.new(:page_size => [4.25 * POINTS_PER_INCH, 6.25 * POINTS_PER_INCH])
13
- pdf.image open('https://s3-us-west-2.amazonaws.com/lob-assets/printing_icon.png'), :position => :center
14
- pdf.text 'Print with Lob!', :align => :center, :size => 32
20
+ @font-face {
21
+ font-family: 'Loved by the King';
22
+ font-style: normal;
23
+ font-weight: 400;
24
+ src: url('https://s3-us-west-2.amazonaws.com/lob-assets/LovedbytheKing.ttf') format('truetype');
25
+ }
15
26
 
16
- pdf.render_file 'sample.pdf'
27
+ body {
28
+ width: 6.25in;
29
+ height: 4.25in;
30
+ margin: 0;
31
+ padding: 0;
32
+ /* If using an image, the background image should have dimensions of 1875x1275 pixels. */
33
+ background-image: url(https://s3-us-west-2.amazonaws.com/lob-assets/beach.jpg);
34
+ background-size: 6.25in 4.25in;
35
+ background-repeat: no-repeat;
36
+ }
37
+
38
+ .text {
39
+ margin: 50px;
40
+ width: 400px;
41
+ font-family: 'Loved by the King';
42
+ font-size: 50px;
43
+ font-weight: 700;
44
+ color: white;
45
+ text-shadow: 3px 3px black;
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <h1 class="text">Hello {{name}}!</h1>
52
+ <p class="text">Join us for the {{event}}!</p>
53
+ </body>
54
+
55
+ </html>
56
+ }
17
57
 
18
58
  object = @lob.objects.create(
19
59
  description: 'Test Object',
20
- file: File.new('sample.pdf'),
60
+ file: html,
61
+ data: { name: "Albert", event: "Summer 2015 Beach-athon" },
21
62
  setting: 201
22
63
  )
23
64
 
@@ -25,23 +66,22 @@ object = @lob.objects.create(
25
66
  to_address = @lob.addresses.create(
26
67
  name: "ToAddress",
27
68
  address_line1: "120 6th Ave",
28
- city: "Boston",
29
- state: "MA",
30
- country: "US",
31
- zip: 12345
69
+ address_city: "Boston",
70
+ address_state: "MA",
71
+ address_country: "US",
72
+ address_zip: 12345
32
73
  )
33
74
 
34
75
  # create a from address
35
76
  from_address = @lob.addresses.create(
36
77
  name: "FromAddress",
37
78
  address_line1: "120 6th Ave",
38
- city: "Boston",
39
- state: "MA",
40
- country: "US",
41
- zip: 12345
79
+ address_city: "Boston",
80
+ address_state: "MA",
81
+ address_country: "US",
82
+ address_zip: 12345
42
83
  )
43
84
 
44
-
45
85
  # send the object you created
46
86
  puts @lob.jobs.create(
47
87
  description: "Michigan Logo to Harry",
@@ -59,20 +59,20 @@ html = %{
59
59
  to_address = @lob.addresses.create(
60
60
  name: "ToAddress",
61
61
  address_line1: "120 6th Ave",
62
- city: "Boston",
63
- state: "MA",
64
- country: "US",
65
- zip: 12345
62
+ address_city: "Boston",
63
+ address_state: "MA",
64
+ address_country: "US",
65
+ address_zip: 12345
66
66
  )
67
67
 
68
68
  # create a from address
69
69
  from_address = @lob.addresses.create(
70
70
  name: "FromAddress",
71
71
  address_line1: "120 6th Ave",
72
- city: "Boston",
73
- state: "MA",
74
- country: "US",
75
- zip: 12345
72
+ address_city: "Boston",
73
+ address_state: "MA",
74
+ address_country: "US",
75
+ address_zip: 12345
76
76
  )
77
77
 
78
78
  # send a postcard
data/lib/lob/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lob
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
data/lob.gemspec CHANGED
@@ -20,8 +20,6 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency "rest-client", "~> 1.8"
22
22
 
23
- spec.add_dependency "prawn"
24
-
25
23
  spec.add_development_dependency "bundler", "~> 1.3"
26
24
  spec.add_development_dependency "rake", "~> 10.4.2"
27
25
  spec.add_development_dependency "minitest", "~> 5.6.1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lob
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-22 00:00:00.000000000 Z
11
+ date: 2015-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.8'
27
- - !ruby/object:Gem::Dependency
28
- name: prawn
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -166,7 +152,6 @@ files:
166
152
  - Rakefile
167
153
  - examples/README.md
168
154
  - examples/checks.rb
169
- - examples/create_pdf.rb
170
155
  - examples/csv_postcards/create_postcards.rb
171
156
  - examples/csv_postcards/input.csv
172
157
  - examples/csv_postcards/postcard_back.html
@@ -1,24 +0,0 @@
1
- $:.unshift File.expand_path("../lib", File.dirname(__FILE__))
2
- require 'open-uri'
3
- require 'prawn'
4
- require 'lob'
5
-
6
- # initialize Lob object
7
- Lob.api_key = 'test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc'
8
- @lob = Lob.load
9
-
10
- POINTS_PER_INCH = 72 # 72 PostScript Points per Inch
11
-
12
- pdf = Prawn::Document.new(:page_size => [4.25 * POINTS_PER_INCH, 6.25 * POINTS_PER_INCH])
13
- pdf.image open('https://s3-us-west-2.amazonaws.com/lob-assets/printing_icon.png'), :position => :center
14
- pdf.text 'Print with Lob!', :align => :center, :size => 32
15
-
16
- pdf.render_file 'sample.pdf'
17
-
18
- object = @lob.objects.create(
19
- description: 'Test Object',
20
- file: File.new('sample.pdf'),
21
- setting: 201
22
- )
23
-
24
- puts 'You can view your created PDF here: ' + object['url']