liveslides 1.0.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.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/README.md +42 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/liveslides.rb +47 -0
- data/lib/liveslides/railtie.rb +8 -0
- data/lib/liveslides/version.rb +3 -0
- data/liveslides.gemspec +24 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ef1032ba158cfb69722440bce047716b3c77bbdf
|
4
|
+
data.tar.gz: 04110541ef5aba5a529e203994ca5673ce7165ab
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ad2dd19cd2c2cd05bf5ae799606b50d7f023bc738ed141108ab30b8c51f3c28b1029b35a780c08dded8fdd248e967a482c785b50a655c0c5925b3507a9a608f2
|
7
|
+
data.tar.gz: 43189ca5a3beaba0fc7bea02bf4efa8107ae64b109e738557e1ec0bc473e41c7238eb6f910cdb9f928c39b9af483955866c5d90aaf797dadc6c164396c326508
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# LiveSlides
|
2
|
+
|
3
|
+
Integrate LiveSlides into your Ruby web application.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'liveslides'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install liveslides
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
LiveSlides works in any Ruby web application framework, but support for the most popular are supported right out of the box.
|
24
|
+
|
25
|
+
### Rails
|
26
|
+
|
27
|
+
The LiveSlides gem Just Works™ with Rails when you add to your Gemfile. To add a "Download LiveSlide" button to your application, just call the helper:
|
28
|
+
|
29
|
+
```
|
30
|
+
<%= liveslide_button("https://my-website.com/awesome-content", title: "Awesome content") %>
|
31
|
+
```
|
32
|
+
|
33
|
+
## Development
|
34
|
+
|
35
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
36
|
+
|
37
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/liveslides/gem.
|
42
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "liveslides"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/liveslides.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require "liveslides/version"
|
2
|
+
require "uri"
|
3
|
+
require "cgi/html"
|
4
|
+
|
5
|
+
module LiveSlides
|
6
|
+
class API
|
7
|
+
URL = "https://api.liveslides.com/"
|
8
|
+
|
9
|
+
def initialize(url = URL)
|
10
|
+
@url = url
|
11
|
+
end
|
12
|
+
|
13
|
+
def url(path = "/", **params)
|
14
|
+
URI(@url).tap do |url|
|
15
|
+
url.path = path
|
16
|
+
url.query = URI.encode_www_form(params)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.api
|
22
|
+
@api ||= API.new
|
23
|
+
end
|
24
|
+
|
25
|
+
module Helper
|
26
|
+
def liveslides_slide_url(url, title: nil)
|
27
|
+
LiveSlides.api.url("/v1/slide", url: url, title: title).to_s
|
28
|
+
end
|
29
|
+
|
30
|
+
def liveslides_button_url(color_scheme: "light", protocol: nil)
|
31
|
+
LiveSlides.api.url("/v1/button", color_scheme: color_scheme).tap do |uri|
|
32
|
+
uri.scheme = protocol
|
33
|
+
end.to_s
|
34
|
+
end
|
35
|
+
|
36
|
+
def liveslides_button(url, title: nil, color_scheme: "light", width: nil, height: nil)
|
37
|
+
alt = title || "Download LiveSlide"
|
38
|
+
html5 = CGI::HTML5.new
|
39
|
+
html = html5.a(href: liveslides_slide_url(url, title: title)) do
|
40
|
+
html5.img(src: liveslides_button_url(color_scheme: color_scheme), alt: alt, width: width, height: height)
|
41
|
+
end
|
42
|
+
html.respond_to?(:html_safe) ? html.html_safe : html
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
require 'liveslides/railtie.rb' if defined?(Rails)
|
data/liveslides.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'liveslides/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "liveslides"
|
8
|
+
spec.version = LiveSlides::VERSION
|
9
|
+
spec.authors = ["Brad Gessler"]
|
10
|
+
spec.email = ["brad@liveslides.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{LiveSlides.com API wrapper.}
|
13
|
+
spec.description = %q{Embed your websites live web content in presentations.}
|
14
|
+
spec.homepage = "https://github.com/liveslides/gem"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: liveslides
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brad Gessler
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Embed your websites live web content in presentations.
|
56
|
+
email:
|
57
|
+
- brad@liveslides.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/console
|
69
|
+
- bin/setup
|
70
|
+
- lib/liveslides.rb
|
71
|
+
- lib/liveslides/railtie.rb
|
72
|
+
- lib/liveslides/version.rb
|
73
|
+
- liveslides.gemspec
|
74
|
+
homepage: https://github.com/liveslides/gem
|
75
|
+
licenses: []
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.4.5
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: LiveSlides.com API wrapper.
|
97
|
+
test_files: []
|