saklient 0.0.2.3 → 0.0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dbbdaf09c98095e51cab1badda0f43a9ec1b8da6
4
- data.tar.gz: 5fb32beceb6f5b6166b787d614c8364ab315a6d7
3
+ metadata.gz: a9c0814de498b9ba0c287cf796ec4db49262344d
4
+ data.tar.gz: 38ba8a9e76602f1d7693544bde3050def0fc7072
5
5
  SHA512:
6
- metadata.gz: 5b75f6ddbb1f866837675c117c08598b8c09a2a69cf2d5a140519e8234d0d7fb178d35c9877c579423178afd0c3204b4cbe557fd67075a1b45efbce8bf9192be
7
- data.tar.gz: 48bdb7d3eaed8a7d66fa153430c913463a13e8d505cb836580fc0b6bc6f04fe34088d1d6ca3bc648f8356753854d6a9b44340309abb2a482da19c21c77369953
6
+ metadata.gz: c8863f52fd5d859c29ab80eb2ab63e5e044f401f9c33fc16d0547e7c38a22d8e61e839275589c37b1f45547b080d5396e14160e116099d84484b8d85e1a82027
7
+ data.tar.gz: 069c1c54f95521e23e1a075a232ba8b1d4de1aa05d725484ef92b038d6ed53a86a5db470a2c38a34b9906685161cc2bf820c2a93ae7c6800fcaa3aad3b6e3d5c
@@ -73,7 +73,7 @@ module Saklient
73
73
 
74
74
  extra_headers = {
75
75
  'Content-Type' => 'application/x-www-form-urlencoded',
76
- 'User-Agent' => 'saklient.ruby ver-0.0.2.3 rev-12b993d3bd1fedb86be7312ac4648dc4e5693cfa',
76
+ 'User-Agent' => 'saklient.ruby ver-0.0.2.4 rev-a581b28f8ddd2cd75cb32f710d33d3d650bba044',
77
77
  'X-Requested-With' => 'XMLHttpRequest',
78
78
  'X-Sakura-HTTP-Method' => method,
79
79
  'X-Sakura-Error-Level' => 'warning',
@@ -119,7 +119,7 @@ module Saklient
119
119
  #
120
120
  # @todo Implement test case
121
121
  # @param [bool] reverse
122
- # @return [Model_Archive]
122
+ # @return [Model_LicenseInfo]
123
123
  def sort_by_name(reverse = false)
124
124
  Saklient::Util::validate_type(reverse, 'bool')
125
125
  return _sort_by_name(reverse)
@@ -3,7 +3,6 @@
3
3
  require_relative '../../errors/saklient_exception'
4
4
  require_relative '../client'
5
5
  require_relative 'resource'
6
- require_relative 'license_info'
7
6
 
8
7
  module Saklient
9
8
  module Cloud
@@ -7,6 +7,7 @@ require_relative 'icon'
7
7
  require_relative 'router'
8
8
  require_relative 'ipv4_net'
9
9
  require_relative 'ipv6_net'
10
+ require_relative 'bridge'
10
11
 
11
12
  module Saklient
12
13
  module Cloud
@@ -57,6 +58,11 @@ module Saklient
57
58
  # @return [Router]
58
59
  attr_accessor :m_router
59
60
 
61
+ # 接続されているブリッジ
62
+ #
63
+ # @return [Bridge]
64
+ attr_accessor :m_bridge
65
+
60
66
  # IPv4ネットワーク(ルータによる自動割当) {Ipv4Net} の配列
61
67
  #
62
68
  # @return [Array<Ipv4Net>]
@@ -178,6 +184,26 @@ module Saklient
178
184
  return self
179
185
  end
180
186
 
187
+ # このルータ+スイッチをブリッジに接続します.
188
+ #
189
+ # @param [Bridge] bridge
190
+ # @return [Swytch] this
191
+ def connect_to_bridge(bridge)
192
+ Saklient::Util::validate_type(bridge, 'Saklient::Cloud::Resources::Bridge')
193
+ result = @_client.request('PUT', _api_path + '/' + _id + '/to/bridge/' + bridge._id)
194
+ reload
195
+ return self
196
+ end
197
+
198
+ # このルータ+スイッチをブリッジから切断します.
199
+ #
200
+ # @return [Swytch] this
201
+ def disconnect_from_bridge
202
+ result = @_client.request('DELETE', _api_path + '/' + _id + '/to/bridge')
203
+ reload
204
+ return self
205
+ end
206
+
181
207
  protected
182
208
 
183
209
  # @return [bool]
@@ -437,6 +463,30 @@ module Saklient
437
463
 
438
464
  protected
439
465
 
466
+ # @return [bool]
467
+ attr_accessor :n_bridge
468
+
469
+ # (This method is generated in Translator_default#buildImpl)
470
+ #
471
+ # @private
472
+ # @return [Bridge]
473
+ def get_bridge
474
+ return @m_bridge
475
+ end
476
+
477
+ public
478
+
479
+ # 接続されているブリッジ
480
+ #
481
+ # @return [Bridge]
482
+ attr_reader :bridge
483
+
484
+ def bridge
485
+ get_bridge
486
+ end
487
+
488
+ protected
489
+
440
490
  # @return [bool]
441
491
  attr_accessor :n_ipv4_nets
442
492
 
@@ -557,6 +607,13 @@ module Saklient
557
607
  @is_incomplete = true
558
608
  end
559
609
  @n_router = false
610
+ if Saklient::Util::exists_path(r, 'Bridge')
611
+ @m_bridge = (Saklient::Util::get_by_path(r, 'Bridge')).nil? ? nil : Saklient::Cloud::Resources::Bridge.new(@_client, Saklient::Util::get_by_path(r, 'Bridge'))
612
+ else
613
+ @m_bridge = nil
614
+ @is_incomplete = true
615
+ end
616
+ @n_bridge = false
560
617
  if Saklient::Util::exists_path(r, 'Subnets')
561
618
  if (Saklient::Util::get_by_path(r, 'Subnets')).nil?
562
619
  @m_ipv4_nets = []
@@ -617,6 +674,7 @@ module Saklient
617
674
  Saklient::Util::set_by_path(ret, 'UserSubnet.DefaultRoute', @m_user_default_route) if withClean || @n_user_default_route
618
675
  Saklient::Util::set_by_path(ret, 'UserSubnet.NetworkMaskLen', @m_user_mask_len) if withClean || @n_user_mask_len
619
676
  Saklient::Util::set_by_path(ret, 'Internet', withClean ? ((@m_router).nil? ? nil : @m_router.api_serialize(withClean)) : ((@m_router).nil? ? { ID: '0' } : @m_router.api_serialize_id)) if withClean || @n_router
677
+ Saklient::Util::set_by_path(ret, 'Bridge', withClean ? ((@m_bridge).nil? ? nil : @m_bridge.api_serialize(withClean)) : ((@m_bridge).nil? ? { ID: '0' } : @m_bridge.api_serialize_id)) if withClean || @n_bridge
620
678
  if withClean || @n_ipv4_nets
621
679
  Saklient::Util::set_by_path(ret, 'Subnets', [])
622
680
  for r2 in @m_ipv4_nets
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: UTF-8 -*-
2
2
 
3
3
  module Saklient
4
- VERSION = "0.0.2.3"
4
+ VERSION = "0.0.2.4"
5
5
  end
data/spec/bridge_spec.rb CHANGED
@@ -57,10 +57,24 @@ describe 'Bridge' do
57
57
  bridge.description = description
58
58
  bridge.region = regions[0]
59
59
  bridge.save
60
-
61
60
  expect(bridge).to be_an_instance_of Saklient::Cloud::Resources::Bridge
62
61
 
63
- #
62
+ puts 'スイッチを作成しています...'
63
+ swytch = @api.swytch.create
64
+ swytch.name = name
65
+ swytch.description = description
66
+ swytch.save
67
+ expect(swytch).to be_an_instance_of Saklient::Cloud::Resources::Swytch
68
+
69
+ puts 'スイッチをブリッジに接続しています...'
70
+ swytch.connect_to_bridge(bridge)
71
+
72
+ puts 'スイッチをブリッジから切断しています...'
73
+ swytch.disconnect_from_bridge
74
+
75
+ puts 'スイッチを削除しています...'
76
+ swytch.destroy
77
+
64
78
  puts 'ブリッジを削除しています...'
65
79
  bridge.destroy
66
80
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saklient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.3
4
+ version: 0.0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - townewgokgok
@@ -298,3 +298,4 @@ test_files:
298
298
  - spec/router_spec.rb
299
299
  - spec/server_spec.rb
300
300
  - spec/util_spec.rb
301
+ has_rdoc: