Module: Skus

Included in:
Ecommerce
Defined in:
lib/user/ecommerce/skus.rb

Instance Method Summary collapse

Instance Method Details

#create_sku(data) ⇒ Object

Create sku.

Create a sku with data.

Parameters

data

(Hash) – Data to be submited.

Example

data = {
  "sku": "NEW-SKU-XXXXXX",
  "title": "New Sku",
  "slug": "new-sku",
  "product_id": 1
}
@data = @mints_user.create_sku(data)
[View source]

57
58
59
# File 'lib/user/ecommerce/skus.rb', line 57

def create_sku(data)
    return @client.raw("post", "/ecommerce/skus", nil, data_transform(data))
end

#delete_sku(id) ⇒ Object

Delete sku.

Delete a sku.

Parameters

id

(Integer) – Sku id.

Example

@data = @mints_user.delete_sku(531)
[View source]

85
86
87
# File 'lib/user/ecommerce/skus.rb', line 85

def delete_sku(id)
    return @client.raw("delete", "/ecommerce/skus/#{id}")
end

#get_sku(id, options = nil) ⇒ Object

Get sku.

Get a sku info.

Parameters

id

(Integer) – Sku id.

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

First Example

@data = @mints_user.get_sku(1)

Second Example

options = {
  "fields": "title, sku"
}
@data = @mints_user.get_sku(1, options)
[View source]

39
40
41
# File 'lib/user/ecommerce/skus.rb', line 39

def get_sku(id, options = nil)
    return @client.raw("get", "/ecommerce/skus/#{id}", options)
end

#get_skus(options = nil) ⇒ Object

Get skus.

Get a collection of skus.

Parameters

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

First Example

@data = @mints_user.get_skus

Second Example

options = {
  "fields": "sku"
}
@data = @mints_user.get_skus(options)
[View source]

20
21
22
# File 'lib/user/ecommerce/skus.rb', line 20

def get_skus(options = nil)
    return @client.raw("get", "/ecommerce/skus", options)
end

#update_sku(id, data) ⇒ Object

Update sku.

Update a sku info.

Parameters

id

(Integer) – Sku id.

data

(Hash) – Data to be submited.

Example

data = {
  "sku": "NEW-SKU-XXXXXY"
}
@data = @mints_user.update_sku(531, data)
[View source]

73
74
75
# File 'lib/user/ecommerce/skus.rb', line 73

def update_sku(id, data)
    return @client.raw("put", "/ecommerce/skus/#{id}", nil, data_transform(data))
end