haveapi-client 0.15.0 → 0.16.1

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: 4ab49346d0209df996a1832992ad1f11bf7bb2f7de6f1f7cd49fb92e4bbc62c0
4
- data.tar.gz: a49dc688a464d90e4188d93abcda7d27f252f0c4d44ce7769fb773b68b08e11b
3
+ metadata.gz: 81fcced275925ab0779dc3fd5309d31f31a735172d7303c81b346bf05cee2571
4
+ data.tar.gz: 98fabb149c7953e470d81280151237cfd068e132d6174fa9526bcf177c77cbe8
5
5
  SHA512:
6
- metadata.gz: b39a2abebdc41d1480c2cba71ff4440ac320532c1d22885d92aba8d383f3e9e4d2a055114821c76322f90d1c0d135c5233b80f95a3ac366483a8ee6fa6577756
7
- data.tar.gz: 768c5ec61c25e4dcfbc99f79f0a788d2237789e8316065fecc766fe60b832852609954ee1bf2c21256aa80116f901aef55314825e4fb42df23c69cbf84dab7d0
6
+ metadata.gz: 2e35d9542b4ae8807f0d5856201c656aa3ce123939a2618ead8488108e6e790e76d28a0b3813726f2e97e2436e151c6f1a942f6c2351ac617986b0a2bc9af887
7
+ data.tar.gz: cffce167aa5cc4b6e7005a7638b2b3c96a545ecfd96d61b76492ba8c55ec18f2c6e60b85fdb66968760e02035f92dceb19287b6679b817bb0b81e190af27b6ba
@@ -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
@@ -12,7 +12,7 @@ module HaveAPI::Client
12
12
  apply_args(args)
13
13
  end
14
14
 
15
- def execute(data)
15
+ def execute(data, raw: false)
16
16
  params_arg = {}
17
17
 
18
18
  if input
@@ -25,7 +25,7 @@ module HaveAPI::Client
25
25
  params_arg = params.to_api
26
26
  end
27
27
 
28
- ret = @api.call(self, params_arg, **{})
28
+ ret = @api.call(self, params_arg, raw: raw)
29
29
  reset
30
30
  ret
31
31
  end
@@ -1,6 +1,6 @@
1
1
  module HaveAPI
2
2
  module Client
3
3
  PROTOCOL_VERSION = '2.0'
4
- VERSION = '0.15.0'
4
+ VERSION = '0.16.1'
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.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Skokan