yahoo-api 0.1.5 → 0.1.6

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: 910ca56b148beeda0e33d0b6ce4d6380a3f94f62
4
- data.tar.gz: 10445b0edd0b2f6f797ce23037a2f1fa8f9b6432
3
+ metadata.gz: c12b4166ae698e80b66c193ff650fa242b87d0f0
4
+ data.tar.gz: 61432bf54321e2885bc48f1a96c409dae7c3f0ed
5
5
  SHA512:
6
- metadata.gz: 5a36ba286ac498a28e20da7e8d7db945e81719e230300b4f724ea0c18763f682f6f0077f7fb054917333b4d9447861901814b35a2eb3e2978620161083b0e348
7
- data.tar.gz: f3dca075066b6d56dc2407b6fa3f7256eac6a167ac1422f2bd1eecc89ddbf70d89221a2c53a75e9f5aaa0f0a7201e7eb958d3d2ec03d3ef28a03077035eea685
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
  [![Gem Version](https://badge.fury.io/rb/yahoo-api.png)](http://badge.fury.io/rb/yahoo-api)
4
- Ruby Yahoo Japan Web API ( Shopping & Auction supported )
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/) or [Auction Web API documentation](http://developer.yahoo.co.jp/webapi/auctions/) for more infomation.
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
 
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/helper')
2
+
3
+ # Topics API v2
4
+ res = Yahoo::Api.get(Yahoo::Api::News::Topics,{:pickupcategory => "sports"})
5
+ res["ResultSet"]["Result"].each do |v|
6
+ p v["Title"]
7
+ end
@@ -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
@@ -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
@@ -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
- body = body[9..(body.rindex(")")-1)] if body.include?("callback(")
9
- @body = JSON.parse(body)
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
@@ -1,5 +1,5 @@
1
1
  module Yahoo
2
2
  class Api
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
@@ -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 & Auction )}
12
- spec.summary = %q{Ruby Yahoo Japan Web API ( Shopping & Auction )}
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.5
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-08 00:00:00.000000000 Z
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
- description: Ruby Yahoo Japan Web API ( Shopping & Auction )
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 & Auction )
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