haveapi-client 0.15.1 → 0.16.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
  SHA256:
3
- metadata.gz: b6e5b127dccda20aa750bc4b96439e60ed9b3187d35a75ded882c3ee5f3ae848
4
- data.tar.gz: 1d666724640a558352d3f19d18e3de5c0fc3d5185d472f4d21993540d34ca214
3
+ metadata.gz: d153eb905ee73a1f0764da87f536881490f9d590219269fca5f365c532d1d726
4
+ data.tar.gz: 970bc24468ff7dc99d77454bad8770006ef87f8fd91ecc910021833ac5c04e21
5
5
  SHA512:
6
- metadata.gz: edd9c2b63c6276f27306bc7da23f8b1fd124aa8415cc7a4bc63177a82e56fd7174f9dea13e5956cad4ec8cf8c9f912aeda5b57235f985be7000b0f60db9e57bd
7
- data.tar.gz: e4c7b696131b8ac85fc66e5937394a247ca71545033358e22bf12ba563a79b0b3b21134db5c1e38552d513aa6af69915c6aa52fce80ddba645deebb31f2b9dab
6
+ metadata.gz: 74b9c5de5ad215533b1c1ceeed8044f19367eb06b18d67d9d9460901701e12525ec8c47d461d99cd593c8188c03c8598f7a72405d1de2818903fe35554d69af3
7
+ data.tar.gz: 1a907240d3323af2830b9b03586d7de2244e8bf695c6700905c8012dcaa107672aa4b65f0597abc35c03d3778d91e65f8a59660d9ebe5391e99fc01520b6b93f
@@ -395,7 +395,7 @@ module HaveAPI::CLI
395
395
  def list_resources(v=nil)
396
396
  desc = @api.describe_api(v)
397
397
 
398
- desc[:resources].each do |resource, children|
398
+ sort_by_key(desc[:resources]).each do |resource, children|
399
399
  nested_resource(resource, children, false)
400
400
  end
401
401
  end
@@ -403,7 +403,7 @@ module HaveAPI::CLI
403
403
  def list_actions(v=nil)
404
404
  desc = @api.describe_api(v)
405
405
 
406
- desc[:resources].each do |resource, children|
406
+ sort_by_key(desc[:resources]).each do |resource, children|
407
407
  nested_resource(resource, children, true)
408
408
  end
409
409
  end
@@ -443,7 +443,7 @@ module HaveAPI::CLI
443
443
  unless desc[:resources].empty?
444
444
  puts 'Resources:'
445
445
 
446
- desc[:resources].each_key do |r|
446
+ desc[:resources].keys.sort.each do |r|
447
447
  puts " #{r}"
448
448
  end
449
449
  end
@@ -453,7 +453,7 @@ module HaveAPI::CLI
453
453
  unless desc[:actions].empty?
454
454
  puts 'Actions:'
455
455
 
456
- desc[:actions].each_key do |a|
456
+ desc[:actions].keys.sort.each do |a|
457
457
  puts " #{a}"
458
458
  end
459
459
  end
@@ -461,14 +461,14 @@ module HaveAPI::CLI
461
461
 
462
462
  def nested_resource(prefix, children, actions=false)
463
463
  if actions
464
- children[:actions].each do |action, _|
464
+ children[:actions].keys.sort.each do |action|
465
465
  puts "#{prefix}##{action}"
466
466
  end
467
467
  else
468
468
  puts prefix
469
469
  end
470
470
 
471
- children[:resources].each do |resource, children|
471
+ sort_by_key(children[:resources]).each do |resource, children|
472
472
  nested_resource("#{prefix}.#{resource}", children, actions)
473
473
  end
474
474
  end
@@ -743,5 +743,11 @@ module HaveAPI::CLI
743
743
 
744
744
  @opts[:date_format] ? ret.strftime(@opts[:date_format]) : ret
745
745
  end
746
+
747
+ def sort_by_key(hash)
748
+ hash.sort do |a, b|
749
+ a[0]<=> b[0]
750
+ end
751
+ end
746
752
  end
747
753
  end
@@ -1,6 +1,6 @@
1
1
  module HaveAPI
2
2
  module Client
3
3
  PROTOCOL_VERSION = '2.0'
4
- VERSION = '0.15.1'
4
+ VERSION = '0.16.0'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haveapi-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Skokan