vibe 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3a618d2547d2ba134182f8af9d83961e3bec85f
4
- data.tar.gz: e183c7107daa1c0254b547029b59fcb6180a6465
3
+ metadata.gz: 572f86112bab6191738be93ce7f36014f12e764e
4
+ data.tar.gz: a273852fd99843b808095f012054822f4dfd134c
5
5
  SHA512:
6
- metadata.gz: 292c62a9feff52f505a9703721c26d0e5d8ec988e98d150e2e3d576cb90ddc0ff3b5f680adf3052c75d142675c375b7c1d3d20f021b9946469e4d74ed5336985
7
- data.tar.gz: 7cfa1dbd417c5dcd9510433ccf835703b5225635df969627055d9b58fbba67c79ac6db602897fd0e0901baa467b92d603d2ef8c214e6a16af1b920b578307018
6
+ metadata.gz: c7446c1be177bcaa1a8c8b7b7deb721bf44c0205c78e44966cb707846fd1de73e95cf9f9b9bbdd5df8cdb84c8d9e15a8ce570925cd8582a6c4ea71900e5fcc4c
7
+ data.tar.gz: 96293a87ce562ae4cd8e353d33c5cd2ccc99d58636cee83b243df843c0cd115bd0c43ae7003386ccc6a26c8d0af268c35563b01c6e4f6ce481add233a4c6e23b
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vibe (0.0.1)
5
- rest-client (~> 1.7.2)
4
+ vibe (0.0.2)
5
+ rest-client (~> 1.7)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,7 +1,67 @@
1
1
  Vibe API
2
2
  ========
3
+ [![Gem Version](https://badge.fury.io/rb/vibe.png)][gem]
4
+ [![Dependency Status](https://gemnasium.com/amalfra/vibe.png)][gemnasium]
5
+ [![Code Climate](https://codeclimate.com/github/amalfra/vibe.png)][codeclimate]
6
+
7
+ [gem]: http://badge.fury.io/rb/vibe
8
+ [gemnasium]: https://gemnasium.com/amalfra/vibe
9
+ [codeclimate]: https://codeclimate.com/github/amalfra/vibe
10
+
11
+ [RDocs](http://rubydoc.info/github/amalfra/vibe/master/frames)
12
+
13
+ A Ruby wrapper for the Vibe REST API.
14
+
15
+ > Get API key here : https://vibeapp.co/dev/
16
+
17
+ ## Installation
18
+
19
+ Install the gem by running
20
+
21
+ ```ruby
22
+ gem install vibe
23
+ ```
24
+
25
+ or put it in your Gemfile and run `bundle install`
26
+
27
+ ```ruby
28
+ gem "vibe"
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ Create a new instance
34
+
35
+ ```ruby
36
+ vibe = Vibe.new
37
+ ```
38
+
39
+ At this stage you can also supply the configuration parameter `:api_key` which is used throughout the API. These can be passed directly as hash options:
40
+
41
+ ```ruby
42
+ vibe = Vibe.new api_key: 'api_key'
43
+ ```
44
+
45
+ Alternatively, you can configure the Vibe settings by passing a block:
46
+
47
+ ```ruby
48
+ vibe = Vibe.new do |config|
49
+ config.api_key = 'api_key'
50
+ end
51
+ ```
52
+
53
+ ## API
54
+
55
+ The currently available api methods are :
56
+ * get_data(email) - Get Data from an Email
57
+ * stats - Get Stats for API Key. If API key parameter is not
58
+ passed then the one in config will be used
59
+
60
+
61
+ ## Development
62
+
63
+ Questions or problems? Please post them on the [issue tracker](https://github.com/amalfra/vibe/issues). You can contribute changes by forking the project and submitting a pull request. You can ensure the tests are passing by running `rake test`.
3
64
 
4
- A Ruby wrapper for the Vibe REST API.
5
65
 
6
66
  UNDER MIT LICENSE
7
67
  =================
@@ -24,8 +24,23 @@ module Vibe
24
24
 
25
25
  # Get Data from an Email
26
26
  def get_data(email)
27
+ if !email.is_a? String
28
+ error = InvalidOptions.new(['Email(String)'], ['Email(String)'])
29
+ raise error
30
+ end
31
+
27
32
  get_request '/initial_data', :email => email
28
33
  end
29
34
 
35
+ # Get Stats for API Key
36
+ def stats(api_key = nil)
37
+ if api_key && (!api_key.is_a? String)
38
+ error = InvalidOptions.new(['API key(String)'], ['API key(String)'])
39
+ raise error
40
+ end
41
+
42
+ get_request '/api_stats', :api_key => api_key
43
+ end
44
+
30
45
  end # Client
31
46
  end
@@ -5,7 +5,7 @@ module Vibe
5
5
  def initialize(invalid, valid)
6
6
  super(
7
7
  generate_message(
8
- :problem => "Invalid option #{invalid.keys.join(', ')} provided for this request.",
8
+ :problem => "Invalid option #{invalid.join(', ')} provided for this request.",
9
9
  :summary => "Vibe gem checks the request parameters passed to ensure that Vibe api is not hit unnecessairly and to fail fast.",
10
10
  :resolution => "Valid options are: #{valid.join(', ')}, make sure these are the ones you are using"
11
11
  )
@@ -23,7 +23,13 @@ module Vibe
23
23
 
24
24
  puts "EXECUTED: #{method} - #{path} with #{params}" if ENV['DEBUG']
25
25
 
26
- params.merge!({:api_key => api_key, :user_agent => user_agent})
26
+ if params[:api_key]
27
+ new_api_key = params[:api_key]
28
+ params = params.tap { |hs| hs.delete(:api_key) }
29
+ params.merge!({:api_key => new_api_key, :user_agent => user_agent})
30
+ else
31
+ params.merge!({:api_key => api_key, :user_agent => user_agent})
32
+ end
27
33
 
28
34
  begin
29
35
  puts params if ENV['DEBUG']
@@ -1,3 +1,3 @@
1
1
  module Vibe
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vibe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amal Francis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-18 00:00:00.000000000 Z
11
+ date: 2014-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client