atum 0.9.1 → 0.10.0

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: 2583740eec8e4d2ca40b08cd8192e1004315e7e8
4
- data.tar.gz: dee7e86137256baf1bcd1ea07be9de360d62d393
3
+ metadata.gz: 1a8721a2e924867278cb533cb3034412667102f1
4
+ data.tar.gz: f4dd36f0ac22cd6c40f297b74ba46fc66c0db9f7
5
5
  SHA512:
6
- metadata.gz: c477a2f4f437acc61b6186a9a8db90b599ee4f99e0459a16d21db4370e971069bee2288c9861b493267d4e7631b038a0422ad5835441cd068f736c5c34670017
7
- data.tar.gz: cc6db2afb2f09f5c45ccb488a8ea068f7aa49b72b3ed99fcd3fb820030affd2327c096d0475cc3a37ed088c4d7ed7ad674f57c9c4be78f744fa0080c5509eaf7
6
+ metadata.gz: 95faf13627b0272502c1cfcdf818e900e85888aa23a14ccdb86ab80118b56049d4d1d34d6557aebbd9f8eb6f9861843d4afb1abe6e76cd6272806151d259d99c
7
+ data.tar.gz: 42a6b15d34aeaceda47f6704d82675deaf9c4add347b6c5c225b9425600d4832b6cf293c626bfda68447d9e16b5889f0fbe9583af2c86b47bd43b28a052e8b60
@@ -27,3 +27,6 @@ Style/SignalException:
27
27
  # Offense count: 1
28
28
  Style/EachWithObject:
29
29
  Enabled: false
30
+
31
+ Metrics/AbcSize:
32
+ Max: 22
@@ -19,9 +19,9 @@ module Atum
19
19
  break if items.count < response.limit
20
20
 
21
21
  new_options = @options.dup
22
- new_options[:query] = @options.fetch(:query, {})
23
- new_options[:query].merge!(after: response.meta['cursors']['after'],
24
- limit: response.limit + LIMIT_INCREMENT)
22
+ new_options[:query] = @options.fetch(:query, {}).merge(
23
+ after: response.meta['cursors']['after'],
24
+ limit: response.limit + LIMIT_INCREMENT)
25
25
 
26
26
  response = @request.make_request(new_options)
27
27
  end
@@ -46,7 +46,13 @@ module Atum
46
46
  end
47
47
 
48
48
  def handle_raw
49
- error? ? raise(ApiError) : raw_body
49
+ default_raw_message = {
50
+ 'message' => "Something went wrong with this raw request\n" \
51
+ "status: #{@response.status}\n" \
52
+ "headers: #{@response.headers}\n" \
53
+ "body: #{@response.body}"
54
+ }
55
+ error? ? raise(ApiError, default_raw_message) : raw_body
50
56
  end
51
57
  end
52
58
  end
@@ -50,11 +50,10 @@ module Atum
50
50
  private
51
51
 
52
52
  def resource_schema_hash
53
- @resource_schema_hash ||= Hash[
54
- @schema['definitions'].map do |key, value|
55
- [key, ResourceSchema.new(self, value, key)]
53
+ @resource_schema_hash ||=
54
+ @schema['definitions'].each_with_object({}) do |(key, value), memo|
55
+ memo[key] = ResourceSchema.new(self, value, key)
56
56
  end
57
- ]
58
57
  end
59
58
  end
60
59
  end
@@ -38,12 +38,11 @@ module Atum
38
38
  private
39
39
 
40
40
  def link_schema_hash
41
- @link_schema_hash ||= Hash[
42
- @definition['links'].map do |link|
43
- [link['title'].downcase.gsub(' ', '_'),
44
- LinkSchema.new(@schema, self, link)]
41
+ @link_schema_hash ||=
42
+ @definition['links'].each_with_object({}) do |link, memo|
43
+ memo[link['title'].downcase.gsub(' ', '_')] =
44
+ LinkSchema.new(@schema, self, link)
45
45
  end
46
- ]
47
46
  end
48
47
  end
49
48
  end
@@ -128,9 +128,10 @@ module Atum
128
128
  def name_versions(name)
129
129
  constant_name = name.split('_').map { |p| p[0..0].upcase + p[1..-1] }.join
130
130
  if constant_name =~ /-/
131
- constant_name = constant_name.split('-')
132
- .map { |q| q[0..0].upcase + q[1..-1] }
133
- .join('::')
131
+ constant_name = constant_name
132
+ .split('-')
133
+ .map { |q| q[0..0].upcase + q[1..-1] }
134
+ .join('::')
134
135
  end
135
136
 
136
137
  { underscored_name: name.tr('-', '_'),
@@ -5,9 +5,9 @@ module Atum
5
5
  starter = (' ' * tabs) + '# '
6
6
  max_line_length = 78 - (tabs * 2)
7
7
  comment.split("\n")
8
- .flat_map { |l| break_line(l, max_line_length) }
9
- .map { |l| starter + l.strip }
10
- .join("\n")
8
+ .flat_map { |l| break_line(l, max_line_length) }
9
+ .map { |l| starter + l.strip }
10
+ .join("\n")
11
11
  end
12
12
 
13
13
  def method(name, params)
@@ -1,3 +1,3 @@
1
1
  module Atum
2
- VERSION = '0.9.1'
2
+ VERSION = '0.10.0'
3
3
  end
@@ -28,6 +28,18 @@ describe Atum::Core::Response do
28
28
  it 'should come through raw' do
29
29
  expect(body).to eq(response_body)
30
30
  end
31
+
32
+ context 'when the response is an error' do
33
+ let(:response) do
34
+ double(headers: { 'Content-Type' => 'application/text' },
35
+ body: 'FOOBARBAZ', status: 400)
36
+ end
37
+
38
+ it 'should raise an error' do
39
+ expect { api_response.body }.to raise_error(Atum::Core::ApiError,
40
+ /FOOBARBAZ/)
41
+ end
42
+ end
31
43
  end
32
44
  end
33
45
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - isaacseymour
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-17 00:00:00.000000000 Z
12
+ date: 2014-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler