gyazo 2.0.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/README.md +3 -1
- data/lib/gyazo.rb +0 -1
- data/lib/gyazo/client.rb +10 -4
- data/lib/gyazo/version.rb +1 -1
- data/samples/list.rb +3 -4
- data/test/test_gyazo.rb +6 -1
- metadata +19 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 219615c9ae39e62cfc3ed2122b3fd4a048d45b2c
|
4
|
+
data.tar.gz: 1a631d3436f84a93f1ff7f66b0ee39d57ef00fe5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a10d9a91f3f284432766630585dd851411eeddd349b31d0dd5a0d256fe1e2bb26ac9d6a25321eb61a7df12d8f97b9e7be75df4f266f57d83e16afd5aa945547
|
7
|
+
data.tar.gz: cae5e950dc046ffa938d442a8cbad85c6acd3a024aed39eac8d4d618b256b8c86ae9bd48bcb1e28ec65134a4c8c75d529fa7763d083a77c7d65d7e9a8330993c
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -2,6 +2,8 @@ Gyazo
|
|
2
2
|
=====
|
3
3
|
[Gyazo API](https://gyazo.com/api/docs) wrapper for Ruby
|
4
4
|
|
5
|
+
[![Build Status](https://travis-ci.org/masui/gyazo-ruby.svg?branch=master)](https://travis-ci.org/masui/gyazo-ruby)
|
6
|
+
|
5
7
|
- http://github.com/masui/gyazo-ruby
|
6
8
|
- https://rubygems.org/gems/gyazo
|
7
9
|
|
@@ -31,7 +33,7 @@ puts res['permalink_url'] # => "http://gyazo.com/a1b2cdef345"
|
|
31
33
|
|
32
34
|
```ruby
|
33
35
|
gyazo.list.each do |image|
|
34
|
-
image['
|
36
|
+
puts image['url']
|
35
37
|
end
|
36
38
|
```
|
37
39
|
|
data/lib/gyazo.rb
CHANGED
data/lib/gyazo/client.rb
CHANGED
@@ -1,20 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
module Gyazo
|
2
3
|
|
3
4
|
class Client
|
4
5
|
|
5
6
|
attr_accessor :id, :user_id, :user_agent, :host
|
6
7
|
|
7
|
-
def initialize(access_token =
|
8
|
+
def initialize(access_token = nil)
|
8
9
|
@access_token = access_token
|
9
10
|
@user_agent = "GyazoRubyGem/#{Gyazo::VERSION}"
|
10
11
|
end
|
11
|
-
|
12
|
-
def upload(imagefile)
|
12
|
+
|
13
|
+
def upload(imagefile,params={})
|
13
14
|
url = "https://upload.gyazo.com/api/upload"
|
15
|
+
time = params['time'] || params['created_at'] || Time.now
|
14
16
|
res = HTTMultiParty.post url, {
|
15
17
|
:query => {
|
16
18
|
:access_token => @access_token,
|
17
|
-
:imagedata => File.open(imagefile)
|
19
|
+
:imagedata => File.open(imagefile),
|
20
|
+
:created_at => time.to_i,
|
21
|
+
:referer_url => params['referer_url'] || params['url'] || '',
|
22
|
+
:title => params['title'] || '',
|
23
|
+
:desc => params['desc'] || ''
|
18
24
|
},
|
19
25
|
:header => {
|
20
26
|
'User-Agent' => @user_agent
|
data/lib/gyazo/version.rb
CHANGED
data/samples/list.rb
CHANGED
data/test/test_gyazo.rb
CHANGED
@@ -7,11 +7,16 @@ class TestGyazo < MiniTest::Test
|
|
7
7
|
@imagefile = File.expand_path 'test.png', File.dirname(__FILE__)
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
10
|
+
def test_upload_filepath
|
11
11
|
res = @gyazo.upload @imagefile
|
12
12
|
assert res['permalink_url'].match /^https?:\/\/gyazo.com\/[a-z\d]{32}$/i
|
13
13
|
end
|
14
14
|
|
15
|
+
def test_upload_file
|
16
|
+
res = @gyazo.upload File.open(@imagefile)
|
17
|
+
assert res['permalink_url'].match /^https?:\/\/gyazo.com\/[a-z\d]{32}$/i
|
18
|
+
end
|
19
|
+
|
15
20
|
def test_list
|
16
21
|
assert_equal @gyazo.list.class, Array
|
17
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gyazo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toshiyuki Masui
|
@@ -9,90 +9,90 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-12-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: minitest
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: json
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: httparty
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: httmultiparty
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
description: Gyazo.com API Wrapper
|
@@ -102,7 +102,8 @@ executables: []
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
-
- .gitignore
|
105
|
+
- ".gitignore"
|
106
|
+
- ".travis.yml"
|
106
107
|
- Gemfile
|
107
108
|
- LICENSE.txt
|
108
109
|
- Makefile
|
@@ -128,17 +129,17 @@ require_paths:
|
|
128
129
|
- lib
|
129
130
|
required_ruby_version: !ruby/object:Gem::Requirement
|
130
131
|
requirements:
|
131
|
-
- -
|
132
|
+
- - ">="
|
132
133
|
- !ruby/object:Gem::Version
|
133
134
|
version: '0'
|
134
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
136
|
requirements:
|
136
|
-
- -
|
137
|
+
- - ">="
|
137
138
|
- !ruby/object:Gem::Version
|
138
139
|
version: '0'
|
139
140
|
requirements: []
|
140
141
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.2.2
|
142
143
|
signing_key:
|
143
144
|
specification_version: 4
|
144
145
|
summary: Gyazo.com API Wrapper
|