hyper_api 0.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.
@@ -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 hyper_api.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Javier Saldana
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.
@@ -0,0 +1,57 @@
1
+ # HyperAPI
2
+
3
+ Hypertext API. A sweet DSL to create objects off HTML.
4
+
5
+ ## Installation
6
+
7
+ Add the `hyper_api` gem to your app. For example, using Bundler:
8
+
9
+ $ echo "gem 'hyper_api'" >> Gemfile
10
+ $ bundle install
11
+
12
+ ## Usage
13
+
14
+ The HyperAPI gem uses [Nokogiri](https://github.com/sparklemotion/nokogiri) to parse HTML with CSS selectors.
15
+
16
+ Create objects on-the-go:
17
+
18
+ ```ruby
19
+ tpb_torrent = HyperAPI.new_class('TPB::Torrent') do
20
+ string title: 'div#title'
21
+ string description: 'div.info'
22
+ string hash: '#details dd'
23
+ integer imdb_id: '#details a[title=IMDB]' do
24
+ attribute('href').value
25
+ end
26
+ end
27
+ # => TPB::Torrent
28
+
29
+ fringe = tpb_torrent.new(html)
30
+ # => #<TPB::Torrent title: 'Fringe Season 1', description: 'The complete season 1 of Fri...', imdb_id: '1119644'>
31
+ ```
32
+
33
+ Or create a new class:
34
+
35
+ ```ruby
36
+ class TPB::Torrent < HyperApi::Base
37
+ string title: 'div#title'
38
+ string description: 'div.info'
39
+ string hash: '#details dd'
40
+ integer imdb_id: '#details a[title=IMDB]' do
41
+ attribute('href').value
42
+ end
43
+ end
44
+
45
+ fringe = TPB::Torrent.new(html)
46
+ # => #<TPB::Torrent title: 'Fringe Season 1', description: 'The complete season 1 of Fri...', imdb_id: '1119644'>
47
+ ```
48
+
49
+ ## Contributing
50
+
51
+ If you've found a bug or have a question, please open an issue on the [issue tracker](https://github.com/jassa/hyper_api/issues). Or, clone the HyperAPI repository, write a failing test case, fix the bug, and submit a pull request.
52
+
53
+ ## License
54
+
55
+ Copyright &copy; 2014 Javier Saldana
56
+
57
+ Released under the MIT license. See [`LICENSE`]](LICENSE) for details.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,20 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'hyper_api/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'hyper_api'
8
+ spec.version = HyperAPI::VERSION
9
+ spec.summary = 'Hypertext API. A sweet DSL to create objects off HTML.'
10
+ spec.license = 'MIT'
11
+
12
+ spec.authors = ['Javier Saldana']
13
+ spec.email = ['javier@javiersaldana.com']
14
+ spec.homepage = 'https://github.com/jassa/hyper_api'
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
+ end
@@ -0,0 +1,5 @@
1
+ require "hyper_api/version"
2
+
3
+ module HyperAPI
4
+ # Code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module HyperAPI
2
+ VERSION = '0.0.0'
3
+ end
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hyper_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Javier Saldana
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-02-15 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description:
15
+ email:
16
+ - javier@javiersaldana.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README.md
25
+ - Rakefile
26
+ - hyper_api.gemspec
27
+ - lib/hyper_api.rb
28
+ - lib/hyper_api/version.rb
29
+ homepage: https://github.com/jassa/hyper_api
30
+ licenses:
31
+ - MIT
32
+ post_install_message:
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubyforge_project:
50
+ rubygems_version: 1.8.23
51
+ signing_key:
52
+ specification_version: 3
53
+ summary: Hypertext API. A sweet DSL to create objects off HTML.
54
+ test_files: []