paddle 1.0.0 → 1.1.0

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.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/.env.example +3 -0
  3. data/Gemfile +13 -0
  4. data/Gemfile.lock +31 -0
  5. data/README.md +402 -0
  6. data/Rakefile +8 -10
  7. data/bin/console +25 -0
  8. data/bin/setup +8 -0
  9. data/lib/paddle/classic/client.rb +87 -0
  10. data/lib/paddle/classic/collection.rb +29 -0
  11. data/lib/paddle/classic/objects/charge.rb +6 -0
  12. data/lib/paddle/classic/objects/coupon.rb +6 -0
  13. data/lib/paddle/classic/objects/license.rb +6 -0
  14. data/lib/paddle/classic/objects/modifier.rb +6 -0
  15. data/lib/paddle/classic/objects/pay_link.rb +6 -0
  16. data/lib/paddle/classic/objects/payment.rb +6 -0
  17. data/lib/paddle/classic/objects/payment_refund.rb +6 -0
  18. data/lib/paddle/classic/objects/plan.rb +6 -0
  19. data/lib/paddle/classic/objects/product.rb +6 -0
  20. data/lib/paddle/classic/objects/transaction.rb +6 -0
  21. data/lib/paddle/classic/objects/user.rb +6 -0
  22. data/lib/paddle/classic/objects/webhook.rb +6 -0
  23. data/lib/paddle/classic/resource.rb +63 -0
  24. data/lib/paddle/classic/resources/charges.rb +13 -0
  25. data/lib/paddle/classic/resources/coupons.rb +33 -0
  26. data/lib/paddle/classic/resources/licenses.rb +15 -0
  27. data/lib/paddle/classic/resources/modifiers.rb +26 -0
  28. data/lib/paddle/classic/resources/pay_links.rb +13 -0
  29. data/lib/paddle/classic/resources/payments.rb +24 -0
  30. data/lib/paddle/classic/resources/plans.rb +21 -0
  31. data/lib/paddle/classic/resources/products.rb +12 -0
  32. data/lib/paddle/classic/resources/transactions.rb +12 -0
  33. data/lib/paddle/classic/resources/users.rb +42 -0
  34. data/lib/paddle/classic/resources/webhooks.rb +12 -0
  35. data/lib/paddle/client.rb +71 -0
  36. data/lib/paddle/collection.rb +27 -0
  37. data/lib/paddle/configuration.rb +32 -0
  38. data/lib/paddle/error.rb +4 -0
  39. data/lib/paddle/models/address.rb +30 -0
  40. data/lib/paddle/models/adjustment.rb +20 -0
  41. data/lib/paddle/models/business.rb +30 -0
  42. data/lib/paddle/models/customer.rb +30 -0
  43. data/lib/paddle/models/discount.rb +30 -0
  44. data/lib/paddle/models/event.rb +14 -0
  45. data/lib/paddle/models/event_type.rb +14 -0
  46. data/lib/paddle/models/notification.rb +30 -0
  47. data/lib/paddle/models/notification_log.rb +4 -0
  48. data/lib/paddle/models/notification_setting.rb +34 -0
  49. data/lib/paddle/models/price.rb +30 -0
  50. data/lib/paddle/models/product.rb +30 -0
  51. data/lib/paddle/models/subscription.rb +56 -0
  52. data/lib/paddle/models/transaction.rb +49 -0
  53. data/lib/paddle/object.rb +19 -0
  54. data/lib/paddle/version.rb +5 -0
  55. data/lib/paddle.rb +72 -5
  56. data/paddle.gemspec +30 -0
  57. metadata +99 -124
  58. data/.autotest +0 -23
  59. data/CHANGELOG.rdoc +0 -6
  60. data/Manifest.txt +0 -16
  61. data/README.rdoc +0 -62
  62. data/lib/images/ruby.png +0 -0
  63. data/lib/rdoc/discover.rb +0 -1
  64. data/lib/rdoc/generator/paddle.rb +0 -144
  65. data/lib/templates/classfile.html.erb +0 -115
  66. data/lib/templates/container.xml +0 -7
  67. data/lib/templates/content.opf.erb +0 -34
  68. data/lib/templates/cover.html.erb +0 -18
  69. data/lib/templates/title.html.erb +0 -18
  70. data/lib/templates/toc.ncx.erb +0 -36
  71. data/test/test_paddle.rb +0 -13
data/README.rdoc DELETED
@@ -1,62 +0,0 @@
1
- = paddle
2
-
3
- * http://tenderlovemaking.com
4
-
5
- == DESCRIPTION:
6
-
7
- Paddle is an RDoc plugin that emits documentation suitable for use as an epub
8
- book. The epub book can then be imported to iBooks for reading on iPad!
9
-
10
- == FEATURES/PROBLEMS:
11
-
12
- * Converts RDoc to epub format
13
- * Sometimes it doesn't escape everything properly
14
- * Links aren't working yet
15
- * The tests are poor. *Very* poor.
16
-
17
- == SYNOPSIS:
18
-
19
- First, make sure to have the latest RDoc. Install paddle, then rdoc your code
20
- like this:
21
-
22
- $ rdoc -o epub -f paddle -t 'My Documentation' lib
23
-
24
- Next, convert the documentation to an epub file:
25
-
26
- $ cd epub
27
- $ zip -Xr9D mydocs.epub mimetype *
28
-
29
- Then drag "mydocs.epub" to iTunes, and sync up your iPad.
30
-
31
- == REQUIREMENTS:
32
-
33
- * RDoc
34
-
35
- == INSTALL:
36
-
37
- * sudo gem install rdoc
38
-
39
- == LICENSE:
40
-
41
- (The MIT License)
42
-
43
- Copyright (c) 2010 Aaron Patterson
44
-
45
- Permission is hereby granted, free of charge, to any person obtaining
46
- a copy of this software and associated documentation files (the
47
- 'Software'), to deal in the Software without restriction, including
48
- without limitation the rights to use, copy, modify, merge, publish,
49
- distribute, sublicense, and/or sell copies of the Software, and to
50
- permit persons to whom the Software is furnished to do so, subject to
51
- the following conditions:
52
-
53
- The above copyright notice and this permission notice shall be
54
- included in all copies or substantial portions of the Software.
55
-
56
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
57
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
58
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
59
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
60
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
61
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
62
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/lib/images/ruby.png DELETED
Binary file
data/lib/rdoc/discover.rb DELETED
@@ -1 +0,0 @@
1
- require 'rdoc/generator/paddle'
@@ -1,144 +0,0 @@
1
- require 'rdoc/generator'
2
- require 'rdoc/rdoc'
3
- require 'paddle'
4
- require 'erb'
5
- require 'md5'
6
- require 'fileutils'
7
-
8
- class RDoc::Generator::Paddle
9
- RDoc::RDoc.add_generator self
10
-
11
- TEMPLATE_DIR = File.expand_path(
12
- File.join(File.dirname(__FILE__), '..', '..', 'templates'))
13
- IMAGE_DIR = File.expand_path(
14
- File.join(File.dirname(__FILE__), '..', '..', 'images'))
15
-
16
- class << self
17
- alias :for :new
18
- end
19
-
20
- def initialize options
21
- @options = options
22
- @class_dir = nil
23
- @file_dir = nil
24
- @odir = Pathname.new(options.op_dir).expand_path(Pathname.pwd)
25
- @fh = nil
26
- @files = nil
27
- end
28
-
29
- def generate top_levels
30
- @files = top_levels
31
- @classes = RDoc::TopLevel.all_classes_and_modules.reject { |x|
32
- x.name =~ /[<>]/
33
- }
34
-
35
- FileUtils.mkdir_p(File.join(@odir, class_dir))
36
-
37
- emit_mimetype
38
- emit_meta_inf
39
- emit_cover
40
- emit_title
41
- emit_opf
42
- emit_toc
43
- emit_classfiles
44
- copy_images
45
- end
46
-
47
- def class_dir
48
- '/doc'
49
- end
50
-
51
- def title
52
- @options.title
53
- end
54
-
55
- def identifier
56
- MD5.hexdigest title
57
- end
58
-
59
- private
60
- def h string
61
- string.strip.gsub(/<pre>\s*<\/pre>/, '').gsub(/&/, '&amp;').gsub(/<</, '&lt;&lt;')
62
- end
63
-
64
- def copy_images
65
- imgs = File.join @odir, 'images'
66
- FileUtils.mkdir_p imgs
67
-
68
- FileUtils.cp File.join(IMAGE_DIR, 'ruby.png'), imgs
69
- end
70
-
71
- def emit_meta_inf
72
- meta_inf = File.join @odir, 'META-INF'
73
- FileUtils.mkdir_p meta_inf
74
-
75
- FileUtils.cp File.join(TEMPLATE_DIR, 'container.xml'), meta_inf
76
- end
77
-
78
- def emit_mimetype
79
- File.open(File.join(@odir, 'mimetype'), 'wb') do |f|
80
- f.write 'application/epub+zip'
81
- end
82
- end
83
-
84
- def emit_cover
85
- template = ERB.new File.read(File.join(TEMPLATE_DIR, 'cover.html.erb')),
86
- nil, '<>'
87
-
88
- File.open(File.join(@odir, class_dir, 'cover.html'), 'wb') do |f|
89
- f.write template.result binding
90
- end
91
- end
92
-
93
- def emit_title
94
- template = ERB.new File.read(File.join(TEMPLATE_DIR, 'title.html.erb')),
95
- nil, '<>'
96
-
97
- File.open(File.join(@odir, class_dir, 'title.html'), 'wb') do |f|
98
- f.write template.result binding
99
- end
100
- end
101
-
102
- def emit_classfiles
103
- @classes.each do |klass|
104
- klass_methods = []
105
- instance_methods = []
106
-
107
- klass.method_list.each do |method|
108
- next if 'private' == method.visibility.to_s
109
- if method.type == 'class'
110
- klass_methods << method
111
- else
112
- instance_methods << method
113
- end
114
- end
115
-
116
- template = ERB.new File.read(File.join(TEMPLATE_DIR, 'classfile.html.erb')),
117
- nil, '<>'
118
-
119
- FileUtils.mkdir_p(File.dirname(File.join(@odir, klass.path)))
120
-
121
- File.open(File.join(@odir, klass.path), 'wb') do |f|
122
- f.write template.result binding
123
- end
124
- end
125
- end
126
-
127
- def emit_opf
128
- template = ERB.new File.read(File.join(TEMPLATE_DIR, 'content.opf.erb')),
129
- nil, '<>'
130
-
131
- File.open(File.join(@odir, 'content.opf'), 'wb') do |f|
132
- f.write template.result binding
133
- end
134
- end
135
-
136
- def emit_toc
137
- template = ERB.new File.read(File.join(TEMPLATE_DIR, 'toc.ncx.erb')),
138
- nil, '<>'
139
-
140
- File.open(File.join(@odir, 'toc.ncx'), 'wb') do |f|
141
- f.write template.result binding
142
- end
143
- end
144
- end
@@ -1,115 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
5
- <title>
6
- <%= klass.name %>
7
- </title>
8
- <style>
9
- dt, dd {
10
- margin: 0;
11
- }
12
- dt.name {
13
- float: left;
14
- }
15
- dd.explanation {
16
- clear: both;
17
- margin-bottom: 0.5em;
18
- margin-left: 1.5em;
19
- }
20
- dt.name {
21
- font-weight: bold;
22
- }
23
- </style>
24
- </head>
25
- <body>
26
- <h1>
27
- <% if klass.type == 'class' %>
28
- <span class="class">
29
- <%= klass.type.capitalize %>
30
- <a href="<%= klass.path %>">
31
- <%= klass.full_name %>
32
- </a>
33
- <% if klass.superclass %>
34
- inherits from
35
- <% end %>
36
- <% unless String === klass.superclass %>
37
- <a href="<%= klass.superclass.path %>">
38
- <%= klass.superclass.name %>
39
- </a>
40
- <% else %>
41
- <%= klass.superclass %>
42
- <% end %>
43
- </span>
44
- <% else %>
45
- <span class="module">
46
- <%= klass.type.capitalize %>
47
- <a href="<%= klass.path %>">
48
- <%= klass.name %>
49
- </a>
50
- </span>
51
- <% end %>
52
- </h1>
53
- <% if klass.description && !klass.description.empty? %>
54
- <div id="description" class="alt">
55
- <%= h klass.description %>
56
- </div>
57
- <% end %>
58
-
59
- <!-- Constants -->
60
- <% unless klass.constants.empty? %>
61
- <h3>Constants</h3>
62
- <% klass.constants.sort_by { |x| x.name }.each do |const| %>
63
- <dl>
64
- <dt class="name">
65
- <%= h const.name %>
66
- </dt>
67
- <dd class="explanation"><%= h const.description %></dd>
68
- </dl>
69
- <% end %>
70
- <% end %>
71
-
72
- <!-- Attributes -->
73
- <% unless klass.attributes.empty? %>
74
- <h3>Attributes</h3>
75
- <% klass.attributes.sort_by { |x| x.name }.each do |attr| %>
76
- <dl>
77
- <dt class="name">
78
- <%= h attr.name %>
79
- <span class="optional"><%= attr.rw %></span>
80
- </dt>
81
- <dd class="explanation"><%= h attr.description %></dd>
82
- </dl>
83
- <% end %>
84
- <% end %>
85
-
86
- <!-- Class Methods -->
87
- <% unless klass_methods.empty? %>
88
- <h3>Public Class Methods</h3>
89
- <% klass_methods.each do |method| %>
90
- <dl class="method">
91
- <dt class="name">
92
- <a name="<%= method.aref %>" ></a>
93
- <%= h method.name %><%= h method.params %>
94
- </dt>
95
- <dd class="explanation"><%= h method.description %></dd>
96
- </dl>
97
- <% end %>
98
- <% end %>
99
-
100
- <!-- Instance Methods -->
101
- <% unless instance_methods.empty? %>
102
- <h3>Public Instance Methods</h3>
103
- <% instance_methods.each do |method| %>
104
- <dl class="method">
105
- <dt class="name">
106
- <a name="<%= method.aref %>" ></a>
107
- <%= h method.name %><%= h method.params %>
108
- </dt>
109
- <dd class="explanation"><%= h method.description %></dd>
110
- </dl>
111
- <% end %>
112
- <% end %>
113
-
114
- </body>
115
- </html>
@@ -1,7 +0,0 @@
1
- <?xml version="1.0"?>
2
- <container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
3
- <rootfiles>
4
- <rootfile full-path="content.opf" media-type="application/oebps-package+xml"/>
5
- </rootfiles>
6
- </container>
7
-
@@ -1,34 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <package xmlns="http://www.idpf.org/2007/opf"
3
- version="2.0"
4
- unique-identifier="internet">
5
- <metadata xmlns:dc="http://purl.org/dc/elements/1.1/"
6
- xmlns:dcterms="http://purl.org/dc/terms/"
7
- xmlns:opf="http://www.idpf.org/2007/opf"
8
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
9
- <dc:title><%= title %></dc:title>
10
- <dc:language xsi:type="dcterms:RFC3066">en</dc:language>
11
- <dc:identifier id="dcidid" opf:scheme="URI">
12
- <%= identifier %>
13
- </dc:identifier>
14
- </metadata>
15
- <manifest>
16
- <item id="ncx" href="toc.ncx" media-type="text/xml"/>
17
- <item id="cover" href="doc/cover.html" media-type="application/xhtml+xml"/>
18
- <item id="title" href="doc/title.html" media-type="application/xhtml+xml"/>
19
- <item id="ruby" href="images/ruby.png" media-type="image/png"/>
20
- <% @classes.each do |klass| %>
21
- <item id="<%= MD5.hexdigest(klass.full_name) %>" href="<%= klass.path %>" media-type="application/xhtml+xml"/>
22
- <% end %>
23
- </manifest>
24
- <spine toc="ncx">
25
- <itemref idref="cover"/>
26
- <itemref idref="title"/>
27
- <% @classes.sort_by { |x| x.full_name }.each do |klass| %>
28
- <itemref idref="<%= MD5.hexdigest(klass.full_name) %>"/>
29
- <% end %>
30
- </spine>
31
- <guide>
32
- <reference type="cover" title="Cover" href="doc/cover.html" />
33
- </guide>
34
- </package>
@@ -1,18 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
5
- <title>
6
- <%= title %>
7
- </title>
8
- <style>
9
- h1 {
10
- text-align: center;
11
- }
12
- </style>
13
- </head>
14
- <body>
15
- <h1><%= title %></h1>
16
- <img src="/images/ruby.png" />
17
- </body>
18
- </html>
@@ -1,18 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
5
- <title>
6
- <%= title %>
7
- </title>
8
- <style>
9
- h1 {
10
- text-align: center;
11
- }
12
- </style>
13
- </head>
14
- <body>
15
- <h1><%= title %></h1>
16
- <img src="/images/ruby.png" />
17
- </body>
18
- </html>
@@ -1,36 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN"
3
- "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
4
- <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1" xml:lang="en">
5
- <head>
6
- <meta name="dtb:uid" content="<%= identifier %>"/>
7
- <meta name="dtb:depth" content="2"/>
8
- <meta name="dtb:totalPageCount" content="0"/>
9
- <meta name="dtb:maxPageNumber" content="0"/>
10
- </head>
11
- <docTitle>
12
- <text><%= title %></text>
13
- </docTitle>
14
- <navMap>
15
- <navPoint id="navPoint-1" playOrder="1">
16
- <navLabel>
17
- <text>Cover</text>
18
- </navLabel>
19
- <content src="doc/cover.html"/>
20
- </navPoint>
21
- <navPoint id="navPoint-2" playOrder="2">
22
- <navLabel>
23
- <text>Title</text>
24
- </navLabel>
25
- <content src="doc/title.html"/>
26
- </navPoint>
27
- <% @classes.sort_by { |x| x.full_name }.each_with_index do |klass, i| %>
28
- <navPoint id="navPoint-<%= i + 3 %>" playOrder="<%= i + 3 %>">
29
- <navLabel>
30
- <text><%= klass.full_name %></text>
31
- </navLabel>
32
- <content src="<%= klass.path %>"/>
33
- </navPoint>
34
- <% end %>
35
- </navMap>
36
- </ncx>
data/test/test_paddle.rb DELETED
@@ -1,13 +0,0 @@
1
- require "test/unit"
2
- require 'rdoc/generator/paddle'
3
- require 'tempfile'
4
- require 'fileutils'
5
-
6
- class TestPaddle < Test::Unit::TestCase
7
- def setup
8
- @dirname = File.join(Dir.tmpdir, Time.now.to_i.to_s)
9
- p @dirname
10
- rdoc = RDoc::RDoc.new
11
- rdoc.document ['--op', @dirname, '-q', '-f', 'paddle']
12
- end
13
- end