Class: Shutterstock::Licenses

Inherits:
Array
  • Object
show all
Defined in:
lib/client/licenses.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_data) ⇒ Licenses

Returns a new instance of Licenses.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/client/licenses.rb', line 4

def initialize(raw_data)
	@raw_data = raw_data

	if raw_data.kind_of? Hash
		super(@raw_data["data"].map{ |license| License.new(license) })

      @total_count   = raw_data["total_count"].to_i
      @page          = raw_data["page"].to_i
      @per_page          = raw_data["per_page"].to_i
      @message     = raw_data["message"]
      @errors     = raw_data["errors"]

	elsif raw_data.kind_of? Array
		super( @raw_data.map{ |license| License.new(license) } )
	end

	self
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



3
4
5
# File 'lib/client/licenses.rb', line 3

def errors
  @errors
end

#messageObject (readonly)

Returns the value of attribute message.



3
4
5
# File 'lib/client/licenses.rb', line 3

def message
  @message
end

#pageObject (readonly)

Returns the value of attribute page.



3
4
5
# File 'lib/client/licenses.rb', line 3

def page
  @page
end

#per_pageObject (readonly)

Returns the value of attribute per_page.



3
4
5
# File 'lib/client/licenses.rb', line 3

def per_page
  @per_page
end

#raw_dataObject (readonly)

Returns the value of attribute raw_data.



3
4
5
# File 'lib/client/licenses.rb', line 3

def raw_data
  @raw_data
end

#total_countObject (readonly)

Returns the value of attribute total_count.



3
4
5
# File 'lib/client/licenses.rb', line 3

def total_count
  @total_count
end