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 +4 -4
- data/lib/soracom/cli.rb +4 -4
- data/lib/soracom/client.rb +10 -1
- data/lib/soracom/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28520778f8c1ab33907c45064f97526be6894dd4
|
4
|
+
data.tar.gz: dea1666f02ac3b7157e3de526396b07ff1f6615d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
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)')
|
data/lib/soracom/client.rb
CHANGED
@@ -527,7 +527,16 @@ module Soracom
|
|
527
527
|
end
|
528
528
|
|
529
529
|
def auth_by_profile(profile)
|
530
|
-
|
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']
|
data/lib/soracom/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|