gyazo 0.2.1 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of gyazo might be problematic. Click here for more details.

Files changed (2) hide show
  1. data/lib/gyazo.rb +10 -3
  2. metadata +4 -4
@@ -6,10 +6,11 @@ require 'net/http'
6
6
  require 'json'
7
7
 
8
8
  class Gyazo
9
- VERSION = '0.2.1'
9
+ VERSION = '0.3.1'
10
10
 
11
- def initialize(app = '/Applications/Gyazo.app')
11
+ def initialize(app = '/Applications/Gyazo.app',userid=nil)
12
12
  @user = IO.popen("whoami", "r+").gets.chomp
13
+ @userid = userid
13
14
  @program = app
14
15
  @idfile = "/Users/#{@user}/Library/Gyazo/id"
15
16
  @old_idfile = File.dirname(@program) + "/gyazo.app/Contents/Resources/id"
@@ -23,6 +24,7 @@ class Gyazo
23
24
  end
24
25
 
25
26
  attr_accessor :id
27
+ attr_accessor :userid
26
28
 
27
29
  def info(gyazoid)
28
30
  gyazoid =~ /[0-9a-f]{32}/
@@ -36,7 +38,12 @@ class Gyazo
36
38
  end
37
39
 
38
40
  def list(page,count)
39
- cgi = "/api/image/list?userkey=#{@id}&page=#{page}&count=#{count}"
41
+ # 旧API
42
+ # cgi = "/api/image/list?userkey=#{@id}&page=#{page}&count=#{count}"
43
+ # 新API: @useridが指定されている場合はマシン共通のUserIDを利用する
44
+ cgi = (@userid ?
45
+ "/api/image/list?user_id=#{@userid}&page=#{page}&count=#{count}" :
46
+ "/api/image/list?device_id=#{@id}&page=#{page}&count=#{count}")
40
47
  header = {}
41
48
  res = Net::HTTP.start(@host,80){|http|
42
49
  http.get(cgi,header)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gyazo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 1
10
- version: 0.2.1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Toshiyuki Masui
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-02-21 00:00:00 Z
18
+ date: 2013-02-28 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rdoc