ar_http_wrapper 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,37 +8,37 @@ class ActiveRecordHttpWrapper
8
8
  end
9
9
 
10
10
  def self.build
11
- OpenStruct.new get(to_path("/new")).try(:body)
11
+ OpenStruct.new get(to_path("/new"))
12
12
  end
13
13
 
14
14
  def self.create(args={})
15
15
  options = { :body => args[:params] }
16
- OpenStruct.new post(to_path("/"), options).try(:body)
16
+ OpenStruct.new post(to_path("/"), options)
17
17
  end
18
18
 
19
19
  def update_attributes(args={})
20
20
  options = { :body => args[:params] }
21
- OpenStruct.new put(to_path("/"), options).try(:body)
21
+ OpenStruct.new put(to_path("/"), options)
22
22
  end
23
23
 
24
24
  def self.find_by_id(_id)
25
- OpenStruct.new get(new(:id => _id).send(:to_path)).try(:body)
25
+ OpenStruct.new get(new(:id => _id).send(:to_path))
26
26
  end
27
27
 
28
28
  def destroy
29
- OpenStruct.new delete(send(:to_path)).try(:body)
29
+ OpenStruct.new delete(send(:to_path))
30
30
  end
31
31
 
32
32
  def self.where(conditions)
33
33
  options = {:body => {:conditions => conditions}}
34
- get(to_path("/"), options).try(:body).try(:map) { |h| OpenStruct.new(h) }
34
+ get(to_path("/"), options).try(:map) { |h| OpenStruct.new(h) }
35
35
  end
36
36
 
37
37
  def self.find_each(batch_size=1000,&block)
38
38
  n_batches = (count / batch_size).to_i + 1
39
39
  n_batches.times do |i|
40
40
  options = {:body => {:offset => i * batch_size, :limit => batch_size}}
41
- records = get(to_path("/"), options).try(:body).try(:map) { |h| OpenStruct.new(h) }
41
+ records = get(to_path("/"), options).try(:map) { |h| OpenStruct.new(h) }
42
42
  yield records if block_given?
43
43
  end
44
44
  end
@@ -1,3 +1,3 @@
1
1
  module ArHttpWrapper
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar_http_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: