fire-model 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -6
  3. data/README.md +62 -0
  4. data/VERSION +1 -1
  5. data/fire-model.gemspec +8 -5
  6. metadata +29 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6c2fd8a5b0c94437795c9fb89ba94b2cfcc5b5c
4
- data.tar.gz: ad45e8dbfeebfe2a2f526b1776683520db018781
3
+ metadata.gz: 44abd5f30c54704e18a347a631b9400e6eff418e
4
+ data.tar.gz: 806f699131d7ec47e719fc214c3ccedd066cffe8
5
5
  SHA512:
6
- metadata.gz: d20eea46eda6c341c1704ffe7bbbeefc946d2fee0cc8546c194db45c122bb75bb6b119a052d31c69942a757278a054ecc74ed63d8edde2c30c5a9beeec1e4e46
7
- data.tar.gz: 40c84c04420569fd75259637863d6972673a6274f9599cbe24483cd6e3972e61d53e9ab4499e0c5fe538c30699f7b822dc107a16d1d59b183f3834377d5c29ec
6
+ metadata.gz: cd8efed7e9bd06140741562ec066a9101ab4235b611fd54018f3fb95980c766fb253c5f2809c75f036c720a4218be756d0d5adc1587e49d4ca53ad5866f05eca
7
+ data.tar.gz: 72af16aa94500ed147b4b3ad71bf31e4dfb22caf3e7e5c1daf87fd4a8bf2c44b740c0df170fcd0b5a753f4ed941e52f1a52c14826b1f543902c8f205b5461bac
data/Gemfile CHANGED
@@ -1,18 +1,15 @@
1
1
  source 'http://rubygems.org'
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem 'activesupport', '>= 2.3.5'
2
+ ruby '2.0.0'
5
3
 
6
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
8
4
  gem 'tarvit-helpers'
5
+ gem 'httpclient', '~> 2.6'
6
+ gem 'activesupport', '~> 4.2.2'
9
7
 
10
8
  group :development do
11
9
  gem 'shoulda', '>= 0'
12
10
  gem 'rdoc', '~> 3.12'
13
11
  gem 'rspec', '~> 3.2'
14
12
  gem 'pry', '~> 0.10.1'
15
- gem 'httpclient', '~> 2.6'
16
13
  gem 'bundler', '~> 1.0'
17
14
  gem 'jeweler', '~> 2.0.1'
18
15
  gem 'simplecov', '>= 0'
data/README.md CHANGED
@@ -93,6 +93,68 @@ Point.all.map(&:value)
93
93
  => [ 6, 3, 4]
94
94
  ```
95
95
 
96
+ Create Nested Models
97
+ ```ruby
98
+ class Organization < Fire::Model
99
+ has_path_keys :country, :state
100
+ set_id_key(:name)
101
+ end
102
+
103
+ class Employee < Fire::NestedModel
104
+ nested_in Organization, folder: 'employees'
105
+ has_path_keys :department
106
+ end
107
+
108
+ google = Organization.create(name: 'Google', country: 'USA', state: 'CA')
109
+ apple = Organization.create(name: 'Apple', country: 'USA', state: 'CA')
110
+
111
+ larry = Employee.create(name: 'Google', country: 'USA', state: 'CA',
112
+ department: 'HQ', full_name: 'Larry Page', position: 'CEO')
113
+
114
+ employee = Organization.query(name: 'Google').first.nested_employees.first
115
+ larry == employee
116
+ => true
117
+
118
+ employee.department = 'Research'
119
+ employee.save
120
+ => true
121
+
122
+ tim = apple.add_to_employees(
123
+ full_name: 'Tim Cook',
124
+ position: 'CEO',
125
+ department: 'HQ'
126
+ )
127
+
128
+ Fire.connection.get(?/).body
129
+ => {'Organization'=>
130
+ {'usa'=>
131
+ {'ca'=>
132
+ {'apple'=>
133
+ {'country'=>'USA',
134
+ 'employees'=>
135
+ {'hq'=>
136
+ {'h543ka'=>
137
+ {'department'=>'HQ',
138
+ 'full_name'=>'Tim Cook',
139
+ 'id'=>'h543ka',
140
+ 'position'=>'CEO'}}},
141
+ 'name'=>'Apple',
142
+ 'state'=>'CA'},
143
+ 'google'=>
144
+ {'country'=>'USA',
145
+ 'employees'=>
146
+ {'research'=>
147
+ {'d23h1a'=>
148
+ {'department'=>'Research',
149
+ 'full_name'=>'Larry Page',
150
+ 'id'=>'d23h1a',
151
+ 'position'=>'CEO'}}},
152
+ 'name'=>'Google',
153
+ 'state'=>'CA'}}}}}
154
+
155
+
156
+ ```
157
+
96
158
 
97
159
  **Contributing to fire-model**
98
160
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
data/fire-model.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: fire-model 0.0.6 ruby lib
5
+ # stub: fire-model 0.0.7 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "fire-model"
9
- s.version = "0.0.6"
9
+ s.version = "0.0.7"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -47,32 +47,35 @@ Gem::Specification.new do |s|
47
47
 
48
48
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
49
  s.add_runtime_dependency(%q<tarvit-helpers>, [">= 0"])
50
+ s.add_runtime_dependency(%q<httpclient>, ["~> 2.6"])
51
+ s.add_runtime_dependency(%q<activesupport>, ["~> 4.2.2"])
50
52
  s.add_development_dependency(%q<shoulda>, [">= 0"])
51
53
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
52
54
  s.add_development_dependency(%q<rspec>, ["~> 3.2"])
53
55
  s.add_development_dependency(%q<pry>, ["~> 0.10.1"])
54
- s.add_development_dependency(%q<httpclient>, ["~> 2.6"])
55
56
  s.add_development_dependency(%q<bundler>, ["~> 1.0"])
56
57
  s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
57
58
  s.add_development_dependency(%q<simplecov>, [">= 0"])
58
59
  else
59
60
  s.add_dependency(%q<tarvit-helpers>, [">= 0"])
61
+ s.add_dependency(%q<httpclient>, ["~> 2.6"])
62
+ s.add_dependency(%q<activesupport>, ["~> 4.2.2"])
60
63
  s.add_dependency(%q<shoulda>, [">= 0"])
61
64
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
62
65
  s.add_dependency(%q<rspec>, ["~> 3.2"])
63
66
  s.add_dependency(%q<pry>, ["~> 0.10.1"])
64
- s.add_dependency(%q<httpclient>, ["~> 2.6"])
65
67
  s.add_dependency(%q<bundler>, ["~> 1.0"])
66
68
  s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
67
69
  s.add_dependency(%q<simplecov>, [">= 0"])
68
70
  end
69
71
  else
70
72
  s.add_dependency(%q<tarvit-helpers>, [">= 0"])
73
+ s.add_dependency(%q<httpclient>, ["~> 2.6"])
74
+ s.add_dependency(%q<activesupport>, ["~> 4.2.2"])
71
75
  s.add_dependency(%q<shoulda>, [">= 0"])
72
76
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
73
77
  s.add_dependency(%q<rspec>, ["~> 3.2"])
74
78
  s.add_dependency(%q<pry>, ["~> 0.10.1"])
75
- s.add_dependency(%q<httpclient>, ["~> 2.6"])
76
79
  s.add_dependency(%q<bundler>, ["~> 1.0"])
77
80
  s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
78
81
  s.add_dependency(%q<simplecov>, [">= 0"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fire-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitaly Tarasenko
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: httpclient
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '2.6'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '2.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: activesupport
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 4.2.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 4.2.2
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: shoulda
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,20 +108,6 @@ dependencies:
80
108
  - - ~>
81
109
  - !ruby/object:Gem::Version
82
110
  version: 0.10.1
83
- - !ruby/object:Gem::Dependency
84
- name: httpclient
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ~>
88
- - !ruby/object:Gem::Version
89
- version: '2.6'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ~>
95
- - !ruby/object:Gem::Version
96
- version: '2.6'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: bundler
99
113
  requirement: !ruby/object:Gem::Requirement