barrister-rails 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/barrister-rails.gemspec +1 -0
- data/lib/barrister-rails.rb +21 -16
- data/lib/barrister-rails/version.rb +1 -1
- metadata +28 -14
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YzFlMzE5YTNlNTdmYzNmZjJmZGI0ODRiYWFiNzhiM2ZhNTg5NjRlNg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZWU4NTFhNmNlZDRiYTM5ZDQ4NjdjMzQwYzkxMWNhZWZkMDM2M2RmNA==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OWE1MzJhZmQwNzI4ZGUxNmU3N2Y3NjA1ZmY0YjE1YzljYTMyMTJmYmY2YTY4
|
10
|
+
NzlkMTM1ODljYzQyNTA3ODQ4MDhiZDhhODA5ZTI4ZDY0ZjAxMjJkOWNjOGQw
|
11
|
+
YTNmZjNlZTQxN2FjMmM3MDA3MzRlNzEyMWU5OTE0Njc5MWMyNTU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZmM2MWY1YTk2OGU1NzMxNmZjMzIyM2I0OWU4MzgzZmM5NWYwNjAwZWMxNjFm
|
14
|
+
OWRjYjI3MzdlOWMwYTI5NjQ4NGE0YTkyNmFkYmU5ZDhhMTlhMzVlMTUwYzA5
|
15
|
+
ZjZkODI0ZWNiNzg1Mzg1YWVlNjE2ZjNjYWQ3NTRkNzkzNzhlYmU=
|
data/barrister-rails.gemspec
CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "barrister", "~> 0"
|
22
|
+
spec.add_dependency "barrister-intraprocess", "~> 0"
|
22
23
|
spec.add_dependency "active_attr", "~> 0"
|
23
24
|
spec.add_development_dependency "pry", "~> 0"
|
24
25
|
spec.add_development_dependency "rspec", "~> 2.0"
|
data/lib/barrister-rails.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "barrister"
|
2
|
-
require
|
2
|
+
require "barrister-intraprocess"
|
3
3
|
require "barrister-rails/version"
|
4
|
+
require 'active_attr'
|
4
5
|
|
5
6
|
module Barrister
|
6
7
|
|
@@ -30,17 +31,16 @@ module Barrister
|
|
30
31
|
|
31
32
|
attr_reader :name
|
32
33
|
|
33
|
-
def initialize(name, client, fx_metadata
|
34
|
+
def initialize(name, client, fx_metadata)
|
34
35
|
@name = name
|
35
36
|
@client = client
|
36
37
|
@fx_metadata = fx_metadata
|
37
|
-
@transmute_to_model = transmute_to_model
|
38
38
|
end
|
39
39
|
|
40
40
|
def method_missing(name, *args)
|
41
41
|
result = @client.send(@name).send(name, *args)
|
42
42
|
|
43
|
-
if
|
43
|
+
if DEFAULT_BARRISTER_TYPES.include?(@fx_metadata[name][:type]) == false
|
44
44
|
cast result, @fx_metadata[name][:type], @fx_metadata[name][:is_array]
|
45
45
|
else
|
46
46
|
result
|
@@ -96,8 +96,17 @@ module Barrister
|
|
96
96
|
|
97
97
|
end
|
98
98
|
|
99
|
-
def initialize(
|
100
|
-
|
99
|
+
def initialize(transport_or_uri_or_handler, json_path=nil)
|
100
|
+
if transport_or_uri_or_handler.is_a?(String)
|
101
|
+
transport = Barrister::HttpTransport.new(transport_or_uri_or_handler)
|
102
|
+
elsif transport_or_uri_or_handler.class.to_s.split('::').first == 'Barrister'
|
103
|
+
transport = transport_or_uri_or_handler
|
104
|
+
else
|
105
|
+
raise 'json_path must be provided if registering a handler directly' unless json_path
|
106
|
+
container = Barrister::IntraProcessContainer.new json_path, transport_or_uri_or_handler
|
107
|
+
transport = Barrister::IntraProcessTransport.new container
|
108
|
+
end
|
109
|
+
|
101
110
|
@client = Barrister::Client.new(transport)
|
102
111
|
@custom_types = Hash.new
|
103
112
|
|
@@ -105,18 +114,14 @@ module Barrister
|
|
105
114
|
.instance_variable_get('@contract')
|
106
115
|
.interfaces
|
107
116
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
.map { |fx| [fx.name.to_sym, { type: fx.returns['type'], is_array: fx.returns['is_array'] } ] }
|
117
|
+
pairs = interfaces
|
118
|
+
.map { |iface| iface.functions }
|
119
|
+
.flatten
|
120
|
+
.map { |fx| [fx.name.to_sym, { type: fx.returns['type'], is_array: fx.returns['is_array'] } ] }
|
113
121
|
|
114
|
-
|
115
|
-
else
|
116
|
-
fx_metadata = {}
|
117
|
-
end
|
122
|
+
fx_metadata = Hash[pairs]
|
118
123
|
|
119
|
-
@interface_proxies = interfaces.map { |iface| InterfaceProxy.new iface.name, @client, fx_metadata
|
124
|
+
@interface_proxies = interfaces.map { |iface| InterfaceProxy.new iface.name, @client, fx_metadata }
|
120
125
|
end
|
121
126
|
|
122
127
|
def method_missing(name, *args)
|
metadata
CHANGED
@@ -1,69 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barrister-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erin Swenson-Healey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: barrister
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: barrister-intraprocess
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: active_attr
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- -
|
45
|
+
- - ~>
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '0'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- -
|
52
|
+
- - ~>
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: pry
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - ~>
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - ~>
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- -
|
73
|
+
- - ~>
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '2.0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- -
|
80
|
+
- - ~>
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '2.0'
|
69
83
|
description: More to come!
|
@@ -73,7 +87,7 @@ executables: []
|
|
73
87
|
extensions: []
|
74
88
|
extra_rdoc_files: []
|
75
89
|
files:
|
76
|
-
-
|
90
|
+
- .gitignore
|
77
91
|
- Gemfile
|
78
92
|
- LICENSE
|
79
93
|
- LICENSE.txt
|
@@ -93,17 +107,17 @@ require_paths:
|
|
93
107
|
- lib
|
94
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
95
109
|
requirements:
|
96
|
-
- -
|
110
|
+
- - ! '>='
|
97
111
|
- !ruby/object:Gem::Version
|
98
112
|
version: '0'
|
99
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- -
|
115
|
+
- - ! '>='
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
118
|
requirements: []
|
105
119
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.2.
|
120
|
+
rubygems_version: 2.2.1
|
107
121
|
signing_key:
|
108
122
|
specification_version: 4
|
109
123
|
summary: A Rails-oriented wrapper for the Barrister client.
|