webservicex_stock_quote 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *~
2
+ #*#
3
+ *.gem
4
+ *.rbc
5
+ .bundle
6
+ .config
7
+ .yardoc
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in webservicex_stock_quote.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Your Name
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # WebservicexStockQuote
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'webservicex_stock_quote'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install webservicex_stock_quote
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "cucumber/rake/task"
3
+
4
+ Cucumber::Rake::Task.new(:cucumber) do |t|
5
+ t.cucumber_opts = "--format pretty" # Any valid command line option can go here.
6
+ end
@@ -0,0 +1,8 @@
1
+ Feature: Get Stock
2
+
3
+ In order to manage stock
4
+ A Rubyist needs to retrieve current ticker values
5
+
6
+ Scenario: Get 'GLD'
7
+ When I get a quote for 'GLD'
8
+ Then the symbol should be 'GLD'
@@ -0,0 +1,7 @@
1
+ When(/^I get a quote for 'GLD'$/) do
2
+ @result = WebServiceXStockQuote::Quote.get('GLD')
3
+ end
4
+
5
+ Then(/^the symbol should be 'GLD'$/) do
6
+ @result[:symbol].should eq('GLD')
7
+ end
@@ -0,0 +1,2 @@
1
+ require 'webservicex_stock_quote'
2
+ require 'rspec'
@@ -0,0 +1,23 @@
1
+ require "webservicex_stock_quote/version"
2
+
3
+ require 'savon'
4
+ require 'nori'
5
+ require 'nokogiri'
6
+
7
+ module WebServiceXStockQuote
8
+ class Quote
9
+ class << self
10
+ attr_accessor :client, :parser
11
+ end
12
+
13
+ @client = Savon.client(wsdl: 'http://www.webservicex.net/stockquote.asmx?WSDL')
14
+ @parser = Nori.new( :convert_tags_to => lambda { |t| t.snakecase.to_sym } )
15
+
16
+ def Quote.get(symbol)
17
+ response = @client.call(:get_quote, :message => { :symbol => symbol })
18
+ result = @parser.parse(response.body[:get_quote_response][:get_quote_result])
19
+
20
+ return result[:stock_quotes][:stock]
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module WebservicexStockQuote
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'webservicex_stock_quote/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "webservicex_stock_quote"
8
+ spec.version = WebservicexStockQuote::VERSION
9
+ spec.authors = ["David Birch"]
10
+ spec.email = ["dsjbirch@gmail.com"]
11
+ spec.description = %q{Get a free stock quote for a company symbol using webservicex.net}
12
+ spec.summary = %q{Does exactly what it says on the tin}
13
+ spec.homepage = "https://github.com/dsjbirch/gem-webservicex_stock_quote"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "cucumber"
24
+ spec.add_development_dependency "savon"
25
+ spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "nori"
27
+ spec.add_development_dependency "nokogiri"
28
+
29
+ spec.add_dependency "savon", "~> 2.2"
30
+ spec.add_dependency "nori", "~> 2.0"
31
+ spec.add_dependency "nokogiri", "~> 1.5"
32
+ end
metadata ADDED
@@ -0,0 +1,210 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: webservicex_stock_quote
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - David Birch
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2013-05-12 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: bundler
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 3
31
+ version: "1.3"
32
+ type: :development
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: rake
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ version: "0"
45
+ type: :development
46
+ version_requirements: *id002
47
+ - !ruby/object:Gem::Dependency
48
+ name: cucumber
49
+ prerelease: false
50
+ requirement: &id003 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ type: :development
59
+ version_requirements: *id003
60
+ - !ruby/object:Gem::Dependency
61
+ name: savon
62
+ prerelease: false
63
+ requirement: &id004 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ type: :development
72
+ version_requirements: *id004
73
+ - !ruby/object:Gem::Dependency
74
+ name: rspec
75
+ prerelease: false
76
+ requirement: &id005 !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ segments:
82
+ - 0
83
+ version: "0"
84
+ type: :development
85
+ version_requirements: *id005
86
+ - !ruby/object:Gem::Dependency
87
+ name: nori
88
+ prerelease: false
89
+ requirement: &id006 !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ segments:
95
+ - 0
96
+ version: "0"
97
+ type: :development
98
+ version_requirements: *id006
99
+ - !ruby/object:Gem::Dependency
100
+ name: nokogiri
101
+ prerelease: false
102
+ requirement: &id007 !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ segments:
108
+ - 0
109
+ version: "0"
110
+ type: :development
111
+ version_requirements: *id007
112
+ - !ruby/object:Gem::Dependency
113
+ name: savon
114
+ prerelease: false
115
+ requirement: &id008 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ~>
119
+ - !ruby/object:Gem::Version
120
+ segments:
121
+ - 2
122
+ - 2
123
+ version: "2.2"
124
+ type: :runtime
125
+ version_requirements: *id008
126
+ - !ruby/object:Gem::Dependency
127
+ name: nori
128
+ prerelease: false
129
+ requirement: &id009 !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ~>
133
+ - !ruby/object:Gem::Version
134
+ segments:
135
+ - 2
136
+ - 0
137
+ version: "2.0"
138
+ type: :runtime
139
+ version_requirements: *id009
140
+ - !ruby/object:Gem::Dependency
141
+ name: nokogiri
142
+ prerelease: false
143
+ requirement: &id010 !ruby/object:Gem::Requirement
144
+ none: false
145
+ requirements:
146
+ - - ~>
147
+ - !ruby/object:Gem::Version
148
+ segments:
149
+ - 1
150
+ - 5
151
+ version: "1.5"
152
+ type: :runtime
153
+ version_requirements: *id010
154
+ description: Get a free stock quote for a company symbol using webservicex.net
155
+ email:
156
+ - dsjbirch@gmail.com
157
+ executables: []
158
+
159
+ extensions: []
160
+
161
+ extra_rdoc_files: []
162
+
163
+ files:
164
+ - .gitignore
165
+ - Gemfile
166
+ - LICENSE.txt
167
+ - README.md
168
+ - Rakefile
169
+ - features/get_quote.feature
170
+ - features/step_definitions/quote_steps.rb
171
+ - features/support/env.rb
172
+ - lib/webservicex_stock_quote.rb
173
+ - lib/webservicex_stock_quote/version.rb
174
+ - webservicex_stock_quote.gemspec
175
+ has_rdoc: true
176
+ homepage: https://github.com/dsjbirch/gem-webservicex_stock_quote
177
+ licenses:
178
+ - MIT
179
+ post_install_message:
180
+ rdoc_options: []
181
+
182
+ require_paths:
183
+ - lib
184
+ required_ruby_version: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ segments:
190
+ - 0
191
+ version: "0"
192
+ required_rubygems_version: !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ segments:
198
+ - 0
199
+ version: "0"
200
+ requirements: []
201
+
202
+ rubyforge_project:
203
+ rubygems_version: 1.3.7
204
+ signing_key:
205
+ specification_version: 3
206
+ summary: Does exactly what it says on the tin
207
+ test_files:
208
+ - features/get_quote.feature
209
+ - features/step_definitions/quote_steps.rb
210
+ - features/support/env.rb