yahoo-api 0.1.5 → 0.1.6
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.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/example/news.rb +7 -0
- data/lib/yahoo/api.rb +2 -0
- data/lib/yahoo/api/news.rb +22 -0
- data/lib/yahoo/api/request.rb +2 -2
- data/lib/yahoo/api/response.rb +7 -3
- data/lib/yahoo/api/version.rb +1 -1
- data/yahoo-api.gemspec +3 -2
- metadata +20 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c12b4166ae698e80b66c193ff650fa242b87d0f0
|
4
|
+
data.tar.gz: 61432bf54321e2885bc48f1a96c409dae7c3f0ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cb03017cc5a3f10fb31bf63e0f1a21318fae1204e771093afd6f03cbad9d87c7c4d8d9779f944107791db1b05505d5ae73d48c40cbd3d5cb5334d50ffdc31ae
|
7
|
+
data.tar.gz: d334b37bcf38dd62f970c89041de29210c6fc0cc2333164ca8fb2287a630b651a010fa0b4759c26ceb17892e372233e82419445f6ad5399ded04607a5babda29
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Yahoo::Api
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/yahoo-api)
|
4
|
-
Ruby Yahoo Japan Web API ( Shopping
|
4
|
+
Ruby Yahoo Japan Web API ( Shopping,Auction,News supported )
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
@@ -71,9 +71,11 @@ Yahoo::Api::Auction::BidHistory # Bid History API v1
|
|
71
71
|
Yahoo::Api::Auction::BidHistoryDetail # Bid History Detail API v1
|
72
72
|
Yahoo::Api::Auction::ShowQAndA # Show Q & A API v1
|
73
73
|
Yahoo::Api::Auction::ShowRating # Show Rating API v1
|
74
|
+
# Yahoo News Web API
|
75
|
+
Yahoo::Api::News::Topics # Topics API v2
|
74
76
|
```
|
75
77
|
|
76
|
-
Refer to [Shopping Web API documentation](http://developer.yahoo.co.jp/webapi/shopping/)
|
78
|
+
Refer to [Shopping Web API documentation](http://developer.yahoo.co.jp/webapi/shopping/),[Auction Web API documentation](http://developer.yahoo.co.jp/webapi/auctions/),[News Web API documentation](http://developer.yahoo.co.jp/webapi/news/) for more infomation.
|
77
79
|
|
78
80
|
## Contributing
|
79
81
|
|
data/example/news.rb
ADDED
data/lib/yahoo/api.rb
CHANGED
@@ -2,11 +2,13 @@ require "net/http"
|
|
2
2
|
require "uri"
|
3
3
|
require "cgi"
|
4
4
|
require "json"
|
5
|
+
require 'active_support/core_ext'
|
5
6
|
require "yahoo/api/version"
|
6
7
|
require "yahoo/api/response"
|
7
8
|
require "yahoo/api/request"
|
8
9
|
require "yahoo/api/shopping"
|
9
10
|
require "yahoo/api/auction"
|
11
|
+
require "yahoo/api/news"
|
10
12
|
|
11
13
|
module Yahoo
|
12
14
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Yahoo
|
2
|
+
|
3
|
+
class Api
|
4
|
+
|
5
|
+
class News
|
6
|
+
|
7
|
+
Topics = "Yahoo::Api::News.topics"
|
8
|
+
|
9
|
+
class << self
|
10
|
+
|
11
|
+
# Yahoo News Topics API v2
|
12
|
+
def topics(opts={})
|
13
|
+
Yahoo::Request.get("http://news.yahooapis.jp/NewsWebService/V2/topics", Yahoo::Api.merge(opts), "xml")
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/lib/yahoo/api/request.rb
CHANGED
@@ -2,9 +2,9 @@ module Yahoo
|
|
2
2
|
|
3
3
|
class Request
|
4
4
|
|
5
|
-
def self.get(path,opts)
|
5
|
+
def self.get(path,opts,format="json")
|
6
6
|
uri = URI.parse("#{path}?#{opts.map {|k,v|"#{k}=#{CGI.escape(v)}"}.join('&')}")
|
7
|
-
Yahoo::Response.new(Net::HTTP.get_response(uri))
|
7
|
+
Yahoo::Response.new(Net::HTTP.get_response(uri),format)
|
8
8
|
end
|
9
9
|
|
10
10
|
end
|
data/lib/yahoo/api/response.rb
CHANGED
@@ -2,11 +2,15 @@ module Yahoo
|
|
2
2
|
|
3
3
|
class Response
|
4
4
|
|
5
|
-
def initialize(response)
|
5
|
+
def initialize(response,format)
|
6
6
|
@response =response
|
7
7
|
body = @response.body
|
8
|
-
|
9
|
-
|
8
|
+
if format == "json"
|
9
|
+
body = body[9..(body.rindex(")")-1)] if body.include?("callback(")
|
10
|
+
@body = JSON.parse(body)
|
11
|
+
else
|
12
|
+
@body = Hash.from_xml(body)
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
16
|
def code
|
data/lib/yahoo/api/version.rb
CHANGED
data/yahoo-api.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Yahoo::Api::VERSION
|
9
9
|
spec.authors = ["shoprev"]
|
10
10
|
spec.email = ["admin@shoprev.net"]
|
11
|
-
spec.description = %q{Ruby Yahoo Japan Web API ( Shopping
|
12
|
-
spec.summary = %q{Ruby Yahoo Japan Web API ( Shopping
|
11
|
+
spec.description = %q{Ruby Yahoo Japan Web API ( Shopping,Auction,News )}
|
12
|
+
spec.summary = %q{Ruby Yahoo Japan Web API ( Shopping,Auction,News )}
|
13
13
|
spec.homepage = "https://github.com/shoprev/yahoo-api"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -23,4 +23,5 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "rspec"
|
24
24
|
spec.add_development_dependency "vcr"
|
25
25
|
spec.add_development_dependency "webmock", "1.11.0"
|
26
|
+
spec.add_runtime_dependency "activesupport"
|
26
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yahoo-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shoprev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,7 +80,21 @@ dependencies:
|
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.11.0
|
83
|
-
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: activesupport
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Ruby Yahoo Japan Web API ( Shopping,Auction,News )
|
84
98
|
email:
|
85
99
|
- admin@shoprev.net
|
86
100
|
executables: []
|
@@ -94,9 +108,11 @@ files:
|
|
94
108
|
- Rakefile
|
95
109
|
- example/auction.rb
|
96
110
|
- example/helper.rb
|
111
|
+
- example/news.rb
|
97
112
|
- example/shopping.rb
|
98
113
|
- lib/yahoo/api.rb
|
99
114
|
- lib/yahoo/api/auction.rb
|
115
|
+
- lib/yahoo/api/news.rb
|
100
116
|
- lib/yahoo/api/request.rb
|
101
117
|
- lib/yahoo/api/response.rb
|
102
118
|
- lib/yahoo/api/shopping.rb
|
@@ -132,7 +148,7 @@ rubyforge_project:
|
|
132
148
|
rubygems_version: 2.0.3
|
133
149
|
signing_key:
|
134
150
|
specification_version: 4
|
135
|
-
summary: Ruby Yahoo Japan Web API ( Shopping
|
151
|
+
summary: Ruby Yahoo Japan Web API ( Shopping,Auction,News )
|
136
152
|
test_files:
|
137
153
|
- spec/fixtures/shopping_content_match_item_http_/hoge_com/.yml
|
138
154
|
- spec/fixtures/shopping_content_match_item_http_/hogeaaaaaaaaaaaaaaaaaa_com/.yml
|