materialize 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe89fc660844446585a40d596f036e7fd7877f90
4
- data.tar.gz: 9476cb0f553048ff2f045a6b7aa4aeef385768ed
3
+ metadata.gz: 2d3c35112a52f54064b134de43a682a32e6e3b6b
4
+ data.tar.gz: 4316b68d51a8e4f41555ae602fe81f87d83d2493
5
5
  SHA512:
6
- metadata.gz: 1566e3118800659b679d9443ed8fe75a8865831180977b19c08794dcea319402218a94878d94a2a011f37705c0d7573a0e45919b4c19824e80ad5e15abdcec44
7
- data.tar.gz: 1dae6b75e81b724b372e1e74848531df063d96f29b0669efddc7a01b864ce5ddf3cc93560d78856ec321cbc173aadab6b95edbcd21729c4afa08e7d2de5ab260
6
+ metadata.gz: 5742f7c7a8a3b6127b9a7540c94f781063213481244c6dbe833ca4a27b9bc8e73efbe9e3c8af6388f8ed8bb961620e2d2d048be91fcf5fdd0394bc36e4d5b610
7
+ data.tar.gz: e263942bc017d88bdcc6fd197c3b43930aadcd2596a6609b588c9f6199a25ccf1908d40db7749e4529f565f42a46712554fb7d383ffab38e8fb6d9dbfc20a370
@@ -15,7 +15,9 @@ module Materialize
15
15
  data, builder_class = process(data_source_class, query, args_to_pass)
16
16
  options.delete(:args)
17
17
 
18
- if data.is_a?(Array)
18
+ if data.is_a?(Hash) and !data['message'].nil?
19
+ Response.new data
20
+ elsif data.is_a?(Array)
19
21
  builder_class.build_all(data, self, options)
20
22
  else
21
23
  builder_class.build(data, self, options)
@@ -0,0 +1,20 @@
1
+ class Response
2
+
3
+ attr_reader :message, :status, :options
4
+
5
+ def initialize(options)
6
+ @message = options['message']
7
+ @status = options['status'].to_sym
8
+ @options = options
9
+ end
10
+
11
+ def ok?
12
+ status == :ok
13
+ end
14
+
15
+ # This is used to look up ids -> e.g. patient_id, phase_id, etc.
16
+ def method_missing(message)
17
+ options.send(:[], message.to_s)
18
+ end
19
+
20
+ end
@@ -1,3 +1,3 @@
1
1
  module Materialize
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
data/lib/materialize.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "materialize/version"
2
2
  require "materialize/entity"
3
3
  require "materialize/concurrent"
4
+ require "materialize/response"
4
5
  require "materialize/base_builder"
5
6
  require "materialize/repo"
6
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: materialize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Fiser
@@ -76,6 +76,7 @@ files:
76
76
  - lib/materialize/concurrent.rb
77
77
  - lib/materialize/entity.rb
78
78
  - lib/materialize/repo.rb
79
+ - lib/materialize/response.rb
79
80
  - lib/materialize/version.rb
80
81
  - materialize.gemspec
81
82
  homepage: http://bluebear.io