Class: Files::SyncBandwidthSnapshot
- Inherits:
-
Object
- Object
- Files::SyncBandwidthSnapshot
- Defined in:
- lib/files.com/models/sync_bandwidth_snapshot.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
-
.create(params = {}, options = {}) ⇒ Object
Parameters: remote_server_id (required) - int64 - ID for the remote server consuming sync bandwidth sync_bytes_sent (required) - int64 - Sync bytes sent sync_bytes_received (required) - int64 - Sync bytes received.
- .create_batch(params = {}, options = {}) ⇒ Object
Instance Method Summary collapse
-
#created_at ⇒ Object
date-time - sync bandwidth snapshot created at date/time.
-
#id ⇒ Object
int64 - sync bandwidth snapshot ID.
- #id=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ SyncBandwidthSnapshot
constructor
A new instance of SyncBandwidthSnapshot.
-
#remote_server_id ⇒ Object
int64 - ID for the remote server consuming sync bandwidth.
- #remote_server_id=(value) ⇒ Object
- #save ⇒ Object
-
#site_id ⇒ Object
int64 - Site ID.
- #site_id=(value) ⇒ Object
-
#sync_bytes_received ⇒ Object
decimal - bytes received.
- #sync_bytes_received=(value) ⇒ Object
-
#sync_bytes_sent ⇒ Object
decimal - bytes sent.
- #sync_bytes_sent=(value) ⇒ Object
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ SyncBandwidthSnapshot
Returns a new instance of SyncBandwidthSnapshot.
9 10 11 12 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 9 def initialize(attributes = {}, = {}) @attributes = attributes || {} @options = || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
7 8 9 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 7 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 7 def @options end |
Class Method Details
.create(params = {}, options = {}) ⇒ Object
Parameters:
remote_server_id (required) - int64 - ID for the remote server consuming sync bandwidth
sync_bytes_sent (required) - int64 - Sync bytes sent
sync_bytes_received (required) - int64 - Sync bytes received
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 85 def self.create(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: remote_server_id must be an Integer") if params[:remote_server_id] and !params[:remote_server_id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: sync_bytes_sent must be an Integer") if params[:sync_bytes_sent] and !params[:sync_bytes_sent].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: sync_bytes_received must be an Integer") if params[:sync_bytes_received] and !params[:sync_bytes_received].is_a?(Integer) raise MissingParameterError.new("Parameter missing: remote_server_id") unless params[:remote_server_id] raise MissingParameterError.new("Parameter missing: sync_bytes_sent") unless params[:sync_bytes_sent] raise MissingParameterError.new("Parameter missing: sync_bytes_received") unless params[:sync_bytes_received] response, = Api.send_request("/sync_bandwidth_snapshots", :post, params, ) SyncBandwidthSnapshot.new(response.data, ) end |
.create_batch(params = {}, options = {}) ⇒ Object
97 98 99 100 101 102 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 97 def self.create_batch(params = {}, = {}) response, = Api.send_request("/sync_bandwidth_snapshots/create_batch", :post, params, ) response.data.map do |entity_data| SyncBandwidthSnapshot.new(entity_data, ) end end |
Instance Method Details
#created_at ⇒ Object
date-time - sync bandwidth snapshot created at date/time
57 58 59 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 57 def created_at @attributes[:created_at] end |
#id ⇒ Object
int64 - sync bandwidth snapshot ID
15 16 17 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 15 def id @attributes[:id] end |
#id=(value) ⇒ Object
19 20 21 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 19 def id=(value) @attributes[:id] = value end |
#remote_server_id ⇒ Object
int64 - ID for the remote server consuming sync bandwidth
62 63 64 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 62 def remote_server_id @attributes[:remote_server_id] end |
#remote_server_id=(value) ⇒ Object
66 67 68 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 66 def remote_server_id=(value) @attributes[:remote_server_id] = value end |
#save ⇒ Object
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 70 def save if @attributes[:id] raise NotImplementedError.new("The SyncBandwidthSnapshot object doesn't support updates.") else new_obj = SyncBandwidthSnapshot.create(@attributes, @options) end @attributes = new_obj.attributes true end |
#site_id ⇒ Object
int64 - Site ID
24 25 26 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 24 def site_id @attributes[:site_id] end |
#site_id=(value) ⇒ Object
28 29 30 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 28 def site_id=(value) @attributes[:site_id] = value end |
#sync_bytes_received ⇒ Object
decimal - bytes received
33 34 35 36 37 38 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 33 def sync_bytes_received value = @attributes[:sync_bytes_received] return value if value.nil? || value.is_a?(BigDecimal) BigDecimal(value.to_s) end |
#sync_bytes_received=(value) ⇒ Object
40 41 42 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 40 def sync_bytes_received=(value) @attributes[:sync_bytes_received] = value end |
#sync_bytes_sent ⇒ Object
decimal - bytes sent
45 46 47 48 49 50 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 45 def sync_bytes_sent value = @attributes[:sync_bytes_sent] return value if value.nil? || value.is_a?(BigDecimal) BigDecimal(value.to_s) end |
#sync_bytes_sent=(value) ⇒ Object
52 53 54 |
# File 'lib/files.com/models/sync_bandwidth_snapshot.rb', line 52 def sync_bytes_sent=(value) @attributes[:sync_bytes_sent] = value end |