backdrop 0.2.1 → 0.2.2

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
- M2U1YjEzN2RjMzU1NjExYzFjYWJmYWUwMTlhNjczNmUwZjE2MjgzZQ==
4
+ NjRhY2VhYTg3NjFiZTllZDhmZDAwNWE5Y2RjODU2ZTRjNDJmOWQ3ZQ==
5
5
  data.tar.gz: !binary |-
6
- ZWE3NjU4OTllZDM1MmQ5Yzg4Y2YwODhhZjkwMDE2MGViNjAwYmIxOQ==
6
+ YmQ3ZWZmNjM1YWQ3Y2VhYjY1YWQwOTE3ZDAwMWVlMDA3NmFkYjkxOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Mjk4NTViNmY3M2ZjOWNjNWQ5YTNiMmZhY2ViYzA1Y2M0NTUxNzA2ZGU4ZTJl
10
- M2Q3OWRmZWIzODE1OGFmMTA0NGQ3YjQwYmE5M2U4NzUwNmVhYjM1ODUxYjA5
11
- MTE1YWJjOGNlYzA2OThhNjAzNWIxMWMwN2VhOGVmNzQwMGJlOTc=
9
+ OGRkY2QxMTUzYzNmMmI1ZTAxOTdhY2MxZDA5NWQ1YTc1NTc5NTU2OTVkOTMw
10
+ MjAxY2IyNWRjZTdlYjM2MThjZmFkYjdhYmMyOTg2OWQwYWJhMjNmOTdhZDM1
11
+ MmM2OWIwM2IxM2M4OTVmNzQ3NTM5MzM2Mjk4Yjg2OGQ4MGZjNjQ=
12
12
  data.tar.gz: !binary |-
13
- ZWY4YmRjNTY5MzY5MjE2OTBiNTU0ZDEwNDlkYzdmZDc1NGE5MTNhZDU0NmU5
14
- MjdhZTY0NmNlZDhkM2EwMThiZTEwY2QxOGY2ZTUwM2YzNDA4NzA0ZjAyNGE2
15
- YTVjMmZjODQ2Njc5MWRlM2ExYTk1NDYzOTcwZjg3NTkwY2Y4YjE=
13
+ ODAwMTcyOTA5YzU4MTY5YzZhNWEyZjg4YzE0MTRjMzE5MTAzNTQ5YTBmMDEw
14
+ ZWIwMzJmMjhlODI4MDA1MDA4NzIzYjM4YTk1MDk4MThjMmJiZWU2NDMzYmM1
15
+ MDU2NWQ3YzVhM2IzOWIzYTRhNzVkNmI1ZGUxMTczNTg1Mjg0ZDQ=
@@ -15,9 +15,12 @@ module Backdrop
15
15
  def build_apis(project, rad_json, output_dir)
16
16
  rad_json.each do |json_file|
17
17
  json = JSON.parse File.read(json_file)
18
- method = json['http_method']
19
- builder = Backdrop.configuration.http.send(method.downcase)
20
- builder.new.build output_dir, project, json
18
+ method = json['http_method'].downcase.to_sym
19
+ supported_methods = Backdrop.configuration.http.http_methods
20
+ if supported_methods.include? method
21
+ builder = Backdrop.configuration.http.send(method)
22
+ builder.new.build output_dir, project, json
23
+ end
21
24
  end
22
25
  end
23
26
  end
@@ -1,3 +1,3 @@
1
1
  module Backdrop
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -25,19 +25,38 @@ describe Backdrop::Extractor do
25
25
  describe '#build_apis' do
26
26
  let(:builder) { double :builder }
27
27
 
28
- let(:json) { { 'http_method' => 'GET' } }
28
+ context 'when the method is defined' do
29
+ let(:json) { { 'http_method' => 'GET' } }
29
30
 
30
- before do
31
- allow(Backdrop::Builders::Get).to receive(:new)
32
- .and_return builder
33
- @json_file = Tempfile.new 'file.json'
34
- @json_file.write(JSON.generate json)
35
- @json_file.rewind
31
+ before do
32
+ allow(Backdrop::Builders::Get).to receive(:new)
33
+ .and_return builder
34
+ @json_file = Tempfile.new 'file.json'
35
+ @json_file.write(JSON.generate json)
36
+ @json_file.rewind
37
+ end
38
+
39
+ it 'creates an API for each request' do
40
+ expect(builder).to receive(:build).with('output', 'project', json)
41
+ subject.build_apis 'project', [@json_file.path], 'output'
42
+ end
36
43
  end
37
44
 
38
- it 'creates an API for each request' do
39
- expect(builder).to receive(:build).with('output', 'project', json)
40
- subject.build_apis 'project', [@json_file.path], 'output'
45
+ context 'when the method is not defined' do
46
+ let(:json) { { 'http_method' => 'SOMETHING' } }
47
+
48
+ before do
49
+ allow(Backdrop::Builders::Get).to receive(:new)
50
+ .and_return builder
51
+ @json_file = Tempfile.new 'file.json'
52
+ @json_file.write(JSON.generate json)
53
+ @json_file.rewind
54
+ end
55
+
56
+ it 'creates an API for each request' do
57
+ expect(builder).to_not receive(:build)
58
+ subject.build_apis 'project', [@json_file.path], 'output'
59
+ end
41
60
  end
42
61
  end
43
62
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backdrop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Bowden