lumberg 2.0.0.pre8 → 2.0.0.pre9

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: 10dcfd306d3ee4a1a224e9bb0b3c7528a2f6c154
4
- data.tar.gz: 48d02df40bc69730d0f2d23e9c4d9efbad0429ca
3
+ metadata.gz: ef4a9c248a84c013090aced16e33a33048b12112
4
+ data.tar.gz: 2cc69df1744ed6ec8c050d9c9fc7a77664587d46
5
5
  SHA512:
6
- metadata.gz: 846bf7143cf9b02250221fd343a9b115fabe18cc2f3076b04a923e650383765ba6d1204dbab32469f0ae0080dcfd1f553410a81b6029af7a14ef365c4cdc5998
7
- data.tar.gz: c9a1cbb582bbe7460f977c365d6144308f45c8f180751f0d2df9a30cec802f5e65bd93697eaba101ea1228b13d5f692b5edec6337c08487bbd05f63ec3746eff
6
+ metadata.gz: a5c927fc66d24ccad345ad193bed7246ff768580fba88322d18e8e2b3c86cb6de3505621f4fb618cd56e9c6dd7e4e564d25c1d62c5fc0513a80f20e9d0d3d9a3
7
+ data.tar.gz: 76eb1f6855a88b0ad2d4f626927553b420db3cce3747625b2802face1933ad5996285d542b99ece4a67c55c15dbcc412555af622a210b98de7d41c56474748fb
@@ -1,3 +1,5 @@
1
+ require 'zlib'
2
+
1
3
  module Lumberg
2
4
  class FormatWhm < Faraday::Response::Middleware
3
5
 
@@ -9,7 +11,22 @@ module Lumberg
9
11
  end
10
12
 
11
13
  def on_complete(env)
12
- env[:body] = format_response(env[:body])
14
+ encoding = env[:response_headers]['content-encoding']
15
+
16
+ encoding = encoding.to_s.downcase if encoding
17
+
18
+ body = case encoding
19
+ when 'gzip'
20
+ env[:response_headers].delete('content-encoding')
21
+ Zlib::GzipReader.new(StringIO.new(env[:body])).read
22
+ when 'deflate'
23
+ env[:response_headers].delete('content-encoding')
24
+ Zlib::Inflate.inflate(env[:body])
25
+ else
26
+ env[:body]
27
+ end
28
+
29
+ env[:body] = format_response body
13
30
  end
14
31
 
15
32
  def response_values(env)
@@ -1,3 +1,3 @@
1
1
  module Lumberg
2
- VERSION = '2.0.0.pre8'
2
+ VERSION = '2.0.0.pre9'
3
3
  end
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+ require "spec_helper"
3
+
4
+ describe Lumberg::FormatWhm do
5
+ subject { described_class.new({ }, :query, "data") }
6
+
7
+ context "gzip" do
8
+ let(:gzipped_data) do
9
+ "\u001F\x8B\b\u0000\u001E¹R\u0000\u0003+\xCE\xCFMUHI,I\u0004\u0000" +
10
+ "\u001E\xE9\xC2\xD9\t\u0000\u0000\u0000"
11
+ end
12
+
13
+ it "removes content encoding" do
14
+ env = { body: gzipped_data,
15
+ response_headers: { "content-encoding" => "gzip" } }
16
+
17
+ subject.on_complete(env)
18
+
19
+ env.should_not include "content-encoding"
20
+
21
+ env[:body][:params].should eq "some data"
22
+ end
23
+ end
24
+
25
+ context "deflate" do
26
+ let(:compressed_data) do
27
+ "x\x9C+\xCE\xCFMUHI,I\x04\x00\x11\x81\x03o"
28
+ end
29
+
30
+ it "removes content encoding" do
31
+ env = { body: compressed_data,
32
+ response_headers: { "content-encoding" => "deflate" } }
33
+
34
+ subject.on_complete(env)
35
+
36
+ env.should_not include "content-encoding"
37
+
38
+ env[:body][:params].should eq "some data"
39
+ end
40
+ end
41
+
42
+ context "no content encoding" do
43
+ it "doesn't touch response headers" do
44
+ env = { body: "some data", response_headers: { foo: "bar" } }
45
+
46
+ subject.on_complete(env)
47
+
48
+ env[:response_headers].should include :foo
49
+
50
+ env[:body][:params].should eq "some data"
51
+ end
52
+ end
53
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lumberg
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre8
4
+ version: 2.0.0.pre9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Mazzi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-10 00:00:00.000000000 Z
11
+ date: 2014-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -196,6 +196,7 @@ files:
196
196
  - spec/cpanel/sub_domain_spec.rb
197
197
  - spec/cpanel/support_spec.rb
198
198
  - spec/cpanel/zone_edit_spec.rb
199
+ - spec/format_whm_spec.rb
199
200
  - spec/lumberg_spec.rb
200
201
  - spec/sample_certs/cpanel.crt
201
202
  - spec/sample_certs/cpanel.key
@@ -405,9 +406,226 @@ required_rubygems_version: !ruby/object:Gem::Requirement
405
406
  version: 1.3.1
406
407
  requirements: []
407
408
  rubyforge_project: lumberg
408
- rubygems_version: 2.0.14
409
+ rubygems_version: 2.0.3
409
410
  signing_key:
410
411
  specification_version: 4
411
412
  summary: Ruby library for the WHM & cPanel API
412
- test_files: []
413
- has_rdoc:
413
+ test_files:
414
+ - spec/config_spec.rb
415
+ - spec/cpanel/addon_domain_spec.rb
416
+ - spec/cpanel/backups_spec.rb
417
+ - spec/cpanel/base_spec.rb
418
+ - spec/cpanel/box_trapper_spec.rb
419
+ - spec/cpanel/branding_spec.rb
420
+ - spec/cpanel/contact_spec.rb
421
+ - spec/cpanel/cron_spec.rb
422
+ - spec/cpanel/dns_lookup_spec.rb
423
+ - spec/cpanel/domain_keys_spec.rb
424
+ - spec/cpanel/domain_lookup_spec.rb
425
+ - spec/cpanel/email_spec.rb
426
+ - spec/cpanel/file_manager_spec.rb
427
+ - spec/cpanel/ftp_spec.rb
428
+ - spec/cpanel/gpg_spec.rb
429
+ - spec/cpanel/locale_spec.rb
430
+ - spec/cpanel/mime_spec.rb
431
+ - spec/cpanel/mysql_spec.rb
432
+ - spec/cpanel/net_spec.rb
433
+ - spec/cpanel/park_spec.rb
434
+ - spec/cpanel/password_spec.rb
435
+ - spec/cpanel/password_strength_spec.rb
436
+ - spec/cpanel/random_data_spec.rb
437
+ - spec/cpanel/redirect_spec.rb
438
+ - spec/cpanel/ssl_spec.rb
439
+ - spec/cpanel/sub_domain_spec.rb
440
+ - spec/cpanel/support_spec.rb
441
+ - spec/cpanel/zone_edit_spec.rb
442
+ - spec/format_whm_spec.rb
443
+ - spec/lumberg_spec.rb
444
+ - spec/sample_certs/cpanel.crt
445
+ - spec/sample_certs/cpanel.key
446
+ - spec/sample_certs/main.crt
447
+ - spec/sample_certs/sample.crt
448
+ - spec/sample_certs/sample.key
449
+ - spec/spec_helper.rb
450
+ - spec/support/cpanel_matchers.rb
451
+ - spec/vcr_cassettes/cpanel/addon_domain/add.yml
452
+ - spec/vcr_cassettes/cpanel/addon_domain/list.yml
453
+ - spec/vcr_cassettes/cpanel/addon_domain/remove.yml
454
+ - spec/vcr_cassettes/cpanel/backups/list.yml
455
+ - spec/vcr_cassettes/cpanel/box_trapper/list.yml
456
+ - spec/vcr_cassettes/cpanel/branding/list_icons.yml
457
+ - spec/vcr_cassettes/cpanel/branding/list_image_types.yml
458
+ - spec/vcr_cassettes/cpanel/branding/list_object_types.yml
459
+ - spec/vcr_cassettes/cpanel/branding/list_pkgs.yml
460
+ - spec/vcr_cassettes/cpanel/branding/list_sprites.yml
461
+ - spec/vcr_cassettes/cpanel/contact/show.yml
462
+ - spec/vcr_cassettes/cpanel/contact/update.yml
463
+ - spec/vcr_cassettes/cpanel/cron/add.yml
464
+ - spec/vcr_cassettes/cpanel/cron/edit.yml
465
+ - spec/vcr_cassettes/cpanel/cron/email.yml
466
+ - spec/vcr_cassettes/cpanel/cron/list.yml
467
+ - spec/vcr_cassettes/cpanel/cron/remove.yml
468
+ - spec/vcr_cassettes/cpanel/cron/set_email.yml
469
+ - spec/vcr_cassettes/cpanel/dns_lookup/name_to_ip.yml
470
+ - spec/vcr_cassettes/cpanel/domain_keys/add.yml
471
+ - spec/vcr_cassettes/cpanel/domain_keys/available.yml
472
+ - spec/vcr_cassettes/cpanel/domain_keys/installed.yml
473
+ - spec/vcr_cassettes/cpanel/domain_keys/remove.yml
474
+ - spec/vcr_cassettes/cpanel/domain_lookup/count.yml
475
+ - spec/vcr_cassettes/cpanel/domain_lookup/docroot.yml
476
+ - spec/vcr_cassettes/cpanel/domain_lookup/docroots.yml
477
+ - spec/vcr_cassettes/cpanel/domain_lookup/document_root.yml
478
+ - spec/vcr_cassettes/cpanel/domain_lookup/document_roots.yml
479
+ - spec/vcr_cassettes/cpanel/domain_lookup/list.yml
480
+ - spec/vcr_cassettes/cpanel/email/acceptable_encodings.yml
481
+ - spec/vcr_cassettes/cpanel/email/accounts.yml
482
+ - spec/vcr_cassettes/cpanel/email/add_account.yml
483
+ - spec/vcr_cassettes/cpanel/email/add_filter.yml
484
+ - spec/vcr_cassettes/cpanel/email/add_forwarder.yml
485
+ - spec/vcr_cassettes/cpanel/email/add_mailing_list.yml
486
+ - spec/vcr_cassettes/cpanel/email/add_mx.yml
487
+ - spec/vcr_cassettes/cpanel/email/change_mx.yml
488
+ - spec/vcr_cassettes/cpanel/email/check_local_delivery_local.yml
489
+ - spec/vcr_cassettes/cpanel/email/check_local_delivery_remote.yml
490
+ - spec/vcr_cassettes/cpanel/email/default_address.yml
491
+ - spec/vcr_cassettes/cpanel/email/delete_mx.yml
492
+ - spec/vcr_cassettes/cpanel/email/disk_usage.yml
493
+ - spec/vcr_cassettes/cpanel/email/domains.yml
494
+ - spec/vcr_cassettes/cpanel/email/domains_with_aliases.yml
495
+ - spec/vcr_cassettes/cpanel/email/edit_quota.yml
496
+ - spec/vcr_cassettes/cpanel/email/filters.yml
497
+ - spec/vcr_cassettes/cpanel/email/forwarders.yml
498
+ - spec/vcr_cassettes/cpanel/email/mail_dir.yml
499
+ - spec/vcr_cassettes/cpanel/email/mail_dirs.yml
500
+ - spec/vcr_cassettes/cpanel/email/mailing_lists.yml
501
+ - spec/vcr_cassettes/cpanel/email/main_discard.yml
502
+ - spec/vcr_cassettes/cpanel/email/mx.yml
503
+ - spec/vcr_cassettes/cpanel/email/remove.yml
504
+ - spec/vcr_cassettes/cpanel/email/set_mail_delivery_local.yml
505
+ - spec/vcr_cassettes/cpanel/email/set_mail_delivery_remote.yml
506
+ - spec/vcr_cassettes/cpanel/email/set_mx_type.yml
507
+ - spec/vcr_cassettes/cpanel/file_manager/disk_usage.yml
508
+ - spec/vcr_cassettes/cpanel/file_manager/list.yml
509
+ - spec/vcr_cassettes/cpanel/file_manager/operate.yml
510
+ - spec/vcr_cassettes/cpanel/file_manager/show.yml
511
+ - spec/vcr_cassettes/cpanel/file_manager/stat.yml
512
+ - spec/vcr_cassettes/cpanel/ftp/addftp.yml
513
+ - spec/vcr_cassettes/cpanel/ftp/delftp.yml
514
+ - spec/vcr_cassettes/cpanel/ftp/listftp.yml
515
+ - spec/vcr_cassettes/cpanel/ftp/listftpsessions.yml
516
+ - spec/vcr_cassettes/cpanel/ftp/listftpwithdisk.yml
517
+ - spec/vcr_cassettes/cpanel/ftp/passwd.yml
518
+ - spec/vcr_cassettes/cpanel/ftp/setquota.yml
519
+ - spec/vcr_cassettes/cpanel/gpg/count.yml
520
+ - spec/vcr_cassettes/cpanel/gpg/count_private.yml
521
+ - spec/vcr_cassettes/cpanel/gpg/list.yml
522
+ - spec/vcr_cassettes/cpanel/gpg/list_private.yml
523
+ - spec/vcr_cassettes/cpanel/locale/show.yml
524
+ - spec/vcr_cassettes/cpanel/net/query_hostname.yml
525
+ - spec/vcr_cassettes/cpanel/net/traceroute.yml
526
+ - spec/vcr_cassettes/cpanel/park/add.yml
527
+ - spec/vcr_cassettes/cpanel/park/list.yml
528
+ - spec/vcr_cassettes/cpanel/park/list_addon_domains.yml
529
+ - spec/vcr_cassettes/cpanel/park/remove.yml
530
+ - spec/vcr_cassettes/cpanel/password/digest_authentication.yml
531
+ - spec/vcr_cassettes/cpanel/password/modify.yml
532
+ - spec/vcr_cassettes/cpanel/password_strength/all_required_strengths.yml
533
+ - spec/vcr_cassettes/cpanel/password_strength/required_strength.yml
534
+ - spec/vcr_cassettes/cpanel/password_strength/strength.yml
535
+ - spec/vcr_cassettes/cpanel/random_data/show.yml
536
+ - spec/vcr_cassettes/cpanel/ssl/fetchcabundle.yml
537
+ - spec/vcr_cassettes/cpanel/ssl/gencrt.yml
538
+ - spec/vcr_cassettes/cpanel/ssl/gencsr.yml
539
+ - spec/vcr_cassettes/cpanel/ssl/genkey.yml
540
+ - spec/vcr_cassettes/cpanel/ssl/installssl.yml
541
+ - spec/vcr_cassettes/cpanel/ssl/listcrts.yml
542
+ - spec/vcr_cassettes/cpanel/ssl/listcsrs.yml
543
+ - spec/vcr_cassettes/cpanel/ssl/listkeys.yml
544
+ - spec/vcr_cassettes/cpanel/ssl/listsslitems.yml
545
+ - spec/vcr_cassettes/cpanel/ssl/remove.yml
546
+ - spec/vcr_cassettes/cpanel/ssl/showcrt.yml
547
+ - spec/vcr_cassettes/cpanel/ssl/showcsr.yml
548
+ - spec/vcr_cassettes/cpanel/ssl/showkey.yml
549
+ - spec/vcr_cassettes/cpanel/ssl/uploadcrt.yml
550
+ - spec/vcr_cassettes/cpanel/sub_domain/add.yml
551
+ - spec/vcr_cassettes/cpanel/sub_domain/list.yml
552
+ - spec/vcr_cassettes/cpanel/sub_domain/remove.yml
553
+ - spec/vcr_cassettes/cpanel/support/contactable.yml
554
+ - spec/vcr_cassettes/whm/account/accountsummary.yml
555
+ - spec/vcr_cassettes/whm/account/changepackage.yml
556
+ - spec/vcr_cassettes/whm/account/createacct.yml
557
+ - spec/vcr_cassettes/whm/account/domainuserdata.yml
558
+ - spec/vcr_cassettes/whm/account/editquota.yml
559
+ - spec/vcr_cassettes/whm/account/limitbw.yml
560
+ - spec/vcr_cassettes/whm/account/listaccts.yml
561
+ - spec/vcr_cassettes/whm/account/listsuspended.yml
562
+ - spec/vcr_cassettes/whm/account/modifyacct.yml
563
+ - spec/vcr_cassettes/whm/account/myprivs.yml
564
+ - spec/vcr_cassettes/whm/account/passwd.yml
565
+ - spec/vcr_cassettes/whm/account/removeacct.yml
566
+ - spec/vcr_cassettes/whm/account/restoreaccount.yml
567
+ - spec/vcr_cassettes/whm/account/setsiteip.yml
568
+ - spec/vcr_cassettes/whm/account/suspend.yml
569
+ - spec/vcr_cassettes/whm/account/unsuspend.yml
570
+ - spec/vcr_cassettes/whm/cert/fetchsslinfo.yml
571
+ - spec/vcr_cassettes/whm/cert/generatessl.yml
572
+ - spec/vcr_cassettes/whm/cert/installssl.yml
573
+ - spec/vcr_cassettes/whm/cert/listcrts.yml
574
+ - spec/vcr_cassettes/whm/dns/adddns.yml
575
+ - spec/vcr_cassettes/whm/dns/addzonerecord.yml
576
+ - spec/vcr_cassettes/whm/dns/dumpzone.yml
577
+ - spec/vcr_cassettes/whm/dns/editzonerecord.yml
578
+ - spec/vcr_cassettes/whm/dns/getzonerecord.yml
579
+ - spec/vcr_cassettes/whm/dns/killdns.yml
580
+ - spec/vcr_cassettes/whm/dns/listmxs.yml
581
+ - spec/vcr_cassettes/whm/dns/listzones.yml
582
+ - spec/vcr_cassettes/whm/dns/lookupnsip.yml
583
+ - spec/vcr_cassettes/whm/dns/removezonerecord.yml
584
+ - spec/vcr_cassettes/whm/dns/resetzone.yml
585
+ - spec/vcr_cassettes/whm/dns/resolvedomainname.yml
586
+ - spec/vcr_cassettes/whm/dns/savemxs.yml
587
+ - spec/vcr_cassettes/whm/reseller/acctcounts.yml
588
+ - spec/vcr_cassettes/whm/reseller/listacls.yml
589
+ - spec/vcr_cassettes/whm/reseller/listresellers.yml
590
+ - spec/vcr_cassettes/whm/reseller/resellerstats.yml
591
+ - spec/vcr_cassettes/whm/reseller/saveacllist.yml
592
+ - spec/vcr_cassettes/whm/reseller/setacls.yml
593
+ - spec/vcr_cassettes/whm/reseller/setresellerips.yml
594
+ - spec/vcr_cassettes/whm/reseller/setresellerlimits.yml
595
+ - spec/vcr_cassettes/whm/reseller/setresellermainip.yml
596
+ - spec/vcr_cassettes/whm/reseller/setresellernameservers.yml
597
+ - spec/vcr_cassettes/whm/reseller/setresellerpackagelimit.yml
598
+ - spec/vcr_cassettes/whm/reseller/setupreseller.yml
599
+ - spec/vcr_cassettes/whm/reseller/suspendreseller.yml
600
+ - spec/vcr_cassettes/whm/reseller/terminatereseller.yml
601
+ - spec/vcr_cassettes/whm/reseller/unsetupreseller.yml
602
+ - spec/vcr_cassettes/whm/reseller/unsuspendreseller.yml
603
+ - spec/vcr_cassettes/whm/server/addip.yml
604
+ - spec/vcr_cassettes/whm/server/applist.yml
605
+ - spec/vcr_cassettes/whm/server/delip.yml
606
+ - spec/vcr_cassettes/whm/server/gethostname.yml
607
+ - spec/vcr_cassettes/whm/server/getlanglist.yml
608
+ - spec/vcr_cassettes/whm/server/gettweaksetting.yml
609
+ - spec/vcr_cassettes/whm/server/listips.yml
610
+ - spec/vcr_cassettes/whm/server/loadavg.yml
611
+ - spec/vcr_cassettes/whm/server/my_function.yml
612
+ - spec/vcr_cassettes/whm/server/nvget.yml
613
+ - spec/vcr_cassettes/whm/server/nvset.yml
614
+ - spec/vcr_cassettes/whm/server/reboot.yml
615
+ - spec/vcr_cassettes/whm/server/sethostname.yml
616
+ - spec/vcr_cassettes/whm/server/setresolvers.yml
617
+ - spec/vcr_cassettes/whm/server/settweaksetting.yml
618
+ - spec/vcr_cassettes/whm/server/showbw.yml
619
+ - spec/vcr_cassettes/whm/server/systemloadavg.yml
620
+ - spec/vcr_cassettes/whm/server/themes.yml
621
+ - spec/vcr_cassettes/whm/server/version.yml
622
+ - spec/vcr_cassettes/whostmgr/ssl/remove.yml
623
+ - spec/vcr_cassettes/whostmgr/ssl/remove_data.yml
624
+ - spec/whm/account_spec.rb
625
+ - spec/whm/base_spec.rb
626
+ - spec/whm/cert_spec.rb
627
+ - spec/whm/dns_spec.rb
628
+ - spec/whm/reseller_spec.rb
629
+ - spec/whm/server_spec.rb
630
+ - spec/whm/whm_spec.rb
631
+ - spec/whostmgr/ssl_spec.rb