zunnit 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zunnit (0.3.2)
4
+ zunnit (0.3.3)
5
5
  faraday
6
6
 
7
7
  GEM
data/lib/zunnit/api.rb CHANGED
@@ -29,7 +29,7 @@ module Zunnit
29
29
 
30
30
  private
31
31
  def connection
32
- @connection ||= Faraday.new(:url => Zunnit::URL)
32
+ @connection ||= Faraday.new(:url => Zunnit.url)
33
33
  end
34
34
 
35
35
  def params_for(options={})
@@ -52,7 +52,7 @@ module Zunnit
52
52
 
53
53
  # Make the Request
54
54
  response = connection.send(http_method) do |req|
55
- action_url = "/#{client}#{Zunnit.actions[action]}"
55
+ action_url = Zunnit.actions[action]
56
56
  req.url(action_url)
57
57
  if http_method.to_s =~ /post|put/
58
58
  req.body = params_for options
data/lib/zunnit/setup.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  module Zunnit
2
2
  extend Utils
3
- mattr_accessor :client, :key, :version, :actions
3
+ mattr_accessor :client, :key, :version, :actions, :url
4
4
 
5
5
  # Fixed constants
6
- URL = "http://api.zunnit.com/"
7
6
  ACTIONS = {
8
7
  :related_items => "/related/items",
9
8
  :recommendation_items_for_user => "/recommendation/items/for_user",
@@ -21,6 +20,7 @@ module Zunnit
21
20
  def self.setup
22
21
  self.actions = ACTIONS
23
22
  yield self if block_given?
23
+ self.url ||= "http://#{self.client}.zunnit.com/"
24
24
  self
25
25
  end
26
26
  end
@@ -1,4 +1,4 @@
1
1
  module Zunnit
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
4
4
 
data/spec/zunnit_spec.rb CHANGED
@@ -113,7 +113,7 @@ describe Zunnit do
113
113
  action = options.delete(:action)
114
114
  params = options.delete(:params)
115
115
  response = options.delete(:response)
116
- uri = "#{Zunnit::URL}#{Zunnit.client}#{Zunnit.actions[action]}"
116
+ uri = URI.parse(Zunnit.url).merge(Zunnit.actions[action])
117
117
  uri = uri + params.map {|k,v| "#{k}=#{v}" }.join("&") unless method.to_s =~ /post|put/
118
118
  FakeWeb.register_uri(method, uri, response)
119
119
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: zunnit
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.3
5
+ version: 0.3.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Marcelo Eden
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-28 00:00:00 -03:00
13
+ date: 2011-07-18 00:00:00 -03:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency