rest_client_plus 0.0.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.
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+ .idea
15
+
16
+ # YARD artifacts
17
+ .yardoc
18
+ _yardoc
19
+ doc/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rest_client_plus.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,17 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rest_client_plus (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ rake (10.1.0)
10
+
11
+ PLATFORMS
12
+ x86-mingw32
13
+
14
+ DEPENDENCIES
15
+ bundler
16
+ rake
17
+ rest_client_plus!
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Dazzla
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ RestClientPlus
2
+ ==============
3
+
4
+ Extensions to Ruby's RestClient
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,10 @@
1
+ module RestClientPlus
2
+ class ArrayHelper
3
+
4
+ def self.unwrap_from_array(operand)
5
+ operand = operand[0] if operand.respond_to?(:map!)
6
+ operand
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,25 @@
1
+ require_relative 'rest_client_plus'
2
+
3
+ module RestClientPlus
4
+ class Requests
5
+
6
+ def self.post_json_to_url input_url, json_body
7
+ response = RestClient.post(input_url, json_body, :content_type => 'application/json')
8
+ response.code.should == 200
9
+ JSON.parse response.body
10
+ end
11
+
12
+ def self.put_json_to_url input_url, json_body
13
+ response = RestClient.put(input_url, json_body, :content_type => 'application/json')
14
+ response.code.should == 200
15
+ JSON.parse response.body
16
+ end
17
+
18
+ def self.get_json_from_url input_url
19
+ response = RestClient.get(input_url)
20
+ response.code.should == 200
21
+ JSON.parse response.body
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "rest_client_plus"
7
+ s.version = "0.0.1"
8
+ s.authors = ["John Wakeling", "Darren Bown"]
9
+ s.email = ["jwakeling23@gmail.com", "darren.bown@droidqa.co.uk"]
10
+ s.description = %q{Rest-Clint-Plus for Json requests}
11
+ s.summary = %q{Rest-Clint-Plus for Json requests}
12
+ s.homepage = "https://github.com/johnwake/rest_client_plus"
13
+ s.license = "MIT"
14
+
15
+ s.files = `git ls-files`.split($/)
16
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_development_dependency "bundler"
21
+ s.add_development_dependency "rake"
22
+ end
@@ -0,0 +1,24 @@
1
+ require 'test/unit'
2
+ require_relative '../lib/array_helper'
3
+
4
+ class ArrayHelperTest < Test::Unit::TestCase
5
+
6
+ def setup
7
+ @test_hash = {:one => '1', :two => '2'}
8
+ @hash_wrapped_in_array = [@test_hash]
9
+ @test_string = "OneTwoThree"
10
+ end
11
+
12
+ def test_unwrap_from_array
13
+ assert_equal(@test_hash, RestClientPlus::ArrayHelper.unwrap_from_array(@hash_wrapped_in_array))
14
+ end
15
+
16
+ def test_unwrap_from_array_when_hash_passed
17
+ assert_equal(@test_hash, RestClientPlus::ArrayHelper.unwrap_from_array(@test_hash))
18
+ end
19
+
20
+ def test_unwrap_from_array_when_string_passed
21
+ assert_equal(@test_string, RestClientPlus::ArrayHelper.unwrap_from_array(@test_string))
22
+ end
23
+
24
+ end
@@ -0,0 +1,10 @@
1
+ require 'test/unit'
2
+ require_relative '../lib/rest_client_plus'
3
+
4
+ class RestClientPlusTest < Test::Unit::TestCase
5
+
6
+ def test_rest_client_plus_is_a_module
7
+ assert_respond_to(RestClientPlus, :constants)
8
+ end
9
+
10
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rest_client_plus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - John Wakeling
9
+ - Darren Bown
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-12-19 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundler
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: rake
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ description: Rest-Clint-Plus for Json requests
48
+ email:
49
+ - jwakeling23@gmail.com
50
+ - darren.bown@droidqa.co.uk
51
+ executables: []
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - .gitignore
56
+ - Gemfile
57
+ - Gemfile.lock
58
+ - LICENSE
59
+ - README.md
60
+ - Rakefile
61
+ - lib/array_helper.rb
62
+ - lib/rest_client_plus.rb
63
+ - rest_client_plus.gemspec
64
+ - tests/array_helper_test.rb
65
+ - tests/rest_client_plus_test.rb
66
+ homepage: https://github.com/johnwake/rest_client_plus
67
+ licenses:
68
+ - MIT
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 1.8.24
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Rest-Clint-Plus for Json requests
91
+ test_files: []