supermarket 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +17 -0
- data/bin/market +10 -0
- data/lib/supermarket/jars/AndroidMarketApi.jar +0 -0
- data/lib/supermarket/jars/protobuf-java-2.2.0.jar +0 -0
- data/lib/supermarket/session.rb +67 -0
- metadata +66 -0
data/README.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
# Android Market API
|
3
|
+
|
4
|
+
This is a thin JRuby wrapper for the [Android Market API](http://code.google.com/p/android-market-api/) Java project.
|
5
|
+
|
6
|
+
It's a new project and only some parts of the protocol have been implemented.
|
7
|
+
|
8
|
+
## Synopis
|
9
|
+
|
10
|
+
require 'android-market/session'
|
11
|
+
session = AndroidMarket::Session.new
|
12
|
+
|
13
|
+
# search apps
|
14
|
+
session.search("foo")
|
15
|
+
|
16
|
+
# retrieve comments for an app
|
17
|
+
session.comments("com.example.my.project")
|
data/bin/market
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
|
3
|
+
|
4
|
+
require 'supermarket/session'
|
5
|
+
|
6
|
+
puts case ARGV.shift
|
7
|
+
when "search"; SuperMarket::Session.new.search(ARGV.shift || "Test")
|
8
|
+
when "comments";SuperMarket::Session.new.comments(ARGV.shift || 'org.jruby.ruboto.irb')
|
9
|
+
else "#{File.basename($0)} [search|comments] [query|app_id]"
|
10
|
+
end
|
Binary file
|
Binary file
|
@@ -0,0 +1,67 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
require 'java'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
require File.dirname(__FILE__) + "/jars/AndroidMarketApi.jar"
|
6
|
+
require File.dirname(__FILE__) + "/jars/protobuf-java-2.2.0.jar"
|
7
|
+
|
8
|
+
import 'com.gc.android.market.api.MarketSession'
|
9
|
+
import 'com.gc.android.market.api.model.Market'
|
10
|
+
|
11
|
+
#A thin Ruby wrapper around the Java based Android Market API
|
12
|
+
#http://code.google.com/p/android-market-api/
|
13
|
+
module SuperMarket
|
14
|
+
class Session
|
15
|
+
attr_reader :_session
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
@_session = MarketSession.new
|
19
|
+
@_session.login(config['login'], config['password'])
|
20
|
+
end
|
21
|
+
|
22
|
+
def config_file
|
23
|
+
File.join(ENV['HOME'], '.supermarket.yml')
|
24
|
+
end
|
25
|
+
|
26
|
+
def config
|
27
|
+
@config ||= begin
|
28
|
+
unless File.exists?(config_file)
|
29
|
+
File.open(config_file, 'w') { |f| f << YAML.dump('login'=>'someone@gmail.com', 'password'=>'secr3t') }
|
30
|
+
raise "Android market config file not found. Please edit #{config_file}"
|
31
|
+
end
|
32
|
+
YAML.load_file(config_file)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def search(query, extended=true, start=0, count=10)
|
38
|
+
request = Market::AppsRequest.newBuilder().
|
39
|
+
setQuery(query).
|
40
|
+
setStartIndex(start).
|
41
|
+
setEntriesCount(count).
|
42
|
+
setWithExtendedInfo(extended).build
|
43
|
+
execute(request)
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
def comments(app_id, start=0, count=10)
|
48
|
+
request = Market::CommentsRequest.newBuilder().
|
49
|
+
setAppId(app_id).
|
50
|
+
setStartIndex(start).
|
51
|
+
setEntriesCount(count).build()
|
52
|
+
|
53
|
+
execute(request).comments_list.to_a
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
protected
|
58
|
+
def execute(request)
|
59
|
+
response = nil
|
60
|
+
_session.append(request) do |ctxt, resp|
|
61
|
+
response = resp
|
62
|
+
end
|
63
|
+
_session.flush
|
64
|
+
response
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: supermarket
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
version: 0.0.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Jan Berkel
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-03-23 00:00:00 +01:00
|
18
|
+
default_executable: market
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: An unoffical/reverse engineered API for Android market
|
22
|
+
email: jan.berkel@gmail.com
|
23
|
+
executables:
|
24
|
+
- market
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README.md
|
29
|
+
files:
|
30
|
+
- bin/market
|
31
|
+
- lib/supermarket/jars/AndroidMarketApi.jar
|
32
|
+
- lib/supermarket/jars/protobuf-java-2.2.0.jar
|
33
|
+
- lib/supermarket/session.rb
|
34
|
+
- README.md
|
35
|
+
has_rdoc: true
|
36
|
+
homepage: http://github.com/jberkel/supermarket
|
37
|
+
licenses: []
|
38
|
+
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options:
|
41
|
+
- --charset=UTF-8
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
segments:
|
49
|
+
- 0
|
50
|
+
version: "0"
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
version: "0"
|
58
|
+
requirements: []
|
59
|
+
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 1.3.6
|
62
|
+
signing_key:
|
63
|
+
specification_version: 3
|
64
|
+
summary: JRuby bindings for android-market-api
|
65
|
+
test_files: []
|
66
|
+
|