contactually 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: 49271ce9cdbe5ab97a80148d14406aa7ca00c2b8
4
- data.tar.gz: 7396b1e527d6611147724e6c92de898ced9d650b
3
+ metadata.gz: 8707975aafa15dbd19fbda663a7562c8a633f94d
4
+ data.tar.gz: c1de67c3c986cc9f5136c057e243b874c1b355b4
5
5
  SHA512:
6
- metadata.gz: 6c38457e05668eb5d0f190988919ddda5395e75102b01acb3884868492d7724fe0ef37b60038888054149e6890eafc2fbc852db2f85ce42332ccd472d242f527
7
- data.tar.gz: c15ffc99cc297d42e025a7b6327a6efe1407e2f5c6dc20c21dfcc64e7dd8a564742efd0c6b9305b1f2c3ba4ee501bad3adee85224f81fb33cce3ed6f68150cf3
6
+ metadata.gz: 943faedb5c5ce0b84c730ada77ba7e6d27a5d80e97ebd55d76948c51dea69b1c09851b28e859532d6e930e9254e9a8256340501fd5b3f9e45010c06647cf19e2
7
+ data.tar.gz: 5f29c612e1c91bc08ac32b986cce94c543015d77e11c59e12c77512bdf3e2d6a3d6fd4f8a627113961dbf8fa8474ebe2feb9a962aa66a438fa52bdabbb1248db
data/contactually.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
8
8
  gem.version = Contactually::VERSION
9
9
  gem.authors = ["Guille Carlos"]
10
10
  gem.email = ["guille@bitpop.in"]
11
- gem.description = %q{Gem for Contactually application}
12
- gem.summary = %q{Gem for Contactually application}
11
+ gem.description = %q{Write a gem description}
12
+ gem.summary = %q{Write a gem summary}
13
13
  gem.homepage = ""
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
@@ -1,3 +1,3 @@
1
1
  module Contactually
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/contactually.rb CHANGED
@@ -3,8 +3,19 @@ require "json"
3
3
 
4
4
  module Contactually
5
5
  class API
6
- def initialize(api_key)
6
+
7
+ def initialize(api_key, headers = {} )
7
8
  @api_key = api_key
9
+
10
+ # The Contactually API recommends passing in a User-Agent header unique to
11
+ # the client application as a best practice
12
+ # (see: http://developers.contactually.com/docs/):
13
+ #
14
+ # Contactually::API.new(
15
+ # { "YOUR_CONTACTUALLY_API_KEY", :user_agent => "YOUR_APP_NAME" }
16
+ # )
17
+ #
18
+ @headers = headers
8
19
  end
9
20
 
10
21
  def call(method, args)
@@ -27,6 +38,9 @@ module Contactually
27
38
  http_method, contactually_method = get_methods(method)
28
39
  uri = build_uri(contactually_method, args)
29
40
  response = Curl.send(http_method.to_sym, uri, JSON.dump(param_fields(args))) do |curl|
41
+ @headers.each do |header_name, header_value|
42
+ curl.headers[header_name.to_s.titleize.gsub(" ", "-")] = header_value
43
+ end
30
44
  curl.headers['Accept'] = 'application/json'
31
45
  curl.headers['Content-Type'] = 'application/json'
32
46
  end
metadata CHANGED
@@ -1,23 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contactually
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
  - Guille Carlos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-03 00:00:00.000000000 Z
11
+ date: 2015-02-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Gem for Contactually application
13
+ description: Write a gem description
14
14
  email:
15
15
  - guille@bitpop.in
16
16
  executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - .gitignore
20
+ - ".gitignore"
21
21
  - Gemfile
22
22
  - LICENSE.txt
23
23
  - README.md
@@ -36,20 +36,20 @@ require_paths:
36
36
  - lib
37
37
  required_ruby_version: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  required_rubygems_version: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  requirements: []
48
48
  rubyforge_project:
49
- rubygems_version: 2.0.3
49
+ rubygems_version: 2.2.2
50
50
  signing_key:
51
51
  specification_version: 4
52
- summary: Gem for Contactually application
52
+ summary: Write a gem summary
53
53
  test_files:
54
54
  - test/contactually_test.rb
55
55
  - test/test_helper.rb