MrMurano 1.12.3 → 1.12.4

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: 41956ca76f07622d856878f711a9f90917241809
4
- data.tar.gz: c701e11c917657f5b434bc2a577159091f832548
3
+ metadata.gz: 829187e5f5376300757d2664aeab678bf06a23d8
4
+ data.tar.gz: ed7366f9e541c631a9c4296e2864445d083466ee
5
5
  SHA512:
6
- metadata.gz: ac3a922fe7a8c2400ed2c957b674a142ee270f9f4c9e8998f22224eb0b447f14407b5d034858547ee8ee32c0a172404f44ee0f5c1ca2508ab42337c8d58b3bdc
7
- data.tar.gz: 3a6bddd58e6e7c3224e32096f6baad95125560d6918f7ccbd061808e177690effd1843fba29841b42b7e48b681ffa615a7745279c817fbd3b62f8ba29c069f85
6
+ metadata.gz: 260e03ee94c54d047aada8aaeccf7743f2c4dd14e8a73a03acf4b280b0d186292ec100c14084d7720c423e252b36230a01974dbf7e23d8e288daa22e3da92d23
7
+ data.tar.gz: a2f1127a5b45e0d6583ab38a40b06154618c1abf823d662194d84bd1b8388396c485d5623d3e9372575c238105d46e20b4beda4c00f066e26f26da2aa52f228e
data/Rakefile CHANGED
@@ -42,6 +42,7 @@ namespace :git do
42
42
  task :all => [:origin, :upstream]
43
43
  end
44
44
 
45
+ desc "Build, install locally, and push gem"
45
46
  task :gemit do
46
47
  mrt=Bundler::GemHelper.gemspec.version
47
48
  sh %{git checkout v#{mrt}}
@@ -18,8 +18,12 @@ module MrMurano
18
18
 
19
19
  def fetch(id=nil, &block)
20
20
  ret = get()
21
- data = JSON.parse(ret[:cors], @json_opts)
22
- # XXX cors is a JSON encoded string. That seems weird. keep an eye on this.
21
+ if ret.kind_of?(Hash) and ret.has_key?(:cors) then
22
+ # XXX cors is a JSON encoded string. That seems weird. keep an eye on this.
23
+ data = JSON.parse(ret[:cors], @json_opts)
24
+ else
25
+ data = ret
26
+ end
23
27
  if block_given? then
24
28
  yield Hash.transform_keys_to_strings(data).to_yaml
25
29
  else
@@ -1,4 +1,4 @@
1
1
  module MrMurano
2
- VERSION = '1.12.3'.freeze
2
+ VERSION = '1.12.4'.freeze
3
3
  end
4
4
 
@@ -21,23 +21,8 @@ RSpec.describe MrMurano::Cors do
21
21
  expect(uri.to_s).to eq("https://bizapi.hosted.exosite.io/api:1/solution/XYZ/cors/")
22
22
  end
23
23
 
24
- it "lists" do
25
- cors = {:origin=>true,
26
- :methods=>["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],
27
- :headers=>["Content-Type","Cookie","Authorization"],
28
- :credentials=>true}
29
- body = {:cors=>cors.to_json}
30
- stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/cors").
31
- with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
32
- 'Content-Type'=>'application/json'}).
33
- to_return(body: body.to_json)
34
-
35
- ret = @srv.list()
36
- expect(ret).to eq([cors.merge({:id=>'cors'})])
37
- end
38
-
39
- context "fetches" do
40
- it "as a hash" do
24
+ context "when server gives string" do
25
+ it "lists" do
41
26
  cors = {:origin=>true,
42
27
  :methods=>["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],
43
28
  :headers=>["Content-Type","Cookie","Authorization"],
@@ -48,28 +33,99 @@ RSpec.describe MrMurano::Cors do
48
33
  'Content-Type'=>'application/json'}).
49
34
  to_return(body: body.to_json)
50
35
 
51
- ret = @srv.fetch()
52
- expect(ret).to eq(cors)
36
+ ret = @srv.list()
37
+ expect(ret).to eq([cors.merge({:id=>'cors'})])
38
+ end
39
+
40
+ context "fetches" do
41
+ it "as a hash" do
42
+ cors = {:origin=>true,
43
+ :methods=>["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],
44
+ :headers=>["Content-Type","Cookie","Authorization"],
45
+ :credentials=>true}
46
+ body = {:cors=>cors.to_json}
47
+ stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/cors").
48
+ with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
49
+ 'Content-Type'=>'application/json'}).
50
+ to_return(body: body.to_json)
51
+
52
+ ret = @srv.fetch()
53
+ expect(ret).to eq(cors)
54
+ end
55
+ it "as a block" do
56
+ cors = {:origin=>true,
57
+ :methods=>["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],
58
+ :headers=>["Content-Type","Cookie","Authorization"],
59
+ :credentials=>true}
60
+ body = {:cors=>cors.to_json}
61
+ stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/cors").
62
+ with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
63
+ 'Content-Type'=>'application/json'}).
64
+ to_return(body: body.to_json)
65
+
66
+ ret = ''
67
+ loops = 0
68
+ @srv.fetch() do |chunk|
69
+ loops += 1
70
+ ret << chunk
71
+ expect(loops).to be <= 1
72
+ end
73
+ expect(ret).to eq(Hash.transform_keys_to_strings(cors).to_yaml)
74
+ end
53
75
  end
54
- it "as a block" do
76
+ end
77
+
78
+ context "when server gives object" do
79
+ it "lists" do
55
80
  cors = {:origin=>true,
56
81
  :methods=>["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],
57
82
  :headers=>["Content-Type","Cookie","Authorization"],
58
83
  :credentials=>true}
59
- body = {:cors=>cors.to_json}
84
+ body = cors
60
85
  stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/cors").
61
86
  with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
62
87
  'Content-Type'=>'application/json'}).
63
88
  to_return(body: body.to_json)
64
89
 
65
- ret = ''
66
- loops = 0
67
- @srv.fetch() do |chunk|
68
- loops += 1
69
- ret << chunk
70
- expect(loops).to be <= 1
90
+ ret = @srv.list()
91
+ expect(ret).to eq([cors.merge({:id=>'cors'})])
92
+ end
93
+
94
+ context "fetches" do
95
+ it "as a hash" do
96
+ cors = {:origin=>true,
97
+ :methods=>["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],
98
+ :headers=>["Content-Type","Cookie","Authorization"],
99
+ :credentials=>true}
100
+ body = cors
101
+ stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/cors").
102
+ with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
103
+ 'Content-Type'=>'application/json'}).
104
+ to_return(body: body.to_json)
105
+
106
+ ret = @srv.fetch()
107
+ expect(ret).to eq(cors)
108
+ end
109
+ it "as a block" do
110
+ cors = {:origin=>true,
111
+ :methods=>["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],
112
+ :headers=>["Content-Type","Cookie","Authorization"],
113
+ :credentials=>true}
114
+ body = cors
115
+ stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/cors").
116
+ with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
117
+ 'Content-Type'=>'application/json'}).
118
+ to_return(body: body.to_json)
119
+
120
+ ret = ''
121
+ loops = 0
122
+ @srv.fetch() do |chunk|
123
+ loops += 1
124
+ ret << chunk
125
+ expect(loops).to be <= 1
126
+ end
127
+ expect(ret).to eq(Hash.transform_keys_to_strings(cors).to_yaml)
71
128
  end
72
- expect(ret).to eq(Hash.transform_keys_to_strings(cors).to_yaml)
73
129
  end
74
130
  end
75
131
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: MrMurano
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.3
4
+ version: 1.12.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Conrad Tadpol Tilstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-18 00:00:00.000000000 Z
11
+ date: 2017-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander