invisiblehand 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -54,11 +54,9 @@ api.products({
54
54
  #=> A massive hash that you can find details of at:
55
55
  # https://developer.getinvisiblehand.com/documentation
56
56
 
57
- # Search for products in a different region with a load of other relevant
58
- # options
57
+ # Search for products with sorting and ordering and a specific size.
59
58
  api.products({
60
59
  :query => "galaxy", # Search term
61
- :region => "ca", # Which region to query
62
60
  :sort => "popularity", # What to order results by
63
61
  :order => "desc", # Direction to order results by
64
62
  :size => "100" # Number of results to return
@@ -37,9 +37,10 @@ module InvisibleHand
37
37
  # The @config[:development] flag exists to bypass the app_id and app_key
38
38
  # check in this gem (not on the server) for internal testing reasons.
39
39
  if valid_config?
40
- raise Error::InvalidConfig.new
41
- "Your config does not contain an app_id and app_key. " +
42
- "Both are required to make API calls."
40
+ message = "Your config does not contain an app_id and app_key. " +
41
+ "Both are required to make API calls."
42
+
43
+ raise Error::InvalidConfig.new message, @config
43
44
  end
44
45
 
45
46
  @config[:protocol] = @config[:use_ssl] == false ? "http://" : "https://"
@@ -90,7 +91,7 @@ module InvisibleHand
90
91
  logger.debug "API call took #{elapsed.round(3)} seconds."
91
92
  logger.debug "API json response: #{json.inspect}"
92
93
 
93
- raise Error::APIError.new(json["error"]) if json["error"]
94
+ raise Error::APIError.new(json["error"], url) if json["error"]
94
95
 
95
96
  json
96
97
  end
@@ -1,6 +1,23 @@
1
1
  module InvisibleHand
2
2
  module Error
3
- class InvalidConfig < StandardError; end;
4
- class APIError < StandardError; end;
3
+ class InvalidConfig < StandardError
4
+ attr_accessor :config
5
+
6
+ def initialize message, config
7
+ super message
8
+
9
+ @config = config
10
+ end
11
+ end
12
+
13
+ class APIError < StandardError
14
+ attr_accessor :url
15
+
16
+ def initialize message, url
17
+ super message
18
+
19
+ @url = url
20
+ end
21
+ end
5
22
  end
6
23
  end
@@ -1,5 +1,5 @@
1
1
  module InvisibleHand
2
2
  unless const_defined? :VERSION
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: invisiblehand
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-19 00:00:00.000000000 Z
12
+ date: 2013-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  segments:
112
112
  - 0
113
- hash: 3768390383107493245
113
+ hash: 1889337055537833862
114
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  none: false
116
116
  requirements:
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  segments:
121
121
  - 0
122
- hash: 3768390383107493245
122
+ hash: 1889337055537833862
123
123
  requirements: []
124
124
  rubyforge_project:
125
125
  rubygems_version: 1.8.24