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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e65dd6e3ffb8646a0c6581c36a9f98a8da2633bc
4
- data.tar.gz: 15812ea2cd6b802a72f872c7d80523fe9d1debab
3
+ metadata.gz: 219615c9ae39e62cfc3ed2122b3fd4a048d45b2c
4
+ data.tar.gz: 1a631d3436f84a93f1ff7f66b0ee39d57ef00fe5
5
5
  SHA512:
6
- metadata.gz: ae89aeaf000a410af3db162e4f457c182aaa1788bd1547ee106765c8222c439261e15697b85c798455d8acb3d992975d6d1263bef3599f1afce0f9dd2af0864a
7
- data.tar.gz: fe2488f428a5cacb59547d56752bfbb75b66308a7c53ab049c12c4f41e4dde91b58bebf2508fb05b20a5db664cccd8a46b6737bfb1a010f93ef9a544909cf46e
6
+ metadata.gz: 1a10d9a91f3f284432766630585dd851411eeddd349b31d0dd5a0d256fe1e2bb26ac9d6a25321eb61a7df12d8f97b9e7be75df4f266f57d83e16afd5aa945547
7
+ data.tar.gz: cae5e950dc046ffa938d442a8cbad85c6acd3a024aed39eac8d4d618b256b8c86ae9bd48bcb1e28ec65134a4c8c75d529fa7763d083a77c7d65d7e9a8330993c
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.2
4
+ env:
5
+ secure: SKTPKUXfgOehDNdgdMxKykef1m7XswYKA72qANyqHQ3/P/9c7RcRfTSVD86wj4riT8BX5YTbNhKKQFa79HozioezF7tT5A6xF5qiJOt1sjjtMfhc0d3zqN3RVJNRpx+1+hgNpv9OQ6RrTdw3At1TjzvgdMAiJI4X8lqZ904Gu60=
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['image_id']
36
+ puts image['url']
35
37
  end
36
38
  ```
37
39
 
@@ -2,7 +2,6 @@ require 'gyazo/version'
2
2
  require 'gyazo/error'
3
3
  require 'gyazo/client'
4
4
 
5
- require 'erb' # for httparty bug
6
5
  require 'httparty'
7
6
  require 'httmultiparty'
8
7
  require 'json'
@@ -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 = null)
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
@@ -1,3 +1,3 @@
1
1
  module Gyazo
2
- VERSION = '2.0.0'
2
+ VERSION = '2.1.1'
3
3
  end
@@ -4,7 +4,6 @@ require 'gyazo'
4
4
 
5
5
  gyazo = Gyazo::Client.new(ENV['GYAZO_TOKEN'])
6
6
 
7
- res = gyazo.list(:page => 1, :per_page => 50)
8
-
9
- puts res[0]
10
- puts res[0]['url']
7
+ gyazo.list(:page => 1, :per_page => 5).each do |img|
8
+ puts img['url']
9
+ end
@@ -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 test_upload
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.0.0
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-05-16 00:00:00.000000000 Z
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.0.14
142
+ rubygems_version: 2.2.2
142
143
  signing_key:
143
144
  specification_version: 4
144
145
  summary: Gyazo.com API Wrapper