apipie-bindings 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1ad2eec72ce942fa348bd32f2a4481bbaa1aaa3
4
- data.tar.gz: a10963fb54de01a37f59ab521a5610eb4c6b754a
3
+ metadata.gz: c2de238c0346625717ad8c455ad933a8f58915fe
4
+ data.tar.gz: 480e111759cf1d88b9b002f447f68b4fcefce7e7
5
5
  SHA512:
6
- metadata.gz: 9e43c66348f712fc334984dd7496b396ce54f0af59881b2134ea7f490b7d8543ff2a1cf478f5f6a41d493457a248a918ed7827a3750816848f22f883dbacc290
7
- data.tar.gz: 7661d1ecf0801381f92efe89c74d1fa7913fcf81d4a10be821d80e280c4cae0dcfe6ec0aeaf5dad60a20db29519bcf2a68c6eceafcb799bf8a34ca4e47830f60
6
+ metadata.gz: e439a3315f55647319631390fe43411664fce48963c90baa44003302d656576553e773e634946e05c51e557aaa7705fce897ca7e0bb4d29e75fe33e9149f159c
7
+ data.tar.gz: e172fec2517f748068ece02e9c41ee3b8efab1d1d6745349c5e8cc733553abc5d62795826d75af20910c298121c8975cbf89a31da98bb4c126a7d3226326b9c0
data/README.md CHANGED
@@ -68,6 +68,15 @@ irb> api.resource(:architectures).action(:show).call(:id => 1)
68
68
 
69
69
  ```
70
70
 
71
+ #### Logging
72
+ It is possible to set custom (`Logger` compatible) logger while creating API instance.
73
+
74
+ ```ruby
75
+ ApipieBindings::API.new({:uri => 'http://localhost:3000/', :logger => Logging.logger(STDOUT)})
76
+ ```
77
+
78
+ Add gem `awesome_print` to your application Gemfile if you want to debug api calls with awesome inspect.
79
+
71
80
  Documentation
72
81
  -------------
73
82
  there is not much of the library documented yet, but we started to document our API with Yard.
@@ -77,7 +86,6 @@ The docs are installed with the gem and can be viewed from the docs dir directly
77
86
 
78
87
  TODO
79
88
  ----
80
- * parameter validation
81
89
  * update docs
82
90
 
83
91
 
data/doc/release_notes.md CHANGED
@@ -1,6 +1,9 @@
1
1
  Release notes
2
2
  =============
3
3
 
4
+ ### 0.0.15 (2015-09-21)
5
+ * Make awesome_print optional ([#29](https://github.com/Apipie/apipie-bindings/issues/29))
6
+
4
7
  ### 0.0.14 (2015-08-25)
5
8
  * support rest-client 1.8.0 ([#27](https://github.com/Apipie/apipie-bindings/issues/27))
6
9
 
@@ -1,4 +1,5 @@
1
1
  require 'apipie_bindings/version'
2
+ require 'apipie_bindings/utils'
2
3
  require 'apipie_bindings/credentials'
3
4
  require 'apipie_bindings/exceptions'
4
5
  require 'apipie_bindings/inflector'
@@ -1,7 +1,6 @@
1
1
  require 'json'
2
2
  require 'rest_client'
3
3
  require 'oauth'
4
- require 'awesome_print'
5
4
  require 'apipie_bindings/rest_client_oauth'
6
5
  require 'logger'
7
6
  require 'tmpdir'
@@ -85,7 +84,7 @@ module ApipieBindings
85
84
  headers.merge!(config[:headers]) unless config[:headers].nil?
86
85
  headers.merge!(options.delete(:headers)) unless options[:headers].nil?
87
86
 
88
- log.debug "Global headers: #{headers.ai}"
87
+ log.debug "Global headers: #{inspect_data(headers)}"
89
88
 
90
89
  @credentials = config[:credentials] if config[:credentials] && config[:credentials].respond_to?(:to_params)
91
90
 
@@ -194,8 +193,8 @@ module ApipieBindings
194
193
  end
195
194
 
196
195
  log.info "#{http_method.to_s.upcase} #{path}"
197
- log.debug "Params: #{params.ai}"
198
- log.debug "Headers: #{headers.ai}"
196
+ log.debug "Params: #{inspect_data(params)}"
197
+ log.debug "Headers: #{inspect_data(headers)}"
199
198
 
200
199
  args << headers if headers
201
200
 
@@ -218,14 +217,14 @@ module ApipieBindings
218
217
  update_cache(response.headers[:apipie_checksum])
219
218
  rescue => e
220
219
  log.debug e.message + "\n" +
221
- (e.respond_to?(:response) ? process_data(e.response).ai : e.ai)
220
+ inspect_data(e.respond_to?(:response) ? process_data(e.response) : e)
222
221
  raise
223
222
  end
224
223
  end
225
224
 
226
225
  result = options[:response] == :raw ? response : process_data(response)
227
- log.debug "Response: %s" % (options[:reduce_response_log] ? "Received OK" : result.ai)
228
- log.debug "Response headers: #{response.headers.ai}" if response.respond_to?(:headers)
226
+ log.debug "Response: %s" % (options[:reduce_response_log] ? "Received OK" : inspect_data(result))
227
+ log.debug "Response headers: #{inspect_data(response.headers)}" if response.respond_to?(:headers)
229
228
  result
230
229
  end
231
230
 
@@ -345,6 +344,9 @@ module ApipieBindings
345
344
  end
346
345
  return data
347
346
  end
348
- end
349
347
 
348
+ def inspect_data(obj)
349
+ ApipieBindings::Utils.inspect_data(obj)
350
+ end
351
+ end
350
352
  end
@@ -0,0 +1,7 @@
1
+ module ApipieBindings
2
+ module Utils
3
+ def self.inspect_data(obj)
4
+ obj.respond_to?(:ai) ? obj.ai : obj.inspect
5
+ end
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  module ApipieBindings
2
2
  def self.version
3
- @version ||= Gem::Version.new '0.0.14'
3
+ @version ||= Gem::Version.new '0.0.15'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apipie-bindings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Bačovský
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-25 00:00:00.000000000 Z
11
+ date: 2015-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: awesome_print
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rake
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -195,6 +181,7 @@ files:
195
181
  - lib/apipie_bindings/resource.rb
196
182
  - lib/apipie_bindings/rest_client_oauth.rb
197
183
  - lib/apipie_bindings/route.rb
184
+ - lib/apipie_bindings/utils.rb
198
185
  - lib/apipie_bindings/version.rb
199
186
  - test/dummy/.gitignore
200
187
  - test/dummy/Gemfile