spine-content_types 0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 96a41bba390eb00ef2d5e02d22fcd2ce6073ef91
4
+ data.tar.gz: d5a6d0ba639a11ac3f4cf106839b75910c4a4d2a
5
+ SHA512:
6
+ metadata.gz: c2e97cf22afa3f33293e51bd3389e55779cded610f31283c85087409f755946972d80c5feb5382571542688d23664ec3493e97e5039217eaa69d16c3bb96db98
7
+ data.tar.gz: 7117284b507fc9929a2c5814040e77e48139865195138919f3b23a9141aa817112f3c6e3bbe1aad3fbeb52fb381a8ceb3912f94a4665d7edc350674f523514b4
data/.gitignore ADDED
@@ -0,0 +1,35 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /vendor/bundle
26
+ /lib/bundler/man/
27
+
28
+ # for a library or gem, you might want to ignore these files since the code is
29
+ # intended to run in multiple environments; otherwise, check them in:
30
+ # Gemfile.lock
31
+ # .ruby-version
32
+ # .ruby-gemset
33
+
34
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
35
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in spine-content_types.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,19 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ spine-content_types (0.1.0)
5
+ multi_json (~> 1.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ multi_json (1.11.0)
11
+ rake (10.4.2)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.7)
18
+ rake (~> 10.0)
19
+ spine-content_types!
data/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2015, TOGGL LLC
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ 3. Neither the name of the TOGGL LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # Spine::ContentTypes
2
+
3
+ [![Gem Version](http://img.shields.io/gem/v/spine-content_types.svg)][gem]
4
+ [![Dependency Status](https://gemnasium.com/rspine/content_types.svg)](https://gemnasium.com/rspine/content_types)
5
+ [![Code Climate](https://codeclimate.com/github/rspine/content_types/badges/gpa.svg)](https://codeclimate.com/github/rspine/content_types)
6
+
7
+ Provides encoding and decoding to content types. Supported types are plain text, HTML and JSON.
8
+
9
+ ## Installation
10
+
11
+ To install it, add the gem to your Gemfile:
12
+
13
+ ```ruby
14
+ gem 'spine-content_types'
15
+ ```
16
+
17
+ Then run `bundle`. If you're not using Bundler, just `gem install spine-content_types`.
18
+
19
+ ## Usage
20
+
21
+ ```ruby
22
+ hash = Spine::ContentTypes::Json.load('{ "test": 12345 }')
23
+
24
+ json = Spine::ContentTypes::Json.dump(hash)
25
+ ```
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,8 @@
1
+ module Spine
2
+ module ContentTypes
3
+ autoload :Plain, 'spine/content_types/plain'
4
+ autoload :Text, 'spine/content_types/text'
5
+ autoload :Html, 'spine/content_types/html'
6
+ autoload :Json, 'spine/content_types/json'
7
+ end
8
+ end
@@ -0,0 +1,12 @@
1
+ module Spine
2
+ module ContentTypes
3
+ module Html
4
+ include Text
5
+ extend self
6
+
7
+ def mime_type
8
+ 'text/html'
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ require 'multi_json'
2
+
3
+ module Spine
4
+ module ContentTypes
5
+ module JsonMimeType
6
+ def mime_type
7
+ 'application/json'
8
+ end
9
+ end
10
+
11
+ Json = MultiJson.extend(JsonMimeType)
12
+ Json.default_load_options[:symbolize_keys] = true
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ module Spine
2
+ module ContentTypes
3
+ module Plain
4
+ extend self
5
+
6
+ def load(data, options={})
7
+ data
8
+ end
9
+
10
+ def dump(data, options={})
11
+ data
12
+ end
13
+
14
+ def mime_type
15
+ ''
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Spine
2
+ module ContentTypes
3
+ module Text
4
+ extend self
5
+
6
+ def load(data, options={})
7
+ data.to_s
8
+ end
9
+
10
+ def dump(data, options={})
11
+ data.to_s
12
+ end
13
+
14
+ def mime_type
15
+ 'text/plain'
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ module Spine
2
+ module ContentTypes
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'spine/content_types/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "spine-content_types"
8
+ spec.version = Spine::ContentTypes::VERSION
9
+ spec.authors = ["TOGGL LLC"]
10
+ spec.email = ["support@toggl.com"]
11
+ spec.summary = 'Content types for Spine.'
12
+ spec.description = ''
13
+ spec.homepage = 'https://github.com/rspine/content_types'
14
+ spec.license = 'BSD-3-Clause'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'multi_json', "~> 1.0"
22
+
23
+ spec.add_development_dependency 'bundler', "~> 1.7"
24
+ spec.add_development_dependency 'rake', "~> 10.0"
25
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spine-content_types
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - TOGGL LLC
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: multi_json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: ''
56
+ email:
57
+ - support@toggl.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - Gemfile.lock
65
+ - LICENSE
66
+ - README.md
67
+ - Rakefile
68
+ - lib/spine/content_types.rb
69
+ - lib/spine/content_types/html.rb
70
+ - lib/spine/content_types/json.rb
71
+ - lib/spine/content_types/plain.rb
72
+ - lib/spine/content_types/text.rb
73
+ - lib/spine/content_types/version.rb
74
+ - spine-content_types.gemspec
75
+ homepage: https://github.com/rspine/content_types
76
+ licenses:
77
+ - BSD-3-Clause
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.4.5
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: Content types for Spine.
99
+ test_files: []