soracom 1.1.1 → 1.1.2

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: 76e5bdebebad971ecab7c61854f14379ed898737
4
- data.tar.gz: 1b4187c8005078047866acaec5e3bd5771bfd47e
3
+ metadata.gz: 28520778f8c1ab33907c45064f97526be6894dd4
4
+ data.tar.gz: dea1666f02ac3b7157e3de526396b07ff1f6615d
5
5
  SHA512:
6
- metadata.gz: b32df7ef3e41262310fc24f97e52f61a527173758961b770fcfbc4d78e11f7f4dd5ec1a22331f39c9cee234ec2ae3a2d0aec44fb2792ccd6ae13303d1392a76e
7
- data.tar.gz: 02ff32ffa7a5e7e70ba311503e8fec1ac8e1441acb5e98103182c486f5d5c793fb411144d6ab715634cb1e360f94e3ee120ec6701ad13732260f6743462b14c9
6
+ metadata.gz: d91eae2b1ca8c2ffbbff5a57313dfb34515674b4ea72b6efd64724efa55bede052b113a44c3e16ab94fe9f1f6651b5e967768c035d599a549627944f862633a7
7
+ data.tar.gz: 64f5124ba239c8b41665842ad310b64d16a3b54d37fa067368214aa62681f08126c4dd40835ecbaebe42aeb4b4b976e27a5ce1d654bf93b045c677435c36f336
data/lib/soracom/cli.rb CHANGED
@@ -524,7 +524,7 @@ module SoracomCli
524
524
  class Credentials < Thor
525
525
  desc 'list_credentials', 'list stored credentials'
526
526
  def list_credentials
527
- client = Soracom::Client.new
527
+ client = Soracom::Client.new(profile:options.profile)
528
528
  data = client.list_credentials
529
529
  puts JSON.pretty_generate(data)
530
530
  end
@@ -542,7 +542,7 @@ module SoracomCli
542
542
  abort "ERROR: Cannot access #{options.credentials_body}."
543
543
  end
544
544
  end
545
- client = Soracom::Client.new
545
+ client = Soracom::Client.new(profile:options.profile)
546
546
  data = client.create_credentials(options.credentials_id, options.credentials_body)
547
547
  puts JSON.pretty_generate(data)
548
548
  end
@@ -550,7 +550,7 @@ module SoracomCli
550
550
  desc 'delete_credentials', 'delete credentials'
551
551
  option :credentials_id, type: :string, required: true, desc: 'credentials Id'
552
552
  def delete_credentials
553
- client = Soracom::Client.new
553
+ client = Soracom::Client.new(profile:options.profile)
554
554
  data = client.delete_credentials(options.credentials_id)
555
555
  puts JSON.pretty_generate(data)
556
556
  end
@@ -558,7 +558,7 @@ module SoracomCli
558
558
 
559
559
  # Using Thor for CLI Implementation
560
560
  class CLI < Thor
561
- class_option :profile, default: 'default', desc: 'profile to use, stored in $HOME/.soracom/PROFILE.json'
561
+ class_option :profile, desc: 'profile to use, stored in $HOME/.soracom/PROFILE.json'
562
562
 
563
563
  register(Subscriber, 'subscriber', 'subscriber <command>', 'Subscriber related operations')
564
564
  register(Subscriber, 'sim', 'sim <command>', 'Subscriber related operations(alias)')
@@ -527,7 +527,16 @@ module Soracom
527
527
  end
528
528
 
529
529
  def auth_by_profile(profile)
530
- profile_string = open( "#{ENV['HOME']}/.soracom/#{profile}.json").read
530
+ begin
531
+ profile_string = open( "#{ENV['HOME']}/.soracom/#{profile}.json").read
532
+ rescue Errno::ENOENT
533
+ if profile == 'default'
534
+ return nil
535
+ else
536
+ fail "Could not open #{ENV['HOME']}/.soracom/#{profile}.json"
537
+ end
538
+ end
539
+
531
540
  profile_data = JSON.parse(profile_string)
532
541
  @endpoint = profile_data.fetch('endpoint', @endpoint)
533
542
  if profile_data['authKeyId'] && profile_data['authKey']
@@ -1,4 +1,4 @@
1
1
  # version info
2
2
  module Soracom
3
- VERSION = '1.1.1'
3
+ VERSION = '1.1.2'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soracom
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - MATSUI, Motokatsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-27 00:00:00.000000000 Z
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler