atum 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +3 -0
- data/lib/atum/core/paginator.rb +3 -3
- data/lib/atum/core/response.rb +7 -1
- data/lib/atum/core/schema/api_schema.rb +3 -4
- data/lib/atum/core/schema/resource_schema.rb +4 -5
- data/lib/atum/generation/cli.rb +4 -3
- data/lib/atum/generation/erb_context.rb +3 -3
- data/lib/atum/version.rb +1 -1
- data/spec/atum/core/response_spec.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a8721a2e924867278cb533cb3034412667102f1
|
4
|
+
data.tar.gz: f4dd36f0ac22cd6c40f297b74ba46fc66c0db9f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95faf13627b0272502c1cfcdf818e900e85888aa23a14ccdb86ab80118b56049d4d1d34d6557aebbd9f8eb6f9861843d4afb1abe6e76cd6272806151d259d99c
|
7
|
+
data.tar.gz: 42a6b15d34aeaceda47f6704d82675deaf9c4add347b6c5c225b9425600d4832b6cf293c626bfda68447d9e16b5889f0fbe9583af2c86b47bd43b28a052e8b60
|
data/.rubocop_todo.yml
CHANGED
data/lib/atum/core/paginator.rb
CHANGED
@@ -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
|
-
|
24
|
-
|
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
|
data/lib/atum/core/response.rb
CHANGED
@@ -46,7 +46,13 @@ module Atum
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def handle_raw
|
49
|
-
|
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 ||=
|
54
|
-
@schema['definitions'].
|
55
|
-
[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 ||=
|
42
|
-
@definition['links'].
|
43
|
-
[link['title'].downcase.gsub(' ', '_')
|
44
|
-
|
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
|
data/lib/atum/generation/cli.rb
CHANGED
@@ -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
|
132
|
-
|
133
|
-
|
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
|
-
|
9
|
-
|
10
|
-
|
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)
|
data/lib/atum/version.rb
CHANGED
@@ -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.
|
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-
|
12
|
+
date: 2014-11-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|