supermarket 0.0.1-universal-java → 0.0.2-universal-java

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 CHANGED
@@ -47,8 +47,6 @@ You will need to provide your Google market credentials in ~/.supermarket.yml:
47
47
  "ExtendedInfo": {
48
48
  "category": "Tools",
49
49
  "permissionId": [
50
-
51
-
52
50
  ...
53
51
 
54
52
  ### Comments
@@ -63,7 +61,6 @@ You will need to provide your Google market credentials in ~/.supermarket.yml:
63
61
  "text": "Tremendous application. More examples would be great (as would integrated rubydocs), but awesome all the same.",
64
62
  "authorId": "04441815096871118032"
65
63
  },
66
-
67
64
  ...
68
65
 
69
66
  ### Screenshot
@@ -81,8 +78,7 @@ All rights reserved.
81
78
 
82
79
  Redistribution and use in source and binary forms, with or without
83
80
  modification, are permitted provided that the following conditions are met:
84
- * Redistributions of source code must retain the above copyright
85
- notice, this list of conditions and the following disclaimer.
81
+
86
82
  * Redistributions in binary form must reproduce the above copyright
87
83
  notice, this list of conditions and the following disclaimer in the
88
84
  documentation and/or other materials provided with the distribution.
data/bin/market CHANGED
@@ -6,12 +6,12 @@ format = ARGV.map { |a| a[/--format=(\w+)/, 1]}.compact.first || "json"
6
6
  image = ARGV.map { |a| a[/--image-out=([^\s]+)/, 1]}.compact.first || "image.jpg"
7
7
 
8
8
  def usage
9
- puts "#{File.basename($0)} [search|comments|image|imagedata] [query|app_id] [--format=json|xml|html] [--image-out=file]"
9
+ puts "#{File.basename($0)} [search|comments|all_comments|image|imagedata] [query|app_id] [--format=json|xml|html] [--image-out=file]"
10
10
  exit 1
11
11
  end
12
12
 
13
13
  case command = ARGV.shift
14
- when /\A(search|comments|image)\Z/
14
+ when /\A(search|(all_)?comments|image)\Z/
15
15
  arg = ARGV.shift or usage
16
16
  puts Supermarket::Session.new.send(command, arg).send("to_#{format.downcase}")
17
17
  when 'imagedata'
@@ -9,7 +9,7 @@ module Supermarket
9
9
  import 'com.google.protobuf.XmlFormat'
10
10
  import 'com.google.protobuf.HtmlFormat'
11
11
 
12
- def to_json
12
+ def to_json(*a)
13
13
  JsonFormat.printToString(self)
14
14
  end
15
15
 
@@ -20,5 +20,13 @@ module Supermarket
20
20
  def to_html
21
21
  HtmlFormat.printToString(self)
22
22
  end
23
+
24
+ def to_ruby
25
+ require 'json'
26
+ JSON.parse(to_json)
27
+ end
23
28
  end
24
- end
29
+ end
30
+
31
+ #make formats available everywhere
32
+ Java::ComGoogleProtobuf::GeneratedMessage.send(:include, Supermarket::Formats)
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env jruby
2
+ require 'rubygems'
2
3
  require 'java'
3
4
  require 'yaml'
5
+ require 'json'
4
6
 
5
7
  require File.dirname(__FILE__) + "/jars/AndroidMarketApi.jar"
6
8
  require File.dirname(__FILE__) + "/jars/protobuf-java-2.2.0.jar"
7
9
  require File.dirname(__FILE__) + "/formats"
8
10
 
11
+
9
12
  #A thin Ruby wrapper around the Java based Android Market API
10
13
  #http://code.google.com/p/android-market-api/
11
14
  module Supermarket
12
15
  import 'com.gc.android.market.api.MarketSession'
13
16
  import 'com.gc.android.market.api.model.Market'
14
17
 
15
- [Market::CommentsResponse, Market::AppsResponse, Market::GetImageResponse].each do |msg|
16
- msg.send(:include, Formats)
17
- end
18
18
 
19
19
  class Session
20
20
  attr_reader :_session
@@ -60,7 +60,18 @@ module Supermarket
60
60
  if resp = execute(request)
61
61
  resp
62
62
  else
63
- []
63
+ raise ArgumentError, "request returned nil"
64
+ end
65
+ end
66
+
67
+ # fetch all available comments
68
+ def all_comments(app_id, c=[])
69
+ comments_resp = comments(app_id, c.size, 10)
70
+ c += comments_resp.comments_list.to_a
71
+ if comments_resp.entriesCount == c.size
72
+ c
73
+ else
74
+ all_comments(app_id, c)
64
75
  end
65
76
  end
66
77
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: universal-java
11
11
  authors:
12
12
  - Jan Berkel
@@ -14,10 +14,21 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-28 00:00:00 +01:00
17
+ date: 2010-03-29 00:00:00 +02:00
18
18
  default_executable: market
19
- dependencies: []
20
-
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: json-jruby
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
21
32
  description: An unoffical/reverse engineered API for Android market.
22
33
  email: jan.berkel@gmail.com
23
34
  executables: