pdc 0.1.12 → 0.1.13

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: 9f51f89eae34983035f4768fee0475cb2bed9a2b
4
- data.tar.gz: b304391d32258708648f2d623cbc630fef9ff424
3
+ metadata.gz: 6d44458984f2174c95997fe585cd6a08606fe879
4
+ data.tar.gz: f64b204a96e85954dc2826dca3bd257e8df89e24
5
5
  SHA512:
6
- metadata.gz: 9f50d8c5d916bf243a1726602870730e52dc30495356b8b69295284bec9e45383cfe45441a6ac361a91252ff50710d55e26df691060bb6c51aa19838ec05b720
7
- data.tar.gz: ecbfd3ac9df4b19f266c317ad52a0175a8813df97e93eb5440ce656c5a92dd0827ea2bd54a46cbf1707d85f3672241d0bd851e4850311a077e9b90debc86274d
6
+ metadata.gz: ced404dedc88d2e6a10e4ebfdfd491868629a30b2f82ca4b6694ecb06a70e070e87a6c9e113c4a052fb61189346d669496e6884afbe0350888cee7622657b8a8
7
+ data.tar.gz: 0051fc5d3e91be748f4e4617425ed7a5c491549a9aea037f8872345a2c350ff89db28cc3e58cf26472e288db060b47617d20656ee64ef282dad528c557b93b93
data/Gemfile CHANGED
@@ -20,6 +20,7 @@ group :test do
20
20
  gem 'minitest-focus'
21
21
  gem 'minitest-reporters', '~> 1.1.9'
22
22
  gem 'mocha'
23
+ gem 'rubocop', '~> 0.52.0'
23
24
  gem 'simplecov'
24
25
  gem 'timecop'
25
26
  gem 'vcr'
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require './lib/pdc'
4
+
5
+ def main
6
+ PDC.configure do |config|
7
+ config.site = 'https://example.com/'
8
+ config.log_level = :debug
9
+ config.disable_caching = true
10
+ config.requires_token = false
11
+ end
12
+
13
+ push_target = PDC::V1::PushTarget.where(
14
+ name: 'cdn-qa'
15
+ ).find_one!
16
+ puts push_target.description
17
+ end
18
+
19
+ main if $PROGRAM_NAME == __FILE__
@@ -10,5 +10,6 @@ module PDC
10
10
  require 'pdc/v1/released_file'
11
11
  require 'pdc/v1/multi_destination'
12
12
  require 'pdc/v1/variant_cpe'
13
+ require 'pdc/v1/push_target'
13
14
  end
14
15
  end
@@ -2,7 +2,7 @@ module PDC
2
2
  module V1
3
3
  class MultiDestination < PDC::Base
4
4
  attributes :id, :destination_repo, :global_component,
5
- :base_product, :active, :origin_repo, :subscribers
5
+ :active, :origin_repo, :subscribers
6
6
  end
7
7
  end
8
8
  end
@@ -0,0 +1,5 @@
1
+ module PDC::V1
2
+ class PushTarget < PDC::Base
3
+ attributes :description, :host, :name, :service
4
+ end
5
+ end
@@ -3,7 +3,7 @@ module PDC::V1
3
3
  attributes :compose, :mapping
4
4
 
5
5
  def self.uri
6
- @uri = PDC.config.site + '/rest_api/v1/releases/(:release_id)/rpm-mapping/(:package)/'
6
+ @uri = '/rest_api/v1/releases/(:release_id)/rpm-mapping/(:package)/'
7
7
  end
8
8
  end
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module PDC
2
- VERSION = '0.1.12'.freeze
2
+ VERSION = '0.1.13'.freeze
3
3
  end
@@ -0,0 +1,45 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://example.com/rest_api/v1/push%2Dtargets/?description=CDN+qa
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Content-Type:
13
+ - application/json
14
+ User-Agent:
15
+ - Faraday v0.9.2
16
+ response:
17
+ status:
18
+ code: 200
19
+ message:
20
+ headers:
21
+ date:
22
+ - Mon, 29 Jan 2018 03:34:55 GMT
23
+ server:
24
+ - WSGIServer/0.1 Python/2.7.14
25
+ expires:
26
+ - Mon, 29 Jan 2018 03:35:25 GMT
27
+ vary:
28
+ - Accept, Cookie
29
+ last-modified:
30
+ - Mon, 29 Jan 2018 03:34:55 GMT
31
+ allow:
32
+ - GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
33
+ cache-control:
34
+ - max-age=30
35
+ x-frame-options:
36
+ - SAMEORIGIN
37
+ content-type:
38
+ - application/json
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"count":1,"next":null,"previous":null,"results":[{"id":1,"name":"cdn-qa","description":"CDN
42
+ qa","service":"pulp","host":"https://example-host.com"}]}'
43
+ http_version:
44
+ recorded_at: Mon, 29 Jan 2018 03:34:55 GMT
45
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://example.com/rest_api/v1/push%2Dtargets/?service=pulp&service=rhn
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Content-Type:
13
+ - application/json
14
+ User-Agent:
15
+ - Faraday v0.9.2
16
+ response:
17
+ status:
18
+ code: 200
19
+ message:
20
+ headers:
21
+ date:
22
+ - Mon, 29 Jan 2018 03:34:55 GMT
23
+ server:
24
+ - WSGIServer/0.1 Python/2.7.14
25
+ expires:
26
+ - Mon, 29 Jan 2018 03:35:25 GMT
27
+ vary:
28
+ - Accept, Cookie
29
+ last-modified:
30
+ - Mon, 29 Jan 2018 03:34:55 GMT
31
+ allow:
32
+ - GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
33
+ cache-control:
34
+ - max-age=30
35
+ x-frame-options:
36
+ - SAMEORIGIN
37
+ content-type:
38
+ - application/json
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"count":2,"next":null,"previous":null,"results":[{"id":1,"name":"cdn-qa","description":"CDN
42
+ qa","service":"pulp","host":"https://example-host.com"},{"id":2,"name":"rhn-qa","description":"RHN
43
+ qa","service":"rhn","host":"https://example-host.com"}]}'
44
+ http_version:
45
+ recorded_at: Mon, 29 Jan 2018 03:34:55 GMT
46
+ recorded_with: VCR 4.0.0
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://example.com/rest_api/v1/multi%2Ddestinations/
5
+ uri: https://example.com/rest_api/v1/multi%2Ddestinations/
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://example.com/rest_api/v1/multi%2Ddestinations/?active=false
5
+ uri: https://example.com/rest_api/v1/multi%2Ddestinations/?active=false
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://example.com//rest_api/v1/releases/rhel-7.1/rpm%2Dmapping/tuned/
5
+ uri: https://example.com/rest_api/v1/releases/rhel-7.1/rpm%2Dmapping/tuned/
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://example.com/rest_api/v1/push%2Dtargets/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Content-Type:
13
+ - application/json
14
+ User-Agent:
15
+ - Faraday v0.9.2
16
+ response:
17
+ status:
18
+ code: 200
19
+ message:
20
+ headers:
21
+ date:
22
+ - Mon, 29 Jan 2018 03:34:55 GMT
23
+ server:
24
+ - WSGIServer/0.1 Python/2.7.14
25
+ expires:
26
+ - Mon, 29 Jan 2018 03:35:25 GMT
27
+ vary:
28
+ - Accept, Cookie
29
+ last-modified:
30
+ - Mon, 29 Jan 2018 03:34:55 GMT
31
+ allow:
32
+ - GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
33
+ cache-control:
34
+ - max-age=30
35
+ x-frame-options:
36
+ - SAMEORIGIN
37
+ content-type:
38
+ - application/json
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"count":2,"next":null,"previous":null,"results":[{"id":1,"name":"cdn-qa","description":"CDN
42
+ qa","service":"pulp","host":"https://example-host.com"},{"id":2,"name":"rhn-qa","description":"RHN
43
+ qa","service":"rhn","host":"https://example-host.com"}]}'
44
+ http_version:
45
+ recorded_at: Mon, 29 Jan 2018 03:34:55 GMT
46
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,45 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://example.com/rest_api/v1/push%2Dtargets/?name=cdn-qa
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Content-Type:
13
+ - application/json
14
+ User-Agent:
15
+ - Faraday v0.9.2
16
+ response:
17
+ status:
18
+ code: 200
19
+ message:
20
+ headers:
21
+ date:
22
+ - Mon, 29 Jan 2018 03:34:55 GMT
23
+ server:
24
+ - WSGIServer/0.1 Python/2.7.14
25
+ expires:
26
+ - Mon, 29 Jan 2018 03:35:25 GMT
27
+ vary:
28
+ - Accept, Cookie
29
+ last-modified:
30
+ - Mon, 29 Jan 2018 03:34:55 GMT
31
+ allow:
32
+ - GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
33
+ cache-control:
34
+ - max-age=30
35
+ x-frame-options:
36
+ - SAMEORIGIN
37
+ content-type:
38
+ - application/json
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"count":1,"next":null,"previous":null,"results":[{"id":1,"name":"cdn-qa","description":"CDN
42
+ qa","service":"pulp","host":"https://example-host.com"}]}'
43
+ http_version:
44
+ recorded_at: Mon, 29 Jan 2018 03:34:55 GMT
45
+ recorded_with: VCR 4.0.0
@@ -11,16 +11,16 @@ describe PDC::V1::MultiDestination do
11
11
  VCR.eject_cassette
12
12
  end
13
13
 
14
- let(:multi_destonations) { PDC::V1::MultiDestination }
14
+ let(:multi_destinations) { PDC::V1::MultiDestination }
15
15
 
16
16
  describe 'count' do
17
17
  it 'destination returns count' do
18
- count = multi_destonations.count
18
+ count = multi_destinations.count
19
19
  count.must_equal 1
20
20
  end
21
21
 
22
22
  it 'destination works with where' do
23
- count = multi_destonations.where(active: false).count
23
+ count = multi_destinations.where(active: false).count
24
24
  count.must_equal 0
25
25
  end
26
26
  end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ describe PDC::V1::PushTarget do
4
+ before do
5
+ VCR.insert_cassette fixture_name
6
+ end
7
+
8
+ after do
9
+ VCR.eject_cassette
10
+ end
11
+
12
+ let(:push_target) { PDC::V1::PushTarget }
13
+
14
+ describe 'count' do
15
+ it 'push_target returns count' do
16
+ count = push_target.count
17
+ count.must_equal 2
18
+ end
19
+
20
+ it 'push_target works with where' do
21
+ count = push_target.where(name: 'cdn-qa').count
22
+ count.must_equal 1
23
+ end
24
+
25
+ it 'can find push_target by description' do
26
+ count = push_target.where(description: 'CDN qa').count
27
+ count.must_equal 1
28
+ end
29
+
30
+ it 'can find push_target by service' do
31
+ count = push_target.where(service: %w[pulp rhn]).count
32
+ count.must_equal 2
33
+ end
34
+ end
35
+
36
+ describe '#push_target' do
37
+ it 'returns push_target for name' do
38
+ pt = push_target.where(name: 'cdn-qa')
39
+ pt.wont_be_nil
40
+ end
41
+ end
42
+ end
@@ -137,5 +137,12 @@ module Fixtures
137
137
 
138
138
  class Release < Association
139
139
  self.primary_key = :release_id
140
+
141
+ attributes :short, :version, :name, :base_product,
142
+ :active, :product_version, :release_type,
143
+ :compose_set, :integrated_with, :bugzilla,
144
+ :dist_git, :brew, :product_pages, :errata,
145
+ :sigkey, :allow_buildroot_push,
146
+ :allowed_debuginfo_services, :allowed_push_targets
140
147
  end
141
148
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunil Thaha
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-25 00:00:00.000000000 Z
12
+ date: 2018-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -163,6 +163,7 @@ files:
163
163
  - examples/logger.rb
164
164
  - examples/pdc_curb_access_token.rb
165
165
  - examples/pdc_global_component_contact.rb
166
+ - examples/pdc_push_target.rb
166
167
  - examples/pdc_release_rpm_mapping.rb
167
168
  - examples/pdc_resource_tests.rb
168
169
  - examples/pdc_test_cache.rb
@@ -213,6 +214,7 @@ files:
213
214
  - lib/pdc/v1/global_component_contact.rb
214
215
  - lib/pdc/v1/multi_destination.rb
215
216
  - lib/pdc/v1/product.rb
217
+ - lib/pdc/v1/push_target.rb
216
218
  - lib/pdc/v1/release.rb
217
219
  - lib/pdc/v1/release_rpm_mapping.rb
218
220
  - lib/pdc/v1/release_variant.rb
@@ -229,6 +231,8 @@ files:
229
231
  - spec/fixtures/vcr/caches_response_with_multiple_query.yml
230
232
  - spec/fixtures/vcr/caches_response_without_query.yml
231
233
  - spec/fixtures/vcr/can_find_global_contact_by_component_name.yml
234
+ - spec/fixtures/vcr/can_find_push_target_by_description.yml
235
+ - spec/fixtures/vcr/can_find_push_target_by_service.yml
232
236
  - spec/fixtures/vcr/can_get_release_by_multi_product_version.yml
233
237
  - spec/fixtures/vcr/can_iterate_using_each.yml
234
238
  - spec/fixtures/vcr/content_delivery_repos_must_return_a_record.yml
@@ -246,6 +250,8 @@ files:
246
250
  - spec/fixtures/vcr/must_has_version__attributes.yml
247
251
  - spec/fixtures/vcr/must_return_number_of_resources.yml
248
252
  - spec/fixtures/vcr/preserves_the_filters.yml
253
+ - spec/fixtures/vcr/push_target_returns_count.yml
254
+ - spec/fixtures/vcr/push_target_works_with_where.yml
249
255
  - spec/fixtures/vcr/returns_a_contact_email.yml
250
256
  - spec/fixtures/vcr/returns_a_gloabl_contact_id.yml
251
257
  - spec/fixtures/vcr/returns_a_mail_name.yml
@@ -277,7 +283,8 @@ files:
277
283
  - spec/pdc/v1/arch_spec.rb
278
284
  - spec/pdc/v1/content_delivery_repo_spec.rb
279
285
  - spec/pdc/v1/global_component_contact_spec.rb
280
- - spec/pdc/v1/multi_destination_sepc.rb
286
+ - spec/pdc/v1/multi_destination_spec.rb
287
+ - spec/pdc/v1/push_target_spec.rb
281
288
  - spec/pdc/v1/release_rpm_mapping_spec.rb
282
289
  - spec/pdc/v1/release_spec.rb
283
290
  - spec/pdc/v1/release_variant_spec.rb
@@ -323,6 +330,8 @@ test_files:
323
330
  - spec/fixtures/vcr/caches_response_with_multiple_query.yml
324
331
  - spec/fixtures/vcr/caches_response_without_query.yml
325
332
  - spec/fixtures/vcr/can_find_global_contact_by_component_name.yml
333
+ - spec/fixtures/vcr/can_find_push_target_by_description.yml
334
+ - spec/fixtures/vcr/can_find_push_target_by_service.yml
326
335
  - spec/fixtures/vcr/can_get_release_by_multi_product_version.yml
327
336
  - spec/fixtures/vcr/can_iterate_using_each.yml
328
337
  - spec/fixtures/vcr/content_delivery_repos_must_return_a_record.yml
@@ -340,6 +349,8 @@ test_files:
340
349
  - spec/fixtures/vcr/must_has_version__attributes.yml
341
350
  - spec/fixtures/vcr/must_return_number_of_resources.yml
342
351
  - spec/fixtures/vcr/preserves_the_filters.yml
352
+ - spec/fixtures/vcr/push_target_returns_count.yml
353
+ - spec/fixtures/vcr/push_target_works_with_where.yml
343
354
  - spec/fixtures/vcr/returns_a_contact_email.yml
344
355
  - spec/fixtures/vcr/returns_a_gloabl_contact_id.yml
345
356
  - spec/fixtures/vcr/returns_a_mail_name.yml
@@ -371,7 +382,8 @@ test_files:
371
382
  - spec/pdc/v1/arch_spec.rb
372
383
  - spec/pdc/v1/content_delivery_repo_spec.rb
373
384
  - spec/pdc/v1/global_component_contact_spec.rb
374
- - spec/pdc/v1/multi_destination_sepc.rb
385
+ - spec/pdc/v1/multi_destination_spec.rb
386
+ - spec/pdc/v1/push_target_spec.rb
375
387
  - spec/pdc/v1/release_rpm_mapping_spec.rb
376
388
  - spec/pdc/v1/release_spec.rb
377
389
  - spec/pdc/v1/release_variant_spec.rb