Class: Etsy::AttributeValue

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/etsy/attribute_value.rb

Overview

AttributeValue

An attribute of a listing according to its taxonomy.

An attribute has the following attributes:

[property_id] (INT) The numeric ID of this property.

property_name

(STRING) The name of the property, in the requested locale language.

scale_id

(INT) The numeric ID of the scale (if any).

scale_name

(STRING) The label used to describe the chosen scale (if any).

value_ids

(Array(INT)) The numeric IDs of the values.

values

(Array(STRING)) The literal values of the value

Class Method Summary collapse

Methods included from Model

included, #initialize, #result, #secret, #token

Class Method Details

.create(listing, property_hash, options = {}) ⇒ Object

Adds a new attribute_value to the listing given



31
32
33
34
35
36
# File 'lib/etsy/attribute_value.rb', line 31

def self.create(listing, property_hash, options = {})
  property_id = property_hash[:property_id]
  options.merge!(:require_secure => true)
  options.merge!(property_hash)
  put("/listings/#{listing.id}/attributes/#{property_id}", options)
end

.destroy(listing, property_value, options = {}) ⇒ Object

Delete attribute_value from listing



40
41
42
43
# File 'lib/etsy/attribute_value.rb', line 40

def self.destroy(listing, property_value, options = {})
  options.merge!(:require_secure => true)
  delete("/listings/#{listing.id}/attributes/#{property_value.id}", options)
end

.find_all_by_listing_id(listing_id, options = {}) ⇒ Object

Fetch all property_values for a given listing.



25
26
27
# File 'lib/etsy/attribute_value.rb', line 25

def self.find_all_by_listing_id(listing_id, options = {})
  get_all("/listings/#{listing_id}/attributes", options)
end