deckchair 0.0.8 → 0.0.10

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.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in deckchair.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Deckchair.com
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Deckchair
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'deckchair'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install deckchair
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/deckchair.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'deckchair/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "deckchair"
8
+ gem.version = Deckchair::VERSION
9
+ gem.authors = ["Gareth"]
10
+ gem.email = ["mail@deckchair.com"]
11
+ gem.description = %q{API Client for Deckchair.com. Includes view helpers for Rails}
12
+ gem.summary = %q{API Client for Deckchair.com}
13
+ gem.homepage = "http://www.deckchair.com"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ #gem.required_ruby_version = '>= 1.9.3'
21
+ end
@@ -0,0 +1,8 @@
1
+ require 'deckchair/view_helpers'
2
+ module Deckchair
3
+ class Railtie < Rails::Railtie
4
+ initializer "deckchair.view_helpers" do |app|
5
+ ActionView::Base.send :include, ViewHelpers
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module Deckchair
2
+ VERSION = "0.0.10"
3
+ end
@@ -0,0 +1,18 @@
1
+ module Deckchair
2
+ module ViewHelpers
3
+
4
+ def dc_pre(text)
5
+ content_tag :pre, text
6
+ end
7
+
8
+ def deckchair_test_helper
9
+ result = "Hello World!!"
10
+ return result
11
+ end
12
+
13
+ def deckchair_image_url(id, params)
14
+ return Deckchair::Image.url(id, query_params)
15
+ end
16
+
17
+ end
18
+ end
data/lib/deckchair.rb ADDED
@@ -0,0 +1,61 @@
1
+ require "deckchair/version"
2
+
3
+ module Deckchair
4
+ PROTOCOL = 'http://'
5
+ SECURE_PROTOCOL = 'https://'
6
+ BASE_DOMAIN = 'deckchair.com'
7
+ IMAGE_DOMAIN = 'blaze.' + BASE_DOMAIN
8
+
9
+ class API
10
+ end
11
+
12
+ class Camera
13
+ end
14
+
15
+ class Image
16
+ @id
17
+
18
+ def initialize(id)
19
+ unless id
20
+ return false
21
+ end
22
+ @id = id
23
+ end
24
+
25
+ def self.url( id, query_params = {} )
26
+ require 'uri'
27
+
28
+ url_params = ''
29
+ if query_params.length > 0
30
+ url_params = '?' + URI.encode_www_form( query_params )
31
+ end
32
+
33
+ url_result = URI.join( Deckchair::PROTOCOL + Deckchair::IMAGE_DOMAIN, '/get/', id.to_s, url_params )
34
+
35
+ return url_result
36
+ end
37
+
38
+ def url( query_params = {} )
39
+ self.class.url( @id, query_params )
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+
46
+ # ### Mini Tests - RSpec coming soon ###
47
+ # da = Deckchair::API.new
48
+ # dc = Deckchair::Camera.new
49
+ # di = Deckchair::Image.new 5000000
50
+ #
51
+ # ## Instance Image ##
52
+ # # URL #
53
+ # di.url({:width => 5555, :height => 2546345})
54
+ # di.url({:width => 5555})
55
+ # di.url({})
56
+ # di.url()
57
+ #
58
+ # ## Static Class Image ##
59
+ # Deckchair::Image.url(50, {:width => 995})
60
+
61
+ require 'deckchair/railtie' if defined? Rails
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deckchair
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,13 +11,23 @@ bindir: bin
11
11
  cert_chain: []
12
12
  date: 2012-09-20 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: API Client for Deckchair.com
14
+ description: API Client for Deckchair.com. Includes view helpers for Rails
15
15
  email:
16
16
  - mail@deckchair.com
17
17
  executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
- files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README.md
25
+ - Rakefile
26
+ - deckchair.gemspec
27
+ - lib/deckchair.rb
28
+ - lib/deckchair/railtie.rb
29
+ - lib/deckchair/version.rb
30
+ - lib/deckchair/view_helpers.rb
21
31
  homepage: http://www.deckchair.com
22
32
  licenses: []
23
33
  post_install_message: