delighted 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67496ba51343572dac384ad4d024742cf38e6d7e
4
- data.tar.gz: bcbb3ceb1f99bc4c09f9549cd1b08372afa88927
3
+ metadata.gz: 37805cf1e7b0836ab7a522aa3e886cc2c82cb0f4
4
+ data.tar.gz: bb1dc6a443bc57aa8784f91dfc75d95d07326b7a
5
5
  SHA512:
6
- metadata.gz: 4bb6fed4f7901eefbf7f03c480afa23f0be7af6664c4031097d9df375724efa3ae786be671f39568805b003748c7bf9297a3438c30fc7172ab17c0c2ea19e8ac
7
- data.tar.gz: 0fea8e4db930ba95124c4269a54917ab5e37dcc95437e7bee04eba714b3eb212d9d5882fb6091032633b8dd38580c0eb92b39cf1aeee1af3f021ab8a840d1add
6
+ metadata.gz: 3e5aecf2f1cbb700dc8acb92232e754384809681817450e73a69a6ea2eac219957d112e350e1e0ac6305d0f04ad79fccce921688d1e94d75f4eeb74d03ad48a2
7
+ data.tar.gz: 265dfdeed0e7d351bf21f44dde3d6416ca725b4917eb43ed1334a10466b7af808c0ab5522318c6eaf755422d3e8d42a7e2c375e39f65d504c7910fd0ad4fd909
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.3.1 (2015-09-14)
2
+
3
+ Features:
4
+
5
+ - Fix authentication header on 1.8.7
6
+
1
7
  ## 1.3.0 (2014-06-03)
2
8
 
3
9
  Features:
@@ -60,7 +60,7 @@ module Delighted
60
60
 
61
61
  def default_headers
62
62
  @default_headers ||= {
63
- 'Authorization' => "Basic #{["#{@api_key}:"].pack('m0')}",
63
+ 'Authorization' => "Basic #{["#{@api_key}:"].pack('m').chomp}",
64
64
  'User-Agent' => "Delighted RubyGem #{Delighted::VERSION}"
65
65
  }.freeze
66
66
  end
@@ -1,3 +1,3 @@
1
1
  module Delighted
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
@@ -10,7 +10,7 @@ end
10
10
  class Delighted::MetricsTest < Delighted::TestCase
11
11
  def test_retrieving_metrics
12
12
  uri = URI.parse("https://api.delightedapp.com/v1/metrics")
13
- headers = { 'Authorization' => "Basic #{["123abc:"].pack('m0')}", "Accept" => "application/json", 'User-Agent' => "Delighted RubyGem #{Delighted::VERSION}" }
13
+ headers = { 'Authorization' => @auth_header, "Accept" => "application/json", 'User-Agent' => "Delighted RubyGem #{Delighted::VERSION}" }
14
14
  response = Delighted::HTTPResponse.new(200, {}, Delighted::JSON.dump({ :nps => 10 }))
15
15
  mock_http_adapter.expects(:request).with(:get, uri, headers).once.returns(response)
16
16
 
@@ -25,7 +25,7 @@ end
25
25
  class Delighted::PeopleTest < Delighted::TestCase
26
26
  def test_creating_or_updating_a_person
27
27
  uri = URI.parse("https://api.delightedapp.com/v1/people")
28
- headers = { 'Authorization' => "Basic #{["123abc:"].pack('m0')}", "Accept" => "application/json", 'Content-Type' => 'application/json', 'User-Agent' => "Delighted RubyGem #{Delighted::VERSION}" }
28
+ headers = { 'Authorization' => @auth_header, "Accept" => "application/json", 'Content-Type' => 'application/json', 'User-Agent' => "Delighted RubyGem #{Delighted::VERSION}" }
29
29
  data = Delighted::JSON.dump({ :email => 'foo@bar.com' })
30
30
  response = Delighted::HTTPResponse.new(200, {}, Delighted::JSON.dump({ :id => '123', :email => 'foo@bar.com' }))
31
31
  mock_http_adapter.expects(:request).with(:post, uri, headers, data).once.returns(response)
@@ -41,7 +41,7 @@ class Delighted::PeopleTest < Delighted::TestCase
41
41
  person_email = 'person@example.com'
42
42
  uri = URI.parse('https://api.delightedapp.com/v1/unsubscribes')
43
43
  headers = {
44
- 'Authorization' => "Basic #{["123abc:"].pack('m0')}",
44
+ 'Authorization' => @auth_header,
45
45
  'Accept' => 'application/json',
46
46
  'Content-Type' => 'application/json',
47
47
  'User-Agent' => "Delighted RubyGem #{Delighted::VERSION}"
@@ -57,7 +57,7 @@ class Delighted::PeopleTest < Delighted::TestCase
57
57
 
58
58
  def test_deleting_pending_survey_requests_for_a_person
59
59
  uri = URI.parse("https://api.delightedapp.com/v1/people/foo%40bar.com/survey_requests/pending")
60
- headers = { 'Authorization' => "Basic #{["123abc:"].pack('m0')}", "Accept" => "application/json", 'Content-Type' => 'application/json', 'User-Agent' => "Delighted RubyGem #{Delighted::VERSION}" }
60
+ headers = { 'Authorization' => @auth_header, "Accept" => "application/json", 'Content-Type' => 'application/json', 'User-Agent' => "Delighted RubyGem #{Delighted::VERSION}" }
61
61
  response = Delighted::HTTPResponse.new(200, {}, Delighted::JSON.dump({ :ok => true }))
62
62
  mock_http_adapter.expects(:request).with(:delete, uri, headers, nil).once.returns(response)
63
63
 
@@ -70,7 +70,7 @@ end
70
70
  class Delighted::SurveyResponseTest < Delighted::TestCase
71
71
  def test_creating_a_survey_response
72
72
  uri = URI.parse("https://api.delightedapp.com/v1/survey_responses")
73
- headers = { 'Authorization' => "Basic #{["123abc:"].pack('m0')}", "Accept" => "application/json", 'Content-Type' => 'application/json', 'User-Agent' => "Delighted RubyGem #{Delighted::VERSION}" }
73
+ headers = { 'Authorization' => @auth_header, "Accept" => "application/json", 'Content-Type' => 'application/json', 'User-Agent' => "Delighted RubyGem #{Delighted::VERSION}" }
74
74
  data = Delighted::JSON.dump({ :person => '123', :score => 10 })
75
75
  response = Delighted::HTTPResponse.new(200, {}, Delighted::JSON.dump({ :id => '456', :person => '123', :score => 10 }))
76
76
  mock_http_adapter.expects(:request).with(:post, uri, headers, data).once.returns(response)
@@ -85,7 +85,7 @@ class Delighted::SurveyResponseTest < Delighted::TestCase
85
85
 
86
86
  def test_listing_all_survey_responses
87
87
  uri = URI.parse("https://api.delightedapp.com/v1/survey_responses?order=desc")
88
- headers = { 'Authorization' => "Basic #{["123abc:"].pack('m0')}", "Accept" => "application/json", 'User-Agent' => "Delighted RubyGem #{Delighted::VERSION}" }
88
+ headers = { 'Authorization' => @auth_header, "Accept" => "application/json", 'User-Agent' => "Delighted RubyGem #{Delighted::VERSION}" }
89
89
  response = Delighted::HTTPResponse.new(200, {}, Delighted::JSON.dump([{ :id => '123', :comment => 'One' }, { :id => '456', :comment => 'Two' }]))
90
90
  mock_http_adapter.expects(:request).with(:get, uri, headers).once.returns(response)
91
91
 
@@ -103,7 +103,7 @@ class Delighted::SurveyResponseTest < Delighted::TestCase
103
103
 
104
104
  def test_listing_all_survey_responses_expand_person
105
105
  uri = URI.parse("https://api.delightedapp.com/v1/survey_responses?expand%5B%5D=person")
106
- headers = { 'Authorization' => "Basic #{["123abc:"].pack('m0')}", "Accept" => "application/json", 'User-Agent' => "Delighted RubyGem #{Delighted::VERSION}" }
106
+ headers = { 'Authorization' => @auth_header, "Accept" => "application/json", 'User-Agent' => "Delighted RubyGem #{Delighted::VERSION}" }
107
107
  response = Delighted::HTTPResponse.new(200, {}, Delighted::JSON.dump([{ :id => '123', :comment => 'One', :person => { :id => '123', :email => 'foo@bar.com' } }, { :id => '456', :comment => 'Two', :person => { :id => '123', :email => 'foo@bar.com' } }]))
108
108
  mock_http_adapter.expects(:request).with(:get, uri, headers).once.returns(response)
109
109
 
data/test/test_helper.rb CHANGED
@@ -8,6 +8,7 @@ class Delighted::TestCase < Minitest::Test
8
8
  def setup
9
9
  super
10
10
  Delighted.shared_client = Delighted::Client.new(:api_key => '123abc', :http_adapter => mock_http_adapter)
11
+ @auth_header = "Basic #{["123abc:"].pack('m').chomp}"
11
12
  end
12
13
 
13
14
  def mock_http_adapter
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delighted
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Dodwell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-03 00:00:00.000000000 Z
11
+ date: 2015-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.2.2
125
+ rubygems_version: 2.0.14
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: Delighted is the easiest and most beautiful way to measure customer happiness.
@@ -130,4 +130,3 @@ summary: Delighted is the easiest and most beautiful way to measure customer hap
130
130
  test_files:
131
131
  - test/delighted_test.rb
132
132
  - test/test_helper.rb
133
- has_rdoc: