Class: ItunesSearch::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/itunes-search/search.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Search

Returns a new instance of Search.



7
8
9
# File 'lib/itunes-search/search.rb', line 7

def initialize(*args)
  @options = args.inject({}) { |result, element| element.merge(result); element  }
end

Instance Attribute Details

#jsonObject

Returns the value of attribute json.



5
6
7
# File 'lib/itunes-search/search.rb', line 5

def json
  @json
end

#optionsObject

Returns the value of attribute options.



5
6
7
# File 'lib/itunes-search/search.rb', line 5

def options
  @options
end

#result_hashObject

Returns the value of attribute result_hash.



5
6
7
# File 'lib/itunes-search/search.rb', line 5

def result_hash
  @result_hash
end

Instance Method Details

#resultsObject



11
12
13
14
15
# File 'lib/itunes-search/search.rb', line 11

def results 
  ra = []
  ra = to_hash["results"].collect {|r| OpenStruct.new(r) } unless to_hash["results"].empty?
  return ra
end