norseal-api 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47cbda0035f1a87d64ed4ecda1fec8a48433a833
4
- data.tar.gz: fcfb623f29e03cd5775939e9e70a17e6c0b000f4
3
+ metadata.gz: aebba70883bbc95f842ad486aea00a8d17708fe0
4
+ data.tar.gz: c4bddf4b2416a2243f20b264c12418f114eee3ca
5
5
  SHA512:
6
- metadata.gz: 665240d6320dc6ed310debac762b75fd4bfce528caa7a0dec74c16f06534025c874e9da943dd2ab07d821835c8c3ba97ea9438252166daecd96d3f220d5753f9
7
- data.tar.gz: ed270c39414029fe520d25dc795177258d33ad7967182c816c8a5cdbb6bfe2154a48b6224e4720092f77a39c6d90ec27541dd7da931b84ea809438d849831e01
6
+ metadata.gz: ed238a3fa30fd3217da9621c9830819e9878e3a0006b30e012159ddabae9b4c881d175579d620ce0bc6ad8b05572283131cdd76a93a908b5cca7373aa0a6a077
7
+ data.tar.gz: 690b3f259c2d9425ab8aa81f7ba43ab09361165720aa4d57bb6a09b7f516f09c2e2ad48aad6956fd6829bed9adf16c536ca54266bc1a4cc5c3a5892dfaa009a3
data/.gitignore CHANGED
@@ -7,9 +7,3 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
15
- *.gem
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/LICENSE.txt CHANGED
@@ -1,22 +1,21 @@
1
- Copyright (c) 2015 Jamie Barton
1
+ The MIT License (MIT)
2
2
 
3
- MIT License
3
+ Copyright (c) 2015 Jamie Barton
4
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:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
12
11
 
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
15
14
 
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.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Norseal::Api
2
2
 
3
- TODO: Write a gem description
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/norseal/api`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
4
6
 
5
7
  ## Installation
6
8
 
@@ -22,6 +24,12 @@ Or install it yourself as:
22
24
 
23
25
  TODO: Write usage instructions here
24
26
 
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ 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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
25
33
  ## Contributing
26
34
 
27
35
  1. Fork it ( https://github.com/[my-github-username]/norseal-api/fork )
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "norseal/api"
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
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/lib/norseal/api.rb CHANGED
@@ -1,11 +1,33 @@
1
- # require "norseal/api/version"
1
+ require 'her'
2
+ require 'active_support/concern'
3
+ require 'norseal/api/model'
2
4
 
3
5
  module Norseal
4
6
  module Api
5
- class Product
6
- def self.addition(num, num2)
7
- num + num2
7
+ class ClientNotConfigured < Exception; end
8
+
9
+ def self.configure(host, api_key, &block)
10
+ @api = Her::API.new
11
+
12
+ @api.setup :url => "http://#{host}/" do |c|
13
+ # c.use FaradayMiddleware::EncodeJson
14
+ c.use Her::Middleware::AcceptJSON
15
+ c.use Her::Middleware::FirstLevelParseJSON
16
+
17
+ c.authorization :token, api_key
18
+
19
+ yield c if block_given?
20
+
21
+ c.adapter Faraday.default_adapter unless c.builder.handlers.include?(Faraday::Adapter::Test)
8
22
  end
23
+
24
+ require "norseal/api/resources/collection"
25
+ require "norseal/api/resources/product"
26
+ end
27
+
28
+ def self.api
29
+ raise ClientNotConfigured.new("Norseal") unless @api
30
+ @api
9
31
  end
10
32
  end
11
33
  end
@@ -1,5 +1,5 @@
1
1
  module Norseal
2
2
  module Api
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
data/norseal-api.gemspec CHANGED
@@ -8,16 +8,19 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Norseal::Api::VERSION
9
9
  spec.authors = ["Jamie Barton"]
10
10
  spec.email = ["jamie@codethisway.com"]
11
- spec.summary = %q{API middleware for Norseal.}
12
- spec.description = %q{Authenticate and talk with the Norseal database.}
13
- spec.homepage = ""
11
+
12
+ spec.summary = %q{Consume the Norseal API.}
13
+ spec.description = %q{This middleware uses Her & Faraday for consuming the Norseal Api}
14
+ spec.homepage = "http://norseal.co.uk"
14
15
  spec.license = "MIT"
15
16
 
16
- spec.files = `git ls-files -z`.split("\x0")
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.7"
21
+ spec.add_dependency 'her'
22
+ spec.add_dependency 'activesupport'
23
+ spec.add_dependency 'faraday_middleware'
24
+ spec.add_development_dependency "bundler", "~> 1.8"
22
25
  spec.add_development_dependency "rake", "~> 10.0"
23
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: norseal-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Barton
@@ -10,20 +10,62 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2015-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: her
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: faraday_middleware
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
13
55
  - !ruby/object:Gem::Dependency
14
56
  name: bundler
15
57
  requirement: !ruby/object:Gem::Requirement
16
58
  requirements:
17
59
  - - "~>"
18
60
  - !ruby/object:Gem::Version
19
- version: '1.7'
61
+ version: '1.8'
20
62
  type: :development
21
63
  prerelease: false
22
64
  version_requirements: !ruby/object:Gem::Requirement
23
65
  requirements:
24
66
  - - "~>"
25
67
  - !ruby/object:Gem::Version
26
- version: '1.7'
68
+ version: '1.8'
27
69
  - !ruby/object:Gem::Dependency
28
70
  name: rake
29
71
  requirement: !ruby/object:Gem::Requirement
@@ -38,22 +80,27 @@ dependencies:
38
80
  - - "~>"
39
81
  - !ruby/object:Gem::Version
40
82
  version: '10.0'
41
- description: Authenticate and talk with the Norseal database.
83
+ description: This middleware uses Her & Faraday for consuming the Norseal Api
42
84
  email:
43
85
  - jamie@codethisway.com
44
- executables: []
86
+ executables:
87
+ - console
88
+ - setup
45
89
  extensions: []
46
90
  extra_rdoc_files: []
47
91
  files:
48
92
  - ".gitignore"
93
+ - CODE_OF_CONDUCT.md
49
94
  - Gemfile
50
95
  - LICENSE.txt
51
96
  - README.md
52
97
  - Rakefile
98
+ - bin/console
99
+ - bin/setup
53
100
  - lib/norseal/api.rb
54
101
  - lib/norseal/api/version.rb
55
102
  - norseal-api.gemspec
56
- homepage: ''
103
+ homepage: http://norseal.co.uk
57
104
  licenses:
58
105
  - MIT
59
106
  metadata: {}
@@ -76,5 +123,5 @@ rubyforge_project:
76
123
  rubygems_version: 2.4.5
77
124
  signing_key:
78
125
  specification_version: 4
79
- summary: API middleware for Norseal.
126
+ summary: Consume the Norseal API.
80
127
  test_files: []