et 0.5.4 → 0.5.5

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: 51b9eb9ec2a15351bbd78345f80ecf9bb05875cd
4
- data.tar.gz: 680ae5fe564094a0cc5b5f31835c7e0623d99ac1
3
+ metadata.gz: 878c7e0d9b0502f6a7d4e1b74eac6f3b74fd37d8
4
+ data.tar.gz: 9de9207f81b70fc88e79b3789535c65852fa7946
5
5
  SHA512:
6
- metadata.gz: caaf8769682a2810cd1e8f500e97be611eb48fa0f0c8e848c3dcf5af3a3327e61528203290ae67a5dc393568ce7803e5c1e52a9fbb1ca7fc95f388f87018257a
7
- data.tar.gz: 250fc3b6d3cf7b439353dd1dba062c7671d7df0cac3f449db37ae67a3cb3aba634765130b1372d1cba5a6e537f5647afd06978f77d7f8e79415181600ec9c2df
6
+ metadata.gz: 855269fa8bf46ca3e373da7364b35872a73356cd973098eaceabb535be52f7381cfc11347403d45f403a5887b6f41f912536cc442d70fcb2a4e5502e9c617cb3
7
+ data.tar.gz: af29f4894062f35784fceb19e0316f7134208b53c3048591090a48ceff3eabf715d63b7f816cb1c4c7129af73335e5debf944b59cae35f92d0e221098e2e159f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- et (0.5.3)
4
+ et (0.5.5)
5
5
  gli (= 2.11.0)
6
6
  multipart-post (~> 2.0)
7
7
  rspec (~> 3.0)
@@ -27,8 +27,16 @@ module ET
27
27
  end
28
28
 
29
29
  def get_lesson(slug)
30
- response = Net::HTTP.get(lesson_url(slug))
31
- body = JSON.parse(response, symbolize_names: true)
30
+ request = Net::HTTP::Get.new(lesson_url(slug))
31
+ request["Authorization"] = auth_header
32
+
33
+ response = nil
34
+ Net::HTTP.start(lessons_url.host, lessons_url.port,
35
+ use_ssl: lessons_url.scheme == "https") do |http|
36
+
37
+ response = http.request(request)
38
+ end
39
+ body = JSON.parse(response.body, symbolize_names: true)
32
40
  body[:lesson]
33
41
  end
34
42
 
@@ -69,7 +77,7 @@ module ET
69
77
  private
70
78
 
71
79
  def lesson_url(slug)
72
- URI.join(host, "lessons/#{slug}.json")
80
+ URI.join(host, "lessons/#{slug}.json?submittable=1")
73
81
  end
74
82
 
75
83
  def lessons_url
@@ -1,3 +1,3 @@
1
1
  module ET
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.5"
3
3
  end
@@ -35,9 +35,20 @@ describe ET::API do
35
35
  end
36
36
 
37
37
  it "queries for a single lesson" do
38
- expect(Net::HTTP).to receive(:get).
39
- with(URI("http://localhost:3000/lessons/rock-paper-scissors.json")).
40
- and_return(lesson_response)
38
+ request = {}
39
+ response = double
40
+ http = double
41
+ lesson_uri = URI("http://localhost:3000/lessons/rock-paper-scissors.json?submittable=1")
42
+ expect(Net::HTTP::Get).to receive(:new).
43
+ with(lesson_uri).
44
+ and_return(request)
45
+ expect(Net::HTTP).to receive(:start).with(
46
+ lesson_uri.host,
47
+ lesson_uri.port,
48
+ use_ssl: lesson_uri.scheme == "https").
49
+ and_yield(http)
50
+ expect(http).to receive(:request).and_return(response)
51
+ expect(response).to receive(:body).and_return(lesson_response)
41
52
 
42
53
  result = api.get_lesson("rock-paper-scissors")
43
54
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: et
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Sheehan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-08 00:00:00.000000000 Z
11
+ date: 2015-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake