norseal-api 0.1.2 → 0.1.3

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: 173e72fdfee7604af88414696196d8d7e338a55a
4
- data.tar.gz: 758604aced9b22f3251f5005be142699cd5b12b7
3
+ metadata.gz: 9134aaf610371030f8838b7adb0e8ab06aeead91
4
+ data.tar.gz: c6ffa4030d4a7fc2b93a682e480635754184cccf
5
5
  SHA512:
6
- metadata.gz: 0d83f8ea089fe9ec846916909cb4ff25b212cd49c7a67a3dddba79262799955e5a758104700f67a6173e453d67c7fb2d32f0efc9d9f3a102ddaf2317db0d3068
7
- data.tar.gz: fa9032b4b449252f5377140de0bbd1ad29b852d5869056844731498ceea8f70ffbe99284c7f48d76c4c88cfc87872ad2e1001fbdfb3786f7f6eb3ab8c1ca6e5e
6
+ metadata.gz: 611065902bf086be3da52cf0bb975cdc16e0687066961085d5420e06e46bc1b97e2549bb6178961005947088dc4fe48eb5a14773623e1ab6e0c57f104256f9c1
7
+ data.tar.gz: a4da31cfeb3849c594006be3f8d5c2f0b3d1385c8e484e6bd61767329f0686bd74590454e8f852bf0169280276b105d2455ea19223fc803b278fee82ca08d9f9
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
@@ -1,4 +1,5 @@
1
1
  require 'her'
2
+ require 'faraday_middleware'
2
3
  require 'active_support/concern'
3
4
  require 'norseal/api/model'
4
5
 
@@ -10,7 +11,7 @@ module Norseal
10
11
  @api = Her::API.new
11
12
 
12
13
  @api.setup :url => "http://#{host}/" do |c|
13
- # c.use FaradayMiddleware::EncodeJson
14
+ c.use FaradayMiddleware::EncodeJson
14
15
  c.use Her::Middleware::AcceptJSON
15
16
  c.use Her::Middleware::FirstLevelParseJSON
16
17
 
@@ -21,8 +22,8 @@ module Norseal
21
22
  c.adapter Faraday.default_adapter unless c.builder.handlers.include?(Faraday::Adapter::Test)
22
23
  end
23
24
 
24
- require "api/resources/collection"
25
- require "api/resources/product"
25
+ require "norseal/api/resources/collection"
26
+ require "norseal/api/resources/product"
26
27
  end
27
28
 
28
29
  def self.api
@@ -0,0 +1,12 @@
1
+ module Norseal
2
+ module Api
3
+ module Model
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ use_api Norseal::Api.api
8
+ # parse_root_in_json true, format: :active_model_serializers
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ module Norseal
2
+ module Api
3
+ class Collection
4
+ include Her::Model
5
+ include Norseal::Api::Model
6
+
7
+ has_many :products
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Norseal
2
+ module Api
3
+ class Product
4
+ include Her::Model
5
+ include Norseal::Api::Model
6
+
7
+ collection_path "collections/:collection_id/products"
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  module Norseal
2
2
  module Api
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Barton
@@ -98,6 +98,9 @@ files:
98
98
  - bin/console
99
99
  - bin/setup
100
100
  - lib/norseal/api.rb
101
+ - lib/norseal/api/model.rb
102
+ - lib/norseal/api/resources/collection.rb
103
+ - lib/norseal/api/resources/product.rb
101
104
  - lib/norseal/api/version.rb
102
105
  - norseal-api.gemspec
103
106
  homepage: http://norseal.co.uk