rakumarket 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ script: bundle exec rspec spec
data/Gemfile.lock CHANGED
@@ -1,15 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rakumarket (0.0.1)
5
- activesupport (~> 2.3.2)
4
+ rakumarket (0.0.3)
6
5
  hashie (>= 0.1.3)
7
6
  httparty (>= 0.1.0)
8
7
 
9
8
  GEM
10
9
  remote: http://rubygems.org/
11
10
  specs:
12
- activesupport (2.3.14)
13
11
  addressable (2.2.8)
14
12
  crack (0.3.1)
15
13
  diff-lcs (1.1.3)
data/README.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- = Rakumarket
1
+ = Rakumarket {<img src="https://secure.travis-ci.org/bonsaiben/rakumarket.png">}[http://travis-ci.org/bonsaiben/rakumarket] {<img src="https://gemnasium.com/bonsaiben/rakumarket.png">}[https://gemnasium.com/bonsaiben/rakumarket]
2
2
 
3
3
  A reader-friendly Ruby abstraction of the Rakuten Market API.
4
4
 
@@ -79,7 +79,7 @@ private
79
79
  def self.handle_response(response)
80
80
  case response["Header"]["Status"]
81
81
  when "Success"; response
82
- else; raise RakumarketError.new(Hashie::Mash.new(response["Header"].slice("Status","StatusMsg")).rubyify_keys!)
82
+ else; raise RakumarketError.new(Hashie::Mash.new({:status => response["Header"]["Status"], :status_msg => response["Header"]["StatusMsg"]}))
83
83
  end
84
84
 
85
85
  Hashie::Mash.new(response)
@@ -1,3 +1,3 @@
1
1
  module Rakumarket
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/rakumarket.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'httparty'
2
2
  require 'hashie'
3
- require 'active_support'
4
3
 
5
4
  directory = File.expand_path(File.dirname(__FILE__))
6
5
 
@@ -36,16 +35,19 @@ module Rakumarket
36
35
  end
37
36
  end
38
37
 
39
- class Hashie::Mash
40
- # Converts all of the keys to strings, optionally formatting key name
41
- def rubyify_keys!
42
- keys.each{|k|
43
- v = delete(k)
44
- regular_writer(k.to_s.underscore, v)
45
- v.rubyify_keys! if v.is_a?(Hash)
46
- v.each{|p| p.rubyify_keys! if p.is_a?(Hash)} if v.is_a?(Array)
47
- }
48
- self
38
+ class String
39
+ def blank?
40
+ self !~ /[^[:space:]]/
41
+ end
42
+ def present?
43
+ !blank?
44
+ end
45
+ end
46
+
47
+ class Hash
48
+ def slice(*keys)
49
+ keys.map! { |key| convert_key(key) } if respond_to?(:convert_key, true)
50
+ keys.inject(self.class.new) { |hash, k| hash[k] = self[k] if has_key?(k); hash }
49
51
  end
50
52
  end
51
53
 
@@ -60,7 +62,6 @@ module Hashie::HashExtensions
60
62
  end
61
63
  self
62
64
  end
63
-
64
65
  end
65
66
 
66
67
  require File.join(directory, 'rakumarket', 'client')
data/rakumarket.gemspec CHANGED
@@ -15,7 +15,6 @@ Gem::Specification.new do |s|
15
15
 
16
16
  s.add_dependency "hashie", ">= 0.1.3"
17
17
  s.add_dependency "httparty", ">= 0.1.0"
18
- s.add_dependency 'activesupport', '~> 2.3.2'
19
18
  s.add_development_dependency "bundler", ">= 1.0.0"
20
19
  s.add_development_dependency "rspec", "~> 2.6"
21
20
  s.add_development_dependency "webmock"
@@ -22,7 +22,7 @@ describe Rakumarket do
22
22
  end
23
23
 
24
24
  it "returns a list of items" do
25
- @items.should be_present
25
+ @items.should_not be_empty
26
26
  end
27
27
 
28
28
  it "returns items with attributes" do
@@ -30,7 +30,7 @@ describe Rakumarket do
30
30
  end
31
31
 
32
32
  it "returns items with rubyish attributes" do
33
- @items.first.review_count.should be_present
33
+ @items.first.review_count.should_not be_nil
34
34
  end
35
35
 
36
36
  it "returns items with nested attributes" do
@@ -51,32 +51,32 @@ describe Rakumarket do
51
51
  context "given a search with parameters" do
52
52
  it "accepts rubyish parameter names" do
53
53
  items = Rakumarket.item_search("roomba", :must_have_image => true).items
54
- items.should be_present
54
+ items.should_not be_empty
55
55
  end
56
56
 
57
57
  it "accepts nested parameters" do
58
58
  items = Rakumarket.item_search("roomba", :price => {:maximum => 30000} ).items
59
- items.should be_present
59
+ items.should_not be_empty
60
60
  end
61
61
 
62
62
  it "accepts SQL-style order specification" do
63
63
  items = Rakumarket.item_search("roomba", :order => 'updated_at asc' ).items
64
- items.should be_present
64
+ items.should_not be_empty
65
65
  end
66
66
 
67
67
  it "accepts case insensitive SQL-style order specification" do
68
68
  items = Rakumarket.item_search("roomba", :order => 'updated_at ASC' ).items
69
- items.should be_present
69
+ items.should_not be_empty
70
70
  end
71
71
 
72
72
  it "accepts plain country names for international shipping" do
73
73
  items = Rakumarket.item_search("roomba", :shipping => {:must_ship_international => true, :country => 'usa'} ).items
74
- items.should be_present
74
+ items.should_not be_empty
75
75
  end
76
76
 
77
77
  it "accepts plain prefecture names for next day shipping" do
78
78
  items = Rakumarket.item_search("roomba", :shipping => {:must_ship_next_day => true, :next_day_area => 'kanagawa'} ).items
79
- items.should be_present
79
+ items.should_not be_empty
80
80
  end
81
81
 
82
82
  it "returns plain country names for international shipping" do
@@ -96,7 +96,7 @@ describe Rakumarket do
96
96
  end
97
97
 
98
98
  it "returns genre information" do
99
- @genre_info.should be_present
99
+ @genre_info.should_not be_empty
100
100
  end
101
101
 
102
102
  it "returns an array of children" do
@@ -174,7 +174,7 @@ describe Rakumarket do
174
174
  context "given a search with parameters" do
175
175
  it "accepts rubyish parameter names" do
176
176
  response = Rakumarket.genre_search(0, :return_immediate_parent => false)
177
- response.children.should be_present
177
+ response.children.should_not be_empty
178
178
  end
179
179
  it "returns the immediate parent" do
180
180
  response = Rakumarket.genre_search(204491, :return_immediate_parent => true)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakumarket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,22 +43,6 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: 0.1.0
46
- - !ruby/object:Gem::Dependency
47
- name: activesupport
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ~>
52
- - !ruby/object:Gem::Version
53
- version: 2.3.2
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: 2.3.2
62
46
  - !ruby/object:Gem::Dependency
63
47
  name: bundler
64
48
  requirement: !ruby/object:Gem::Requirement
@@ -130,6 +114,7 @@ extensions: []
130
114
  extra_rdoc_files: []
131
115
  files:
132
116
  - .gitignore
117
+ - .travis.yml
133
118
  - Gemfile
134
119
  - Gemfile.lock
135
120
  - README.rdoc