From 18a5b9dc797630502744c227b4e8680a46c5ae03 Mon Sep 17 00:00:00 2001 From: Stefano Fontanelli Date: Thu, 6 Nov 2014 08:59:44 -0800 Subject: [PATCH] Fix missing dependency in gemspec. Add :server option in Client class: you can specify US or CH endpoint during init --- facepp.gemspec | 3 ++- lib/facepp/client.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/facepp.gemspec b/facepp.gemspec index 7d1a621..9494053 100644 --- a/facepp.gemspec +++ b/facepp.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'facepp' - s.version = '0.0' + s.version = '0.2' s.platform = Gem::Platform::RUBY s.summary = 'A Ruby interface to the FacePlusPlus API.' s.description = 'FacePlusPlus API Reference: http://faceplusplus.com/en/docs/getting_started' @@ -13,5 +13,6 @@ Gem::Specification.new do |s| s.files += Dir.glob 'spec/**/*' s.require_paths = ['lib'] + s.add_dependency 'mime-types' s.add_development_dependency 'rspec' end diff --git a/lib/facepp/client.rb b/lib/facepp/client.rb index da15dca..381d56d 100644 --- a/lib/facepp/client.rb +++ b/lib/facepp/client.rb @@ -156,7 +156,8 @@ def initialize(key, secret, options={}) req.body = form.inspect req['Content-Length'] = req.body.size end - res = Net::HTTP.new('api.faceplusplus.com').request(req).body + server = options.fetch :server, 'api.faceplusplus.com' + res = Net::HTTP.new(server).request(req).body decode ? JSON.load(res) : res end end