castle-her 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.rspec +1 -0
- data/.travis.yml +17 -0
- data/.yardopts +2 -0
- data/CONTRIBUTING.md +26 -0
- data/Gemfile +10 -0
- data/LICENSE +7 -0
- data/README.md +1017 -0
- data/Rakefile +11 -0
- data/UPGRADE.md +110 -0
- data/castle-her.gemspec +30 -0
- data/gemfiles/Gemfile.activemodel-3.2.x +7 -0
- data/gemfiles/Gemfile.activemodel-4.0 +7 -0
- data/gemfiles/Gemfile.activemodel-4.1 +7 -0
- data/gemfiles/Gemfile.activemodel-4.2 +7 -0
- data/gemfiles/Gemfile.activemodel-5.0.x +7 -0
- data/lib/castle-her.rb +20 -0
- data/lib/castle-her/api.rb +113 -0
- data/lib/castle-her/collection.rb +12 -0
- data/lib/castle-her/errors.rb +27 -0
- data/lib/castle-her/json_api/model.rb +46 -0
- data/lib/castle-her/middleware.rb +12 -0
- data/lib/castle-her/middleware/accept_json.rb +17 -0
- data/lib/castle-her/middleware/first_level_parse_json.rb +36 -0
- data/lib/castle-her/middleware/json_api_parser.rb +36 -0
- data/lib/castle-her/middleware/parse_json.rb +21 -0
- data/lib/castle-her/middleware/second_level_parse_json.rb +36 -0
- data/lib/castle-her/model.rb +75 -0
- data/lib/castle-her/model/associations.rb +141 -0
- data/lib/castle-her/model/associations/association.rb +103 -0
- data/lib/castle-her/model/associations/association_proxy.rb +45 -0
- data/lib/castle-her/model/associations/belongs_to_association.rb +96 -0
- data/lib/castle-her/model/associations/has_many_association.rb +100 -0
- data/lib/castle-her/model/associations/has_one_association.rb +79 -0
- data/lib/castle-her/model/attributes.rb +284 -0
- data/lib/castle-her/model/base.rb +33 -0
- data/lib/castle-her/model/deprecated_methods.rb +61 -0
- data/lib/castle-her/model/http.rb +114 -0
- data/lib/castle-her/model/introspection.rb +65 -0
- data/lib/castle-her/model/nested_attributes.rb +45 -0
- data/lib/castle-her/model/orm.rb +207 -0
- data/lib/castle-her/model/parse.rb +216 -0
- data/lib/castle-her/model/paths.rb +126 -0
- data/lib/castle-her/model/relation.rb +164 -0
- data/lib/castle-her/version.rb +3 -0
- data/spec/api_spec.rb +114 -0
- data/spec/collection_spec.rb +26 -0
- data/spec/json_api/model_spec.rb +166 -0
- data/spec/middleware/accept_json_spec.rb +10 -0
- data/spec/middleware/first_level_parse_json_spec.rb +62 -0
- data/spec/middleware/json_api_parser_spec.rb +32 -0
- data/spec/middleware/second_level_parse_json_spec.rb +35 -0
- data/spec/model/associations/association_proxy_spec.rb +31 -0
- data/spec/model/associations_spec.rb +504 -0
- data/spec/model/attributes_spec.rb +389 -0
- data/spec/model/callbacks_spec.rb +145 -0
- data/spec/model/dirty_spec.rb +91 -0
- data/spec/model/http_spec.rb +158 -0
- data/spec/model/introspection_spec.rb +76 -0
- data/spec/model/nested_attributes_spec.rb +134 -0
- data/spec/model/orm_spec.rb +506 -0
- data/spec/model/parse_spec.rb +345 -0
- data/spec/model/paths_spec.rb +347 -0
- data/spec/model/relation_spec.rb +226 -0
- data/spec/model/validations_spec.rb +42 -0
- data/spec/model_spec.rb +44 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/support/extensions/array.rb +5 -0
- data/spec/support/extensions/hash.rb +5 -0
- data/spec/support/macros/her_macros.rb +17 -0
- data/spec/support/macros/model_macros.rb +36 -0
- data/spec/support/macros/request_macros.rb +27 -0
- metadata +290 -0
@@ -0,0 +1,226 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.join(File.dirname(__FILE__), "../spec_helper.rb")
|
3
|
+
|
4
|
+
describe Her::Model::Relation do
|
5
|
+
describe :where do
|
6
|
+
context "for base classes" do
|
7
|
+
before do
|
8
|
+
Her::API.setup :url => "https://api.example.com" do |builder|
|
9
|
+
builder.use Her::Middleware::FirstLevelParseJSON
|
10
|
+
builder.adapter :test do |stub|
|
11
|
+
stub.get("/users?foo=1&bar=2") { |env| ok! [{ :id => 2, :fullname => "Tobias Fünke" }] }
|
12
|
+
stub.get("/users?admin=1") { |env| ok! [{ :id => 1, :fullname => "Tobias Fünke" }] }
|
13
|
+
|
14
|
+
stub.get("/users") do |env|
|
15
|
+
ok! [
|
16
|
+
{ :id => 1, :fullname => "Tobias Fünke" },
|
17
|
+
{ :id => 2, :fullname => "Lindsay Fünke" },
|
18
|
+
@created_user,
|
19
|
+
].compact
|
20
|
+
end
|
21
|
+
|
22
|
+
stub.post('/users') do |env|
|
23
|
+
@created_user = { :id => 3, :fullname => 'George Michael Bluth' }
|
24
|
+
ok! @created_user
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
spawn_model "Foo::User"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "doesn't fetch the data immediatly" do
|
33
|
+
expect(Foo::User).not_to receive(:request)
|
34
|
+
@users = Foo::User.where(:admin => 1)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "fetches the data and passes query parameters" do
|
38
|
+
expect(Foo::User).to receive(:request).once.and_call_original
|
39
|
+
@users = Foo::User.where(:admin => 1)
|
40
|
+
expect(@users).to respond_to(:length)
|
41
|
+
expect(@users.size).to eq(1)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "chains multiple where statements" do
|
45
|
+
@user = Foo::User.where(:foo => 1).where(:bar => 2).first
|
46
|
+
expect(@user.id).to eq(2)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "does not reuse relations" do
|
50
|
+
expect(Foo::User.all.size).to eq(2)
|
51
|
+
expect(Foo::User.create(:fullname => 'George Michael Bluth').id).to eq(3)
|
52
|
+
expect(Foo::User.all.size).to eq(3)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "for parent class" do
|
57
|
+
before do
|
58
|
+
Her::API.setup :url => "https://api.example.com" do |builder|
|
59
|
+
builder.use Her::Middleware::FirstLevelParseJSON
|
60
|
+
builder.adapter :test do |stub|
|
61
|
+
stub.get("/users?page=2") { |env| ok! [{ :id => 1, :fullname => "Tobias Fünke" }, { :id => 2, :fullname => "Lindsay Fünke" }] }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
spawn_model("Foo::Model") do
|
66
|
+
scope :page, lambda { |page| where(:page => page) }
|
67
|
+
end
|
68
|
+
|
69
|
+
class User < Foo::Model; end
|
70
|
+
@spawned_models << :User
|
71
|
+
end
|
72
|
+
|
73
|
+
it "propagates the scopes through its children" do
|
74
|
+
@users = User.page(2)
|
75
|
+
expect(@users.length).to eq(2)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe :create do
|
81
|
+
before do
|
82
|
+
Her::API.setup :url => "https://api.example.com" do |builder|
|
83
|
+
builder.use Her::Middleware::FirstLevelParseJSON
|
84
|
+
builder.use Faraday::Request::UrlEncoded
|
85
|
+
builder.adapter :test do |stub|
|
86
|
+
stub.post("/users") { |env| ok! :id => 1, :fullname => params(env)[:fullname], :email => params(env)[:email] }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
spawn_model "Foo::User"
|
91
|
+
end
|
92
|
+
|
93
|
+
context "with a single where call" do
|
94
|
+
it "creates a resource and passes the query parameters" do
|
95
|
+
@user = Foo::User.where(:fullname => "Tobias Fünke", :email => "tobias@bluth.com").create
|
96
|
+
expect(@user.id).to eq(1)
|
97
|
+
expect(@user.fullname).to eq("Tobias Fünke")
|
98
|
+
expect(@user.email).to eq("tobias@bluth.com")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
context "with multiple where calls" do
|
103
|
+
it "creates a resource and passes the query parameters" do
|
104
|
+
@user = Foo::User.where(:fullname => "Tobias Fünke").create(:email => "tobias@bluth.com")
|
105
|
+
expect(@user.id).to eq(1)
|
106
|
+
expect(@user.fullname).to eq("Tobias Fünke")
|
107
|
+
expect(@user.email).to eq("tobias@bluth.com")
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe :build do
|
113
|
+
before { spawn_model "Foo::User" }
|
114
|
+
|
115
|
+
it "handles new resource with build" do
|
116
|
+
@new_user = Foo::User.where(:fullname => "Tobias Fünke").build
|
117
|
+
expect(@new_user.new?).to be_truthy
|
118
|
+
expect(@new_user.fullname).to eq("Tobias Fünke")
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe :scope do
|
123
|
+
before do
|
124
|
+
Her::API.setup :url => "https://api.example.com" do |builder|
|
125
|
+
builder.use Her::Middleware::FirstLevelParseJSON
|
126
|
+
builder.adapter :test do |stub|
|
127
|
+
stub.get("/users?what=4&where=3") { |env| ok! [{ :id => 3, :fullname => "Maeby Fünke" }] }
|
128
|
+
stub.get("/users?what=2") { |env| ok! [{ :id => 2, :fullname => "Lindsay Fünke" }] }
|
129
|
+
stub.get("/users?where=6") { |env| ok! [{ :id => 4, :fullname => "Tobias Fünke" }] }
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
spawn_model 'Foo::User' do
|
134
|
+
scope :foo, lambda { |v| where(:what => v) }
|
135
|
+
scope :bar, lambda { |v| where(:where => v) }
|
136
|
+
scope :baz, lambda { bar(6) }
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
it "passes query parameters" do
|
141
|
+
@user = Foo::User.foo(2).first
|
142
|
+
expect(@user.id).to eq(2)
|
143
|
+
end
|
144
|
+
|
145
|
+
it "passes multiple query parameters" do
|
146
|
+
@user = Foo::User.foo(4).bar(3).first
|
147
|
+
expect(@user.id).to eq(3)
|
148
|
+
end
|
149
|
+
|
150
|
+
it "handles embedded scopes" do
|
151
|
+
@user = Foo::User.baz.first
|
152
|
+
expect(@user.id).to eq(4)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
describe :default_scope do
|
157
|
+
context "for new objects" do
|
158
|
+
before do
|
159
|
+
spawn_model 'Foo::User' do
|
160
|
+
default_scope lambda { where(:active => true) }
|
161
|
+
default_scope lambda { where(:admin => true) }
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
it "should apply the scope to the attributes" do
|
166
|
+
expect(Foo::User.new).to be_active
|
167
|
+
expect(Foo::User.new).to be_admin
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
context "for fetched resources" do
|
172
|
+
before do
|
173
|
+
Her::API.setup :url => "https://api.example.com" do |builder|
|
174
|
+
builder.use Her::Middleware::FirstLevelParseJSON
|
175
|
+
builder.use Faraday::Request::UrlEncoded
|
176
|
+
builder.adapter :test do |stub|
|
177
|
+
stub.post("/users") { |env| ok! :id => 3, :active => (params(env)[:active] == "true" ? true : false) }
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
spawn_model 'Foo::User' do
|
182
|
+
default_scope lambda { where(:active => true) }
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
it("should apply the scope to the request") { expect(Foo::User.create).to be_active }
|
187
|
+
end
|
188
|
+
|
189
|
+
context "for fetched collections" do
|
190
|
+
before do
|
191
|
+
Her::API.setup :url => "https://api.example.com" do |builder|
|
192
|
+
builder.use Her::Middleware::FirstLevelParseJSON
|
193
|
+
builder.use Faraday::Request::UrlEncoded
|
194
|
+
builder.adapter :test do |stub|
|
195
|
+
stub.get("/users?active=true") { |env| ok! [{ :id => 3, :active => (params(env)[:active] == "true" ? true : false) }] }
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
spawn_model 'Foo::User' do
|
200
|
+
default_scope lambda { where(:active => true) }
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
it("should apply the scope to the request") { expect(Foo::User.all.first).to be_active }
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
describe :map do
|
209
|
+
before do
|
210
|
+
Her::API.setup :url => "https://api.example.com" do |builder|
|
211
|
+
builder.use Her::Middleware::FirstLevelParseJSON
|
212
|
+
builder.adapter :test do |stub|
|
213
|
+
stub.get("/users") do |env|
|
214
|
+
ok! [{ :id => 1, :fullname => "Tobias Fünke" }, { :id => 2, :fullname => "Lindsay Fünke" }]
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
spawn_model 'Foo::User'
|
220
|
+
end
|
221
|
+
|
222
|
+
it "delegates the method to the fetched collection" do
|
223
|
+
expect(Foo::User.all.map(&:fullname)).to eq(["Tobias Fünke", "Lindsay Fünke"])
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.join(File.dirname(__FILE__), "../spec_helper.rb")
|
3
|
+
|
4
|
+
describe "Her::Model and ActiveModel::Validations" do
|
5
|
+
context "validating attributes" do
|
6
|
+
before do
|
7
|
+
spawn_model "Foo::User" do
|
8
|
+
attributes :fullname, :email
|
9
|
+
validates_presence_of :fullname
|
10
|
+
validates_presence_of :email
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it "validates attributes when calling #valid?" do
|
15
|
+
user = Foo::User.new
|
16
|
+
expect(user).not_to be_valid
|
17
|
+
expect(user.errors.full_messages).to include("Fullname can't be blank")
|
18
|
+
expect(user.errors.full_messages).to include("Email can't be blank")
|
19
|
+
user.fullname = "Tobias Fünke"
|
20
|
+
user.email = "tobias@bluthcompany.com"
|
21
|
+
expect(user).to be_valid
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "handling server errors" do
|
26
|
+
before do
|
27
|
+
spawn_model("Foo::Model") do
|
28
|
+
def errors
|
29
|
+
@response_errors
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class User < Foo::Model; end
|
34
|
+
@spawned_models << :User
|
35
|
+
end
|
36
|
+
|
37
|
+
it "validates attributes when calling #valid?" do
|
38
|
+
user = User.new(:_errors => ["Email cannot be blank"])
|
39
|
+
expect(user.errors).to include("Email cannot be blank")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/spec/model_spec.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Her::Model do
|
5
|
+
before do
|
6
|
+
Her::API.setup :url => "https://api.example.com" do |connection|
|
7
|
+
connection.use Her::Middleware::FirstLevelParseJSON
|
8
|
+
connection.adapter :test do |stub|
|
9
|
+
stub.get("/users/1") { |env| [200, {}, { :id => 1, :name => "Tobias Fünke" }.to_json] }
|
10
|
+
stub.get("/users/1/comments") { |env| [200, {}, [{ :id => 4, :body => "They're having a FIRESALE?" }].to_json] }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
spawn_model("Foo::User") { has_many :comments }
|
15
|
+
spawn_model("Foo::Comment")
|
16
|
+
end
|
17
|
+
subject { Foo::User.find(1) }
|
18
|
+
|
19
|
+
describe :has_key? do
|
20
|
+
it { should_not have_key(:unknown_method_for_a_user) }
|
21
|
+
it { should_not have_key(:unknown_method_for_a_user) }
|
22
|
+
it { should have_key(:name) }
|
23
|
+
it { should have_key(:comments) }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe :serialization do
|
27
|
+
it 'should be serialized without an error' do
|
28
|
+
expect { Marshal.dump(subject.comments) }.not_to raise_error
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should correctly load serialized object' do
|
32
|
+
serialized_comments = Marshal.load(Marshal.dump(subject.comments))
|
33
|
+
expect(subject.comments.size).to eq(serialized_comments.size)
|
34
|
+
expect(subject.comments.first.id).to eq(serialized_comments.first.id)
|
35
|
+
expect(subject.comments.first.body).to eq(serialized_comments.first.body)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe :[] do
|
40
|
+
it { should_not have_key(:unknown_method_for_a_user) }
|
41
|
+
specify { expect(subject[:name]).to eq("Tobias Fünke") }
|
42
|
+
specify { expect(subject[:comments].first.body).to eq("They're having a FIRESALE?") }
|
43
|
+
end
|
44
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
2
|
+
|
3
|
+
require "rspec"
|
4
|
+
require "rspec/its"
|
5
|
+
require "castle-her"
|
6
|
+
|
7
|
+
# Require everything in `spec/support`
|
8
|
+
Dir[File.expand_path('../../spec/support/**/*.rb', __FILE__)].map(&method(:require))
|
9
|
+
|
10
|
+
# Remove ActiveModel deprecation message
|
11
|
+
I18n.enforce_available_locales = false
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.include Her::Testing::Macros::ModelMacros
|
15
|
+
config.include Her::Testing::Macros::RequestMacros
|
16
|
+
|
17
|
+
config.before :each do
|
18
|
+
@spawned_models = []
|
19
|
+
end
|
20
|
+
|
21
|
+
config.after :each do
|
22
|
+
@spawned_models.each do |model|
|
23
|
+
Object.instance_eval { remove_const model } if Object.const_defined?(model)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Her
|
2
|
+
module Testing
|
3
|
+
module Macros
|
4
|
+
module ModelMacros
|
5
|
+
# Create a class and automatically inject Her::Model into it
|
6
|
+
def spawn_model(klass, options={}, &block)
|
7
|
+
super_class = options[:super_class]
|
8
|
+
model_type = options[:type] || Her::Model
|
9
|
+
new_class = if super_class
|
10
|
+
Class.new(super_class)
|
11
|
+
else
|
12
|
+
Class.new
|
13
|
+
end
|
14
|
+
if klass =~ /::/
|
15
|
+
base, submodel = klass.split(/::/).map{ |s| s.to_sym }
|
16
|
+
Object.const_set(base, Module.new) unless Object.const_defined?(base)
|
17
|
+
Object.const_get(base).module_eval do
|
18
|
+
remove_const submodel if constants.map(&:to_sym).include?(submodel)
|
19
|
+
submodel = const_set(submodel, new_class)
|
20
|
+
submodel.send(:include, model_type)
|
21
|
+
submodel.class_eval(&block) if block_given?
|
22
|
+
end
|
23
|
+
|
24
|
+
@spawned_models << base
|
25
|
+
else
|
26
|
+
Object.instance_eval { remove_const klass } if Object.const_defined?(klass)
|
27
|
+
Object.const_set(klass, Class.new).send(:include, model_type)
|
28
|
+
Object.const_get(klass).class_eval(&block) if block_given?
|
29
|
+
|
30
|
+
@spawned_models << klass.to_sym
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Her
|
2
|
+
module Testing
|
3
|
+
module Macros
|
4
|
+
module RequestMacros
|
5
|
+
def ok!(body)
|
6
|
+
[200, {}, body.to_json]
|
7
|
+
end
|
8
|
+
|
9
|
+
def error!(body)
|
10
|
+
[400, {}, body.to_json]
|
11
|
+
end
|
12
|
+
|
13
|
+
def params(env)
|
14
|
+
@params ||= begin
|
15
|
+
parsed_query = Faraday::Utils.parse_nested_query(env[:body])
|
16
|
+
|
17
|
+
if parsed_query
|
18
|
+
parsed_query.with_indifferent_access.merge(env[:params])
|
19
|
+
else
|
20
|
+
env[:params].with_indifferent_access
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,290 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: castle-her
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rémi Prévost
|
8
|
+
- Filip Tepper
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-07-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 11.2.2
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 11.2.2
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rspec
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 3.5.0
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 3.5.0
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec-its
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: fivemat
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.2'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.2'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: json
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 2.0.1
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 2.0.1
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: activemodel
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 3.0.0
|
91
|
+
- - "<="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 5.1.0
|
94
|
+
type: :runtime
|
95
|
+
prerelease: false
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 3.0.0
|
101
|
+
- - "<="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 5.1.0
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: activesupport
|
106
|
+
requirement: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 3.0.0
|
111
|
+
- - "<="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 5.1.0
|
114
|
+
type: :runtime
|
115
|
+
prerelease: false
|
116
|
+
version_requirements: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 3.0.0
|
121
|
+
- - "<="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 5.1.0
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: faraday
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0.8'
|
131
|
+
- - "<"
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '1.0'
|
134
|
+
type: :runtime
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0.8'
|
141
|
+
- - "<"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '1.0'
|
144
|
+
- !ruby/object:Gem::Dependency
|
145
|
+
name: multi_json
|
146
|
+
requirement: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - "~>"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '1.7'
|
151
|
+
type: :runtime
|
152
|
+
prerelease: false
|
153
|
+
version_requirements: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - "~>"
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '1.7'
|
158
|
+
description: Her is an ORM that maps REST resources and collections to Ruby objects
|
159
|
+
email:
|
160
|
+
- remi@exomel.com
|
161
|
+
- filip@tepper.pl
|
162
|
+
executables: []
|
163
|
+
extensions: []
|
164
|
+
extra_rdoc_files: []
|
165
|
+
files:
|
166
|
+
- ".gitignore"
|
167
|
+
- ".rspec"
|
168
|
+
- ".travis.yml"
|
169
|
+
- ".yardopts"
|
170
|
+
- CONTRIBUTING.md
|
171
|
+
- Gemfile
|
172
|
+
- LICENSE
|
173
|
+
- README.md
|
174
|
+
- Rakefile
|
175
|
+
- UPGRADE.md
|
176
|
+
- castle-her.gemspec
|
177
|
+
- gemfiles/Gemfile.activemodel-3.2.x
|
178
|
+
- gemfiles/Gemfile.activemodel-4.0
|
179
|
+
- gemfiles/Gemfile.activemodel-4.1
|
180
|
+
- gemfiles/Gemfile.activemodel-4.2
|
181
|
+
- gemfiles/Gemfile.activemodel-5.0.x
|
182
|
+
- lib/castle-her.rb
|
183
|
+
- lib/castle-her/api.rb
|
184
|
+
- lib/castle-her/collection.rb
|
185
|
+
- lib/castle-her/errors.rb
|
186
|
+
- lib/castle-her/json_api/model.rb
|
187
|
+
- lib/castle-her/middleware.rb
|
188
|
+
- lib/castle-her/middleware/accept_json.rb
|
189
|
+
- lib/castle-her/middleware/first_level_parse_json.rb
|
190
|
+
- lib/castle-her/middleware/json_api_parser.rb
|
191
|
+
- lib/castle-her/middleware/parse_json.rb
|
192
|
+
- lib/castle-her/middleware/second_level_parse_json.rb
|
193
|
+
- lib/castle-her/model.rb
|
194
|
+
- lib/castle-her/model/associations.rb
|
195
|
+
- lib/castle-her/model/associations/association.rb
|
196
|
+
- lib/castle-her/model/associations/association_proxy.rb
|
197
|
+
- lib/castle-her/model/associations/belongs_to_association.rb
|
198
|
+
- lib/castle-her/model/associations/has_many_association.rb
|
199
|
+
- lib/castle-her/model/associations/has_one_association.rb
|
200
|
+
- lib/castle-her/model/attributes.rb
|
201
|
+
- lib/castle-her/model/base.rb
|
202
|
+
- lib/castle-her/model/deprecated_methods.rb
|
203
|
+
- lib/castle-her/model/http.rb
|
204
|
+
- lib/castle-her/model/introspection.rb
|
205
|
+
- lib/castle-her/model/nested_attributes.rb
|
206
|
+
- lib/castle-her/model/orm.rb
|
207
|
+
- lib/castle-her/model/parse.rb
|
208
|
+
- lib/castle-her/model/paths.rb
|
209
|
+
- lib/castle-her/model/relation.rb
|
210
|
+
- lib/castle-her/version.rb
|
211
|
+
- spec/api_spec.rb
|
212
|
+
- spec/collection_spec.rb
|
213
|
+
- spec/json_api/model_spec.rb
|
214
|
+
- spec/middleware/accept_json_spec.rb
|
215
|
+
- spec/middleware/first_level_parse_json_spec.rb
|
216
|
+
- spec/middleware/json_api_parser_spec.rb
|
217
|
+
- spec/middleware/second_level_parse_json_spec.rb
|
218
|
+
- spec/model/associations/association_proxy_spec.rb
|
219
|
+
- spec/model/associations_spec.rb
|
220
|
+
- spec/model/attributes_spec.rb
|
221
|
+
- spec/model/callbacks_spec.rb
|
222
|
+
- spec/model/dirty_spec.rb
|
223
|
+
- spec/model/http_spec.rb
|
224
|
+
- spec/model/introspection_spec.rb
|
225
|
+
- spec/model/nested_attributes_spec.rb
|
226
|
+
- spec/model/orm_spec.rb
|
227
|
+
- spec/model/parse_spec.rb
|
228
|
+
- spec/model/paths_spec.rb
|
229
|
+
- spec/model/relation_spec.rb
|
230
|
+
- spec/model/validations_spec.rb
|
231
|
+
- spec/model_spec.rb
|
232
|
+
- spec/spec_helper.rb
|
233
|
+
- spec/support/extensions/array.rb
|
234
|
+
- spec/support/extensions/hash.rb
|
235
|
+
- spec/support/macros/her_macros.rb
|
236
|
+
- spec/support/macros/model_macros.rb
|
237
|
+
- spec/support/macros/request_macros.rb
|
238
|
+
homepage: http://her-rb.org
|
239
|
+
licenses:
|
240
|
+
- MIT
|
241
|
+
metadata: {}
|
242
|
+
post_install_message:
|
243
|
+
rdoc_options: []
|
244
|
+
require_paths:
|
245
|
+
- lib
|
246
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - ">="
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '0'
|
251
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
252
|
+
requirements:
|
253
|
+
- - ">="
|
254
|
+
- !ruby/object:Gem::Version
|
255
|
+
version: '0'
|
256
|
+
requirements: []
|
257
|
+
rubyforge_project:
|
258
|
+
rubygems_version: 2.5.1
|
259
|
+
signing_key:
|
260
|
+
specification_version: 4
|
261
|
+
summary: A simple Representational State Transfer-based Hypertext Transfer Protocol-powered
|
262
|
+
Object Relational Mapper. Her?
|
263
|
+
test_files:
|
264
|
+
- spec/api_spec.rb
|
265
|
+
- spec/collection_spec.rb
|
266
|
+
- spec/json_api/model_spec.rb
|
267
|
+
- spec/middleware/accept_json_spec.rb
|
268
|
+
- spec/middleware/first_level_parse_json_spec.rb
|
269
|
+
- spec/middleware/json_api_parser_spec.rb
|
270
|
+
- spec/middleware/second_level_parse_json_spec.rb
|
271
|
+
- spec/model/associations/association_proxy_spec.rb
|
272
|
+
- spec/model/associations_spec.rb
|
273
|
+
- spec/model/attributes_spec.rb
|
274
|
+
- spec/model/callbacks_spec.rb
|
275
|
+
- spec/model/dirty_spec.rb
|
276
|
+
- spec/model/http_spec.rb
|
277
|
+
- spec/model/introspection_spec.rb
|
278
|
+
- spec/model/nested_attributes_spec.rb
|
279
|
+
- spec/model/orm_spec.rb
|
280
|
+
- spec/model/parse_spec.rb
|
281
|
+
- spec/model/paths_spec.rb
|
282
|
+
- spec/model/relation_spec.rb
|
283
|
+
- spec/model/validations_spec.rb
|
284
|
+
- spec/model_spec.rb
|
285
|
+
- spec/spec_helper.rb
|
286
|
+
- spec/support/extensions/array.rb
|
287
|
+
- spec/support/extensions/hash.rb
|
288
|
+
- spec/support/macros/her_macros.rb
|
289
|
+
- spec/support/macros/model_macros.rb
|
290
|
+
- spec/support/macros/request_macros.rb
|