smooth_operator 1.8.3 → 1.8.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjAzMDZjMmQ3N2JkNzEzOWQ0MWNlNzcyNjc1ZjdkNzg1ZjI4MzdiMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTBiYjI0ODhhNzM1MzE4Y2FkOWJkOGRhMDBhYTIzNDU4NDAzNzVhNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGViNTdmZDI2N2E5MWQ1NmYwOGQ1ZDI3MjAxNjg1ODBiYTIxZjhhYjJjNjBh
|
10
|
+
MTNiMjFjOGI5M2ZhNTNkOTI4NDEyMzcyNGUyOTNhNjdiZmYwNjliZWEyZDQ5
|
11
|
+
ZGNkODYzYzA2MzY0N2QwOGViMmY0ODFhZWI5MjRhMWZmMmM0MmE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzkzMzUyZmQ1MDUxNzI4NjVlOGFkMWNhZjVlNTljZTQ5M2ZkZjA5YWMyOTQx
|
14
|
+
NjdjZTgxNmQ1MDI0NDQ5ZTE1NzMwZTBjNzMzYTgyNTMzNDIzMDM5Y2Y1OTc4
|
15
|
+
NGMwZDNkNmRhZmMxOWJiNGU4YmJmMzQyMDc1MjM4NTBlNzFiMjA=
|
@@ -49,23 +49,23 @@ module SmoothOperator
|
|
49
49
|
if defined? ActiveModel
|
50
50
|
rails_model_name_method
|
51
51
|
else
|
52
|
-
@
|
52
|
+
@_model_name ||= name.split('::').last.underscore.capitalize
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
def model_name=(name)
|
57
|
-
@
|
57
|
+
@_model_name = name
|
58
58
|
end
|
59
59
|
|
60
60
|
|
61
61
|
protected ############## PROTECTED #############
|
62
62
|
|
63
63
|
def rails_model_name_method
|
64
|
-
@
|
65
|
-
|
64
|
+
@model_name ||= begin
|
65
|
+
namespace ||= self.parents.detect do |n|
|
66
66
|
n.respond_to?(:use_relative_model_naming?) && n.use_relative_model_naming?
|
67
67
|
end
|
68
|
-
ActiveModel::Name.new(self, @
|
68
|
+
ActiveModel::Name.new(self, namespace, @_model_name)
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -19,6 +19,12 @@ module SmoothOperator
|
|
19
19
|
HTTP_VERBS.each { |http_verb| define_method(http_verb) { |relative_path = '', params = {}, options = {}| make_the_call(http_verb, relative_path, params, options) } }
|
20
20
|
|
21
21
|
|
22
|
+
def headers
|
23
|
+
Helpers.get_instance_variable(self, :headers, {})
|
24
|
+
end
|
25
|
+
attr_writer :headers
|
26
|
+
|
27
|
+
|
22
28
|
def generate_parallel_connection
|
23
29
|
generate_connection(:typhoeus)
|
24
30
|
end
|
@@ -51,8 +57,9 @@ module SmoothOperator
|
|
51
57
|
|
52
58
|
response = connection.send(http_verb) do |request|
|
53
59
|
operator_options.each { |key, value| request.options.send("#{key}=", value) }
|
60
|
+
options[:headers].each { |key, value| request.headers[key] = value }
|
54
61
|
params.each { |key, value| request.params[key] = value }
|
55
|
-
|
62
|
+
|
56
63
|
request.url relative_path
|
57
64
|
request.body = body
|
58
65
|
end
|
@@ -90,6 +97,7 @@ module SmoothOperator
|
|
90
97
|
def strip_options(options)
|
91
98
|
options ||= {}
|
92
99
|
|
100
|
+
options[:headers] = self.headers.merge(options[:headers] || {})
|
93
101
|
operator_options = options.delete(:operator_options) || {}
|
94
102
|
connection = options.delete(:connection) || generate_connection(nil, operator_options)
|
95
103
|
|
@@ -1,3 +1,10 @@
|
|
1
1
|
class Address < SmoothOperator::Base
|
2
|
+
self.model_name = 'user'
|
2
3
|
|
4
|
+
self.endpoint_user = 'admin'
|
5
|
+
self.endpoint_pass = 'admin'
|
6
|
+
|
7
|
+
self.endpoint = 'http://localhost:4567/'
|
8
|
+
|
9
|
+
self.headers = { "X-APPTOKEN" => "joaquim_app_token", "X-LAYERTOKEN" => "joaquim_layer_token" }
|
3
10
|
end
|