Module: Prints

Included in:
Content
Defined in:
lib/user/content/prints.rb

Instance Method Summary collapse

Instance Method Details

#create_print(data, options = nil) ⇒ Object

Create print.

Create a print with data.

Parameters

data

(Hash) – Data to be submitted.

Example

data = {
  user_id: 1,
  slug: "new-print",
  print_template_id: 1
}

options = { fields: 'id,slug' }

@data = @cxf_user.create_print(data, options)


64
65
66
# File 'lib/user/content/prints.rb', line 64

def create_print(data, options = nil)
  @client.raw('post', '/content/prints', options, data_transform(data))
end

#delete_print(id) ⇒ Object

Delete print.

Delete a print.

Parameters

id

(Integer) – print id.

Example

@data = @cxf_user.delete_print(6)


93
94
95
# File 'lib/user/content/prints.rb', line 93

def delete_print(id)
  @client.raw('delete', "/content/prints/#{id}")
end

#get_print(id, options = nil) ⇒ Object

Get print.

Get a print info.

Parameters

id

(Integer) – print id.

options

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

First Example

@data = @cxf_user.get_print(1)

Second Example

options = {
  fields: 'id, slug'
}
@data = @cxf_user.get_print(1, options)


44
45
46
# File 'lib/user/content/prints.rb', line 44

def get_print(id, options = nil)
  @client.raw('get', "/content/prints/#{id}", options)
end

#get_prints(options = nil, use_post = true) ⇒ Object

Get prints.

Get a collection of prints.

Parameters

options

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

use_post

(Boolean) – Variable to determine if the request is by ‘post’ or ‘get’ functions.

First Example

@data = @cxf_user.get_prints

Second Example

options = {
  fields: 'id, slug'
}
@data = @cxf_user.get_prints(options)

Third Example

options = {
  fields: 'id, slug'
}
@data = @cxf_user.get_prints(options, true)


25
26
27
# File 'lib/user/content/prints.rb', line 25

def get_prints(options = nil, use_post = true)
  get_query_results('/content/prints', options, use_post)
end

#update_print(id, data, options = nil) ⇒ Object

Update print.

Update a print info.

Parameters

id

(Integer) – print id.

data

(Hash) – Data to be submitted.

Example

data = {
  user_id: 1,
  slug: 'new-print'
}
@data = @cxf_user.update_print(5, data)


81
82
83
# File 'lib/user/content/prints.rb', line 81

def update_print(id, data, options = nil)
  @client.raw('put', "/content/prints/#{id}", options, data_transform(data))
end