Class: Issuu::Folder
- Inherits:
-
Object
- Object
- Issuu::Folder
- Defined in:
- lib/issuu/folder.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Class Method Summary collapse
- .add(name, params = {}) ⇒ Object
- .delete(folder_ids, params = {}) ⇒ Object
- .list(params = {}) ⇒ Object
- .update(folder_id, params = {}) ⇒ Object
Instance Method Summary collapse
-
#initialize(hash) ⇒ Folder
constructor
A new instance of Folder.
- #metaclass ⇒ Object
Constructor Details
#initialize(hash) ⇒ Folder
Returns a new instance of Folder.
5 6 7 8 9 10 11 |
# File 'lib/issuu/folder.rb', line 5 def initialize(hash) @attributes = hash hash.each do |key, value| .send :attr_accessor, key instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/issuu/folder.rb', line 3 def attributes @attributes end |
Class Method Details
.add(name, params = {}) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/issuu/folder.rb', line 20 def add(name, params={}) response = Cli.http_post( Issuu::API_URL, ParameterSet.new("issuu.folder.add", params.merge(:folderName => name)).output ) Folder.new(response["rsp"]["_content"]["folder"]) end |
.delete(folder_ids, params = {}) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/issuu/folder.rb', line 44 def delete(folder_ids, params={}) Cli.http_post( Issuu::API_URL, ParameterSet.new("issuu.folder.delete", params.merge({:folderIds => folder_ids.join(',')})).output ) return true end |
.list(params = {}) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/issuu/folder.rb', line 28 def list(params={}) response = Cli.http_get( Issuu::API_URL, ParameterSet.new("issuu.folders.list", params).output ) response["rsp"]["_content"]["result"]["_content"].map{|folder_hash| Document.new(folder_hash["folder"]) } end |
.update(folder_id, params = {}) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/issuu/folder.rb', line 36 def update(folder_id, params={}) response = Cli.http_post( Issuu::API_URL, ParameterSet.new("issuu.folder.update", params.merge(:folderId => folder_id)).output ) Folder.new(response["rsp"]["_content"]["folder"]) end |
Instance Method Details
#metaclass ⇒ Object
13 14 15 16 17 |
# File 'lib/issuu/folder.rb', line 13 def class << self self end end |