app_store 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.3
@@ -20,6 +20,9 @@ module AppStore::Caller
20
20
  # Format is XXXXXX-Y,Z where XXXXXX is the store number (us, french, ...), Y the language and Z the return format.
21
21
  # If you omit the language, the default one for the store is used.
22
22
  # Return format can be either "1" or "2" : "1" returns data to be directly displayed and "2" is a more structured format.
23
+ # apple app store codes:
24
+ # * 143441 : US
25
+ # * 143442 : FR
23
26
  answer = iphone_agent.get(:url => url, :headers => {"X-Apple-Store-Front" => '143441,2'}, :params => params)
24
27
  raise AppStore::RequestError if answer.code.to_s != '200'
25
28
  Plist::parse_xml answer.body
@@ -1,5 +1,6 @@
1
1
  require "app_store/base"
2
2
  require "app_store/application"
3
+ require 'pp'
3
4
 
4
5
  # A category like categories on the AppStore.
5
6
  # Available attributes:
@@ -18,13 +19,23 @@ class AppStore::Category < AppStore::Base
18
19
  plist['items'].collect { |item| new :plist => item }
19
20
  end
20
21
 
22
+ def self.find_by_id(id)
23
+ # TODO: pass item_id to new
24
+ category = new(:plist => AppStore::Caller.get(AppStore::Caller::CategoryURL, :id => id))
25
+ end
26
+
27
+ # Returns id for this category
28
+ def item_id
29
+ @item_id ||= @raw['url'].match("id=([0-9]+)")[1]
30
+ end
31
+
21
32
  # Returns an array of items contained in the category, with a maximum of 25 items (Apple limitation).
22
33
  # If there are more than 25 items in the category, an extra item is added at the end of the list
23
34
  # as a link to the next 25 entries.
24
35
  # Each element can be either a Category or an Application.
25
36
  def items
26
37
  if @items.nil?
27
- plist = AppStore::Caller.get(@raw['url'])
38
+ plist = @raw['items'] ? @raw : AppStore::Caller.get(@raw['url'])
28
39
  @items = AppStore::List.new(
29
40
  :list => plist['items'],
30
41
  :element_type => 'link',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabien Jakimowicz
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-03 00:00:00 +01:00
12
+ date: 2009-11-06 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency