rakuten_web_service 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTVjZWM1MjZhMWRmZDZhMzZkYmZhZThjNjJiZGE1NzNkZjNmYTYyMw==
4
+ MTJhM2YwOGVjMzRkZTUyNmQyMjhiZTVjZWNiNzE4NmNmN2FkMzI2Mw==
5
5
  data.tar.gz: !binary |-
6
- YjUzZDE3YzY0NGQxYjVjOTdmOGQ1ODAzYzU5Yzc2ZGI3MjhiNzZiYQ==
6
+ YWRlNjc0MDE4NjI2OWE3YzQxNTM2MGRlZGRmNDQ4ZGU1NDZmNDU3Yw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MTY4NDM0OGQwZmEyYTc3MzE2YjJhZDA4MGRjYWQwYjQwNGY1MWQ0YzU2NGVm
10
- MzgzODI3ZTRjZmY5NGQ2ZWEwNThmZjE0MzQ4YzM3MjczYTljYWFjMWNkODEz
11
- NGEyNzk1NjgzNjgxZmYzNWNiMWM0MTg0YTk3ZGRjZGQxN2E1ZGQ=
9
+ YmY2NWI2NzcwZDhkMTBhMDMwNmUzNTc5YTFjNDcyMmEyN2I2ZmQyMjI1ZDg1
10
+ YWI1NjhlNjc5NTAxM2M2ZGI5MjkwN2MzMjZhYjY4ZWZlMzhlNGM5YzBhZDk3
11
+ MjRjOTc0YWMwMjFjMDU3M2Q0NDhjYzMwNDU0YmU1YzA5NGFjNWQ=
12
12
  data.tar.gz: !binary |-
13
- MzM0NGQ2NmZmZWRiNjU2Y2QxYjgyNWM1NThjNWNlZmE3NDVlNDc1ZjM0MmVk
14
- YjA0ODA1ZWJmOTM1YzA0MWMwZTQwZjM0YzI3MzcxZTc3MjUxOGM3NmE4NmFl
15
- ZTM3MDY3NGI5MzZhNTNjYzYxYTk1MjViYjliNWU3ZTdmMjU0ZTQ=
13
+ ZjQxMjk4MGRjNzZiNzRhZWRiMDE0ZThiYWZiYmMyNzQwNjg3YTYxOTcxZWE3
14
+ ZmViYmIwY2YxNGFmMGM3MzJkYjc0MWM2MmQ5YTgxM2I3MDU2ZGVmNzc1ZWNj
15
+ ZGUwZDhmMTJiZTJlOGM2MzJjZTYyODZiMWM5NzIwNDUxMmE0OGM=
data/README.en.md ADDED
@@ -0,0 +1,79 @@
1
+ # RakutenWebService
2
+
3
+ [![Build Status](https://travis-ci.org/rakuten-ws/rws-ruby-sdk.png?branch=master)](https://travis-ci.org/rakuten-ws/rws-ruby-sdk) [![Gem Version](https://badge.fury.io/rb/rakuten_web_service.png)](http://badge.fury.io/rb/rakuten_web_service)
4
+
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'rakuten_web_service'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install rakuten_web_service
21
+
22
+ ## Usage
23
+
24
+ Now rakuten\_web\_service is supporting the following APIs:
25
+
26
+ * [Rakuten Ichiba Item Search API](http://webservice.rakuten.co.jp/api/ichibaitemsearch/)
27
+ * [Rakuten Ichiba Genre Search API](http://webservice.rakuten.co.jp/api/ichibagenresearch/)
28
+ * [Rakuten Ichiba Ranking API](http://webservice.rakuten.co.jp/api/ichibaitemranking/)
29
+
30
+ ### Configuration
31
+
32
+ `RakutenWebService.configuration` allows you to specify your application's key called application\_id and your affiliate id(optional).
33
+
34
+ ```ruby
35
+ RakutenWebService.configuration do |c|
36
+ c.application_id = YOUR_APPLICATION_ID
37
+ c.affiliate_id = YOUR_AFFILIATE_ID
38
+ end
39
+ ```
40
+
41
+ ### Search Ichiba Items
42
+
43
+ ```ruby
44
+ items = RakutenWebService::Ichiba::Item.search(:keyword => 'Ruby') # This returns Enamerable object
45
+ items.first(10).each do |item|
46
+ puts "#{item['itemName']}, #{item.price} yen" # You can refer to values as well as Hash.
47
+ end
48
+ ```
49
+
50
+ ### Genre
51
+
52
+ Genre class provides an interface to traverse sub genres.
53
+
54
+ ```ruby
55
+ root = RakutenWebService::Ichiba::Genre.root # root genre
56
+ # children returns sub genres
57
+ root.children.each do |child|
58
+ puts "[#{child.id}] #{child.name}"
59
+ end
60
+
61
+ # Use genre id to fetch genre object
62
+ RakutenWebService::Ichiba::Genre[100316].name # => "水・ソフトドリンク"
63
+ ```
64
+
65
+
66
+ ### Ichiba Item Ranking
67
+
68
+ ```ruby
69
+ RakutenWebService::Ichiba::Item.ranking(:age => 30, :sex => 0) # returns the TOP 30 items for Male in 30s
70
+ RakutenWebService::Ichiba::Genre[100316].ranking # the TOP 30 items in "水・ソフトドリンク" genre
71
+ ```
72
+
73
+ ## Contributing
74
+
75
+ 1. Fork it
76
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
77
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
78
+ 4. Push to the branch (`git push origin my-new-feature`)
79
+ 5. Create new Pull Request
data/README.md CHANGED
@@ -1,34 +1,41 @@
1
1
  # RakutenWebService
2
2
 
3
- [![Build Status](https://travis-ci.org/satoryu/rakuten_web_service.png?branch=master)](https://travis-ci.org/satoryu/rakuten_web_service) [![Gem Version](https://badge.fury.io/rb/rakuten_web_service.png)](http://badge.fury.io/rb/rakuten_web_service)
3
+ [![Build Status](https://travis-ci.org/rakuten-ws/rws-ruby-sdk.png?branch=master)](https://travis-ci.org/rakuten-ws/rws-ruby-sdk) [![Gem Version](https://badge.fury.io/rb/rakuten_web_service.png)](http://badge.fury.io/rb/rakuten_web_service)
4
4
 
5
- ## Installation
5
+ rakuten\_web\_serviceは、 Rubyから楽天が提供しているAPIに簡単にアクセスできるSDK(Software Development Kit)です。
6
6
 
7
- Add this line to your application's Gemfile:
7
+ English version is [here](http://github.com/rakuten-ws/rws-ruby-sdk/blob/master/README.en.md).
8
+
9
+ ## インストール方法
10
+
11
+ bundlerを利用したアプリケーションの場合、Gemfileに以下の1行を追加します。
8
12
 
9
13
  ```ruby
10
14
  gem 'rakuten_web_service'
11
15
  ```
12
16
 
13
- And then execute:
17
+ そして`bundle`コマンドでインストール。
14
18
 
15
19
  $ bundle
16
20
 
17
- Or install it yourself as:
21
+ もしくは、`gem`コマンドにより
18
22
 
19
23
  $ gem install rakuten_web_service
20
24
 
21
- ## Usage
25
+ とすることでインストールできます。
26
+
27
+ ## 使用方法
22
28
 
23
29
  Now rakuten\_web\_service is supporting the following APIs:
30
+ 現在rakuten\_web\_serviceは下記のAPIをサポートしています。
24
31
 
25
32
  * [Rakuten Ichiba Item Search API](http://webservice.rakuten.co.jp/api/ichibaitemsearch/)
26
33
  * [Rakuten Ichiba Genre Search API](http://webservice.rakuten.co.jp/api/ichibagenresearch/)
27
34
  * [Rakuten Ichiba Ranking API](http://webservice.rakuten.co.jp/api/ichibaitemranking/)
28
35
 
29
- ### Configuration
36
+ ### 設定
30
37
 
31
- `RakutenWebService.configuration` allows you to specify your application's key called application\_id and your affiliate id(optional).
38
+ `RakutenWebService.configuration` メソッドを使い、Application IDとAffiliate ID(オプション)を指定することができます。
32
39
 
33
40
  ```ruby
34
41
  RakutenWebService.configuration do |c|
@@ -37,7 +44,7 @@ Now rakuten\_web\_service is supporting the following APIs:
37
44
  end
38
45
  ```
39
46
 
40
- ### Search Ichiba Items
47
+ ### 市場商品の検索
41
48
 
42
49
  ```ruby
43
50
  items = RakutenWebService::Ichiba::Item.search(:keyword => 'Ruby') # This returns Enamerable object
@@ -46,9 +53,9 @@ Now rakuten\_web\_service is supporting the following APIs:
46
53
  end
47
54
  ```
48
55
 
49
- ### Genre
56
+ ### ジャンル
50
57
 
51
- Genre class provides an interface to traverse sub genres.
58
+ Genreクラスは、`children`や`parent`といったジャンル階層を辿るインターフェースを持っています。
52
59
 
53
60
  ```ruby
54
61
  root = RakutenWebService::Ichiba::Genre.root # root genre
@@ -62,11 +69,11 @@ Genre class provides an interface to traverse sub genres.
62
69
  ```
63
70
 
64
71
 
65
- ### Ichiba Item Ranking
72
+ ### 市場商品ランキング
66
73
 
67
74
  ```ruby
68
- RakutenWebService::Ichiba::Item.ranking(:age => 30, :sex => 0) # returns the TOP 30 items for Male in 30s
69
- RakutenWebService::Ichiba::Genre[100316].ranking # the TOP 30 items in "水・ソフトドリンク" genre
75
+ RakutenWebService::Ichiba::Item.ranking(:age => 30, :sex => 0) # 30代男性 のランキングTOP 30
76
+ RakutenWebService::Ichiba::Genre[100316].ranking # "水・ソフトドリンク" ジャンルのTOP 30
70
77
  ```
71
78
 
72
79
  ## Contributing
@@ -44,6 +44,7 @@ module RakutenWebService
44
44
  conn.request :url_encoded
45
45
  conn.response :json
46
46
  conn.adapter Faraday.default_adapter
47
+ conn.headers['User-Agent'] = "RakutenWebService SDK for Ruby-#{RWS::VERSION}"
47
48
  end
48
49
  end
49
50
 
@@ -1,3 +1,3 @@
1
1
  module RakutenWebService
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'rakuten_web_service/client'
2
+ require 'rakuten_web_service'
3
3
 
4
4
  describe RakutenWebService::Client do
5
5
  let(:endpoint) { 'http://api.example.com/resources' }
@@ -15,7 +15,7 @@ describe RakutenWebService::Client do
15
15
 
16
16
  before do
17
17
  @expected_request = stub_request(:get, endpoint).
18
- with(:query => expected_query).
18
+ with(:query => expected_query, headers: { 'User-Agent' => "RakutenWebService SDK for Ruby-#{RakutenWebService::VERSION}" }).
19
19
  to_return(expected_response)
20
20
 
21
21
  RakutenWebService.configuration do |c|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakuten_web_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tatsuya Sato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-12 00:00:00.000000000 Z
11
+ date: 2013-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -119,6 +119,7 @@ files:
119
119
  - .travis.yml
120
120
  - Gemfile
121
121
  - LICENSE.txt
122
+ - README.en.md
122
123
  - README.md
123
124
  - Rakefile
124
125
  - examples/ichiba_item_search.rb