smooth_operator 1.9.0 → 1.9.1

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
- M2UzYWIwNGJhMGE3YTA4YTUyNjA5MzM2NzdkMTM1MzdjZWFmZjVlYg==
4
+ YTFmN2U2MjU4ODU3ZGYxY2I1MmFkOTY3MGZjYjZhMzM1MTI5YmYwZg==
5
5
  data.tar.gz: !binary |-
6
- YTVjOTE5MWM3NmNkNjA3MWUyNmU5M2Y5YThjMDM1NzYwOTQyZjdkMw==
6
+ OGRhODhkYjM2ODJlOWIyNjMyNDMzN2Y4ZmNmZDk5Y2U3ZDNlZDkyOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- N2YwN2Y3ODg3YzFhZDQxNjA1OWM4YTk3M2ExYTZkZWYxYjhkN2Y4N2M1ZTQw
10
- NTllZTBhMGYxOGM3OTU4OTA4ZWUyMGIwNmY2YzM2NTZjNmQ2YmJiMzMwYjE1
11
- MmQwYjgwOWI4ZjI5MjU1NTljNTg5MzY0ZWZjM2FiYzk5MDc3YWU=
9
+ NmUwMTE4ZWJmMWQ1OGMyNzdmMzMzN2JjNDYzNGU4ZTA1MWIxNDg2NWFlNDA0
10
+ ZmExYjVmNTdhM2IzYzVlYjhjZjFhMTk4OGZhY2E2ZjI5NjQ3ZmVkY2I5NGRl
11
+ YjU0MTAxMWVkNjcyYjAzZjFlNzU1OTc5Mzk5MjVjODdkNzNmYmM=
12
12
  data.tar.gz: !binary |-
13
- M2I2NWVhZjExZGYzN2NkYTIwNjM5YWRjNGZlZDQ4Njk5MjNlZGI1YjQzM2U3
14
- MmVlNWZkMWUyMDI1Y2ZhMGZmZWUwY2VjYjA2MzYyNWI0YjRmNDlkM2I1MWY4
15
- YTVjZTRmZGM4NGY0YzdlNjBmMDAwOTg4YmNiMjFkMWFiYmYxMjA=
13
+ NWJhMmVmZDFhYTZjOGM1OWRiZDZjODE3YjcxNmJkODE1MWE4MmExZDJmMjMy
14
+ YTQ4ZTNmMTZjMGJjYjgyYTMyNTI0NzBiYzI5YjJmOTZlMDdmYjhhOWZmODE3
15
+ NDY1Y2M1NDI5ODE5NDNhYTkyYmY0ZTZkNWVhMWNmYzE2Mjk2MWU=
@@ -2,6 +2,7 @@ require 'faraday'
2
2
  # require 'typhoeus'
3
3
  # require 'faraday_middleware'
4
4
  # require 'typhoeus/adapters/faraday'
5
+ require "smooth_operator/remote_call/base"
5
6
 
6
7
  module SmoothOperator
7
8
 
@@ -36,7 +37,7 @@ module SmoothOperator
36
37
 
37
38
  Faraday.new(url: url) do |builder|
38
39
  # builder.options.params_encoder = Faraday::NestedParamsEncoder # to properly encode arrays
39
- builder.options.timeout = timeout unless Helpers.blank?(timeout)
40
+ builder.options[:timeout] = timeout unless Helpers.blank?(timeout)
40
41
  builder.request :url_encoded
41
42
  builder.adapter adapter
42
43
  end
@@ -44,7 +45,8 @@ module SmoothOperator
44
45
 
45
46
 
46
47
  protected ################ PROTECTED ################
47
- #COMPLEX
48
+
49
+ # TODO: COMPLEX METHOD
48
50
  def make_the_call(http_verb, relative_path = '', data = {}, options = {})
49
51
  params, body = strip_params(http_verb, data)
50
52
 
@@ -67,7 +69,9 @@ module SmoothOperator
67
69
  RemoteCall::Base.new(response)
68
70
  # rescue Faraday::ConnectionFailed
69
71
  rescue Faraday::Error::ConnectionFailed
70
- RemoteCall::ConnectionFailed.new
72
+ RemoteCall::Errors::ConnectionFailed.new(response)
73
+ rescue Faraday::Error::TimeoutError
74
+ RemoteCall::Errors::Timeout.new(response)
71
75
  end
72
76
  end
73
77
 
@@ -1,3 +1,7 @@
1
+ require "smooth_operator/remote_call/errors/base"
2
+ require "smooth_operator/remote_call/errors/timeout"
3
+ require "smooth_operator/remote_call/errors/connection_failed"
4
+
1
5
  module SmoothOperator
2
6
 
3
7
  module RemoteCall
@@ -16,8 +20,8 @@ module SmoothOperator
16
20
 
17
21
  alias :ok? :success?
18
22
 
19
- def initialize(response, object_class = nil)
20
- @response, @object_class = response, object_class
23
+ def initialize(response)
24
+ @response = response
21
25
  end
22
26
 
23
27
 
@@ -53,20 +57,6 @@ module SmoothOperator
53
57
 
54
58
  end
55
59
 
56
- class ConnectionFailed
57
-
58
- attr_reader :data, :object, :objects, :parsed_response, :status, :headers, :body
59
-
60
- def http_status; 0; end
61
-
62
- def error?; true; end
63
-
64
- def success?; false; end
65
-
66
- def failure?; false; end
67
-
68
- end
69
-
70
60
  end
71
61
 
72
62
  end
@@ -0,0 +1,25 @@
1
+ module SmoothOperator
2
+ module RemoteCall
3
+ module Errors
4
+
5
+ class Base
6
+
7
+ attr_reader :response, :data, :object, :objects, :parsed_response, :status, :headers, :body
8
+
9
+ def initialize(response)
10
+ @response = response
11
+ end
12
+
13
+ def http_status; 0; end
14
+
15
+ def error?; true; end
16
+
17
+ def success?; false; end
18
+
19
+ def failure?; false; end
20
+
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,10 @@
1
+ module SmoothOperator
2
+ module RemoteCall
3
+ module Errors
4
+
5
+ class ConnectionFailed < Base
6
+ end
7
+
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module SmoothOperator
2
+ module RemoteCall
3
+ module Errors
4
+
5
+ class Timeout < Base
6
+ end
7
+
8
+ end
9
+ end
10
+ end
@@ -36,7 +36,8 @@ module SmoothOperator
36
36
 
37
37
 
38
38
  protected ##################### PROTECTED ###################
39
- #COMPLEX
39
+
40
+ # TODO: COMPLEX METHOD
40
41
  def attribute_names(options)
41
42
  attribute_names = internal_data.keys.sort
42
43
 
@@ -1,3 +1,3 @@
1
1
  module SmoothOperator
2
- VERSION = "1.9.0"
2
+ VERSION = "1.9.1"
3
3
  end
@@ -1,9 +1,6 @@
1
- # require 'active_model'
2
-
3
1
  require "smooth_operator/version"
4
2
  require "smooth_operator/helpers"
5
3
  require "smooth_operator/operator"
6
- require "smooth_operator/remote_call"
7
4
  require "smooth_operator/persistence"
8
5
  require "smooth_operator/translation"
9
6
  require "smooth_operator/open_struct"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smooth_operator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - João Gonçalves
@@ -78,7 +78,10 @@ files:
78
78
  - lib/smooth_operator/open_struct.rb
79
79
  - lib/smooth_operator/operator.rb
80
80
  - lib/smooth_operator/persistence.rb
81
- - lib/smooth_operator/remote_call.rb
81
+ - lib/smooth_operator/remote_call/base.rb
82
+ - lib/smooth_operator/remote_call/errors/base.rb
83
+ - lib/smooth_operator/remote_call/errors/connection_failed.rb
84
+ - lib/smooth_operator/remote_call/errors/timeout.rb
82
85
  - lib/smooth_operator/serialization.rb
83
86
  - lib/smooth_operator/translation.rb
84
87
  - lib/smooth_operator/type_converter.rb