supermarket 0.0.3-universal-java → 0.0.4-universal-java

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -29,12 +29,12 @@ def gemspec_file
29
29
  "#{name}.gemspec"
30
30
  end
31
31
 
32
- def platform
33
- eval(IO.read(gemspec_file)).platform.to_s
32
+ def gemspec
33
+ @gemspec ||= eval(IO.read(gemspec_file))
34
34
  end
35
35
 
36
36
  def gem_file
37
- "#{name}-#{version}-#{platform}.gem"
37
+ gemspec.file_name
38
38
  end
39
39
 
40
40
  def replace_header(head, header_name)
@@ -60,6 +60,7 @@ end
60
60
  #
61
61
  #############################################################################
62
62
 
63
+ desc "release new version"
63
64
  task :release => :build do
64
65
  unless `git branch` =~ /^\* master$/
65
66
  puts "You must be on the master branch to release!"
@@ -68,7 +69,7 @@ task :release => :build do
68
69
  sh "git commit --allow-empty -a -m 'Release #{version}'"
69
70
  sh "git tag v#{version}"
70
71
  sh "git push origin master --tags"
71
- sh "gem push pkg/#{name}-#{version}.gem"
72
+ sh "gem push pkg/#{gem_file}"
72
73
  end
73
74
 
74
75
  desc "Builds the gem"
data/lib/supermarket.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Supermarket
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
4
4
 
5
5
  require File.join(File.dirname(__FILE__), 'supermarket', 'session')
@@ -18,12 +18,20 @@ module Supermarket
18
18
 
19
19
  class Session
20
20
  attr_reader :_session
21
+ @@order_type = {
22
+ :none => Market::AppsRequest::OrderType.value_of(0),
23
+ :popular => Market::AppsRequest::OrderType.value_of(1),
24
+ :newest => Market::AppsRequest::OrderType.value_of(2),
25
+ :featured => Market::AppsRequest::OrderType.value_of(3)
26
+ }
27
+ def order_type(type_sym);@@order_type[type_sym];end
21
28
 
22
29
  def initialize(opts={})
23
30
  opts.merge!(self.class.config)
24
31
  @_session = MarketSession.new
32
+ @_session.getContext().setAndroidId("3000000000000000");
25
33
  if opts['authToken']
26
- @_session.setAuthToken(opts['authToken'])
34
+ @_session.setAuthSubToken(opts['authToken'])
27
35
  else
28
36
  raise "Need login and password" unless opts['login'] && opts['password']
29
37
  @_session.login(opts['login'], opts['password'])
@@ -46,14 +54,35 @@ module Supermarket
46
54
  end
47
55
  end
48
56
 
57
+ def get_app(app_id)
58
+ request_builder = Market::AppsRequest.newBuilder()
59
+ request_builder.set_app_id(app_id).set_with_extended_info(true)
60
+ execute(request_builder.build())
61
+ end
62
+
49
63
 
50
- def search(query, extended=true, start=0, count=10)
51
- request = Market::AppsRequest.newBuilder().
52
- setQuery(query).
64
+ def search(query=nil, categid=nil,extended=true, start=0, count=10, order=:popular)
65
+ request_builder = Market::AppsRequest.newBuilder()
66
+
67
+ if query.nil? and !categid.nil?
68
+ request_builder.setCategoryId(categid)
69
+ elsif !query.nil? and categid.nil?
70
+ request_builder.setQuery(query)
71
+ elsif !query.nil? and !categid.nil?
72
+ request_builder.setQuery(query)
73
+ request_builder.setCategoryId(categid)
74
+ else
75
+ raise "query or category_id must not be nil."
76
+ end
77
+
78
+ request_builder.
53
79
  setStartIndex(start).
54
80
  setEntriesCount(count).
55
- setWithExtendedInfo(extended).build()
56
- execute(request)
81
+ setWithExtendedInfo(extended).
82
+ setOrderType(order_type(order))
83
+
84
+
85
+ execute(request_builder.build())
57
86
  end
58
87
 
59
88
  def categories()
data/supermarket.gemspec CHANGED
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'supermarket'
3
- s.version = '0.0.3'
3
+ s.version = '0.0.4'
4
4
  s.platform = 'universal-java'
5
5
 
6
6
  s.rubyforge_project = 'supermarket'
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jan Berkel"]
9
- s.date = '2010-08-10'
9
+ s.date = '2011-01-23'
10
10
  s.default_executable = %q{market}
11
11
  s.description = %q{An unoffical/reverse engineered API for Android market.}
12
12
  s.email = %q{jan.berkel@gmail.com}
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: universal-java
11
11
  authors:
12
12
  - Jan Berkel
@@ -14,13 +14,14 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-10 00:00:00 +02:00
17
+ date: 2011-01-23 00:00:00 +01:00
18
18
  default_executable: market
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: json-jruby
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
26
  - - ">="
26
27
  - !ruby/object:Gem::Version
@@ -64,6 +65,7 @@ rdoc_options:
64
65
  require_paths:
65
66
  - lib
66
67
  required_ruby_version: !ruby/object:Gem::Requirement
68
+ none: false
67
69
  requirements:
68
70
  - - ">="
69
71
  - !ruby/object:Gem::Version
@@ -71,6 +73,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
71
73
  - 0
72
74
  version: "0"
73
75
  required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
74
77
  requirements:
75
78
  - - ">="
76
79
  - !ruby/object:Gem::Version
@@ -80,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
83
  requirements: []
81
84
 
82
85
  rubyforge_project: supermarket
83
- rubygems_version: 1.3.6
86
+ rubygems_version: 1.3.7
84
87
  signing_key:
85
88
  specification_version: 3
86
89
  summary: JRuby bindings for android-market-api