class Particle::ProductFirmware

Domain model for one Particle device

Constants

ID_REGEX

Public Class Methods

new(client, product_or_id, attributes) click to toggle source
Calls superclass method Particle::Model::new
# File lib/particle/product_firmware.rb, line 9
def initialize(client, product_or_id, attributes)
  super(client, attributes)

  product = client.product(product_or_id)

  @attributes = { version: attributes } if attributes.is_a?(Integer) || attributes.is_a?(String)
  @attributes = @attributes.merge(product: product, product_id: product.id)

  @fully_loaded = true if @attributes.key?(:title)
end

Public Instance Methods

description() click to toggle source
# File lib/particle/product_firmware.rb, line 35
def description
  get_attributes unless @attributes[:description]
  @attributes[:description]
end
get_attributes() click to toggle source
# File lib/particle/product_firmware.rb, line 20
def get_attributes
  @loaded = @fully_loaded = true
  @attributes = @client.product_firmware_attributes(self)
end
path() click to toggle source
# File lib/particle/product_firmware.rb, line 48
def path
  "/v1/products/#{product_id}/firmware/#{version}"
end
product() click to toggle source
# File lib/particle/product_firmware.rb, line 40
def product
  @attributes[:product]
end
product_id() click to toggle source
# File lib/particle/product_firmware.rb, line 44
def product_id
  product.id
end
title() click to toggle source
# File lib/particle/product_firmware.rb, line 30
def title
  get_attributes unless @attributes[:title]
  @attributes[:title]
end
upload_path() click to toggle source
# File lib/particle/product_firmware.rb, line 52
def upload_path
  "/v1/products/#{product_id}/firmware"
end
version() click to toggle source
# File lib/particle/product_firmware.rb, line 25
def version
  get_attributes unless @attributes[:version]
  @attributes[:version]
end