quotemedia 0.0.1.e → 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/README.rdoc CHANGED
@@ -2,12 +2,9 @@
2
2
 
3
3
  QuoteMedia is a thin wrapper for the api of http://www.quotemedia.com.
4
4
 
5
- http://stillmaintained.com/cowmanifestation/quotemedia.png
6
- http://travis-ci.org/cowmanifestation/quotemedia.png ({More info}[http://travis-ci.org/cowmanifestation/quotemedia])
7
-
8
5
  == Charts
9
6
 
10
- Custom charts can be obtained from quotemedia.com from a url containing all of the desired parameters. Use <tt>QuoteMedia.create_chart_url(params)</tt> to create a custom url. The only required parameter is +:symbol+ (the symbol for a stock or stock exchange). The others will be filled in with the default values unless specified. Refer to +lib/chart.rb+ for a list of all parameters.
7
+ Custom charts can be obtained from quotemedia.com from a url containing all of the desired parameters. Use +QuoteMedia.create_chart_url(params)+ to create a custom url. The only required parameter is +:symbol+ (the symbol for a stock or stock exchange). The others will be filled in with the default values unless specified. Refer to +lib/chart.rb+ for a list of all parameters.
11
8
 
12
9
  == Contributing
13
10
 
data/lib/chart.rb ADDED
@@ -0,0 +1,75 @@
1
+ class Chart
2
+ # QuoteMedia chart parameters reference:
3
+ # http://www.quotemedia.com/content_solutions/module_resources.php
4
+ # QuoteMedia Chart Builder: http://www.quotemedia.com/demoarea/chartbuilder-cookiebased.php
5
+
6
+ # TODO put default styling here that Chris selects
7
+ CHART_DEFAULTS = {
8
+ webmasterId: "500",
9
+
10
+ # We don't want a default symbol - each chart should have its own.
11
+ # symbol: nil, # i.e. ^DOW
12
+
13
+ # This is the chart title; you can specify whatever you want, or leave it empty.
14
+ # QuoteMedia makes suggestions based on the symbol which can be seen when using the QuoteMedia Chart Builder - http://www.quotemedia.com/demoarea/chartbuilder-cookiebased.php
15
+ # Or it can be left empty, in which case the symbol will be used as the title, unless the title (chton) is off.
16
+ #chsym: nil,
17
+ # date range - for example, 1d, 5d, 1y etc.
18
+ chscale: '5d',
19
+ # previous close is on/off
20
+ chpcon: 'on',
21
+ # Chart type - Options: bar, candle, compare, dot, hlc, line, mountain, ohlc, LineChart, BarChart, CandleStickChart, AreaChart, FinancialLine, FinancialBar, FinancialCandleStick
22
+ chtype: 'AreaChart',
23
+ # The frame around the image canvas on/off
24
+ chfrmon: 'on',
25
+ # frame color
26
+ chfrm: 'ffffff',
27
+ # border around plot area on/off
28
+ chbdron: 'on',
29
+ # border color around plot area
30
+ chbdr: 'cccccc',
31
+ # background color
32
+ chbg: 'ffffff',
33
+ # background color of chart plot area
34
+ chbgch: 'ffffff',
35
+ # line color
36
+ chln: '465665',
37
+ # primary fill color for area charts, and candlestick (and volume bars)
38
+ chfill: '1B57AA',
39
+ # gradient fill color turns on gradient-fill area charts
40
+ chfill2: 'c0c9d2',
41
+ # plot area grid on/of
42
+ chgrdon: 'on',
43
+ # grid color
44
+ chgrd: 'cccccc',
45
+ # chart title is visible on/off
46
+ chton: 'on',
47
+ # chart title color
48
+ chtcol: '000000',
49
+ # xy label and tick color
50
+ chxyc: '111111',
51
+ # previous close line color
52
+ chpccol: 'ee0000',
53
+ # margin padding
54
+ chmrg: '2',
55
+ # chart height
56
+ chhig: '250',
57
+ # chart width
58
+ chwid: '380',
59
+ }
60
+
61
+ def initialize(params)
62
+ # TODO: Raise error for parameters that don't exist, i.e. misspelled things
63
+ unless params[:symbol]
64
+ raise ArgumentError, "No symbol specified."
65
+ end
66
+
67
+ @chart_params = CHART_DEFAULTS.merge(params)
68
+ end
69
+
70
+ def url
71
+ url = 'http://app.quotemedia.com/quotetools/getChart.go?'
72
+
73
+ url << @chart_params.to_a.map {|a| a.join("=")}.join("&")
74
+ end
75
+ end
data/lib/quotemedia.rb CHANGED
@@ -1,6 +1,7 @@
1
- module Quotemedia
2
- autoload :VERSION, "quotemedia/version"
3
- autoload :Chart, "quotemedia/chart"
1
+ require_relative "quotemedia/version"
2
+ require_relative "chart"
3
+
4
+ module QuoteMedia
4
5
  def self.create_chart_url(params)
5
6
  chart = Chart.new(params)
6
7
  chart.url
@@ -1,3 +1,3 @@
1
- module QuoteMedia
2
- VERSION = "0.0.1.e"
1
+ module Quotemedia
2
+ VERSION = "0.0.1"
3
3
  end
data/quotemedia.gemspec CHANGED
@@ -4,7 +4,7 @@ require "quotemedia/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "quotemedia"
7
- s.version = QuoteMedia::VERSION
7
+ s.version = Quotemedia::VERSION
8
8
  s.authors = ["Chenoa Siegenthaler"]
9
9
  s.email = ["cowmanifestation@gmail.com"]
10
10
  s.homepage = "https://github.com/cowmanifestation/quotemedia"
@@ -1,23 +1,23 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Quotemedia::Chart do
3
+ describe Chart do
4
4
  describe "#new" do
5
5
  it "should raise an error when no symbol is given" do
6
- lambda { Quotemedia::Chart.new }.should raise_error
6
+ lambda { Chart.new }.should raise_error
7
7
  end
8
8
  end
9
9
 
10
10
  describe '#url' do
11
11
  it "should return a url with all the default parameters if given no others" do
12
- url = Quotemedia::Chart.new(:symbol => 'abc').url
12
+ url = Chart.new(symbol: 'abc').url
13
13
 
14
14
  some_defaults = {
15
- :webmasterId => "500",
16
- :chscale => '5d',
17
- :chtype => 'AreaChart',
18
- :chfrm => 'ffffff',
19
- :chbdron => 'on',
20
- :chhig => '250',
15
+ webmasterId: "500",
16
+ chscale: '5d',
17
+ chtype: 'AreaChart',
18
+ chfrm: 'ffffff',
19
+ chbdron: 'on',
20
+ chhig: '250',
21
21
  }
22
22
 
23
23
  some_defaults.each do |k,v|
@@ -26,17 +26,17 @@ describe Quotemedia::Chart do
26
26
  end
27
27
 
28
28
  it "should give a url containing all the given parameters" do
29
- custom_params = { :symbol => 'abc',
30
- :webmasterId => '321',
31
- :chscale => '2d',
32
- :chpcon => 'off',
33
- :chtype => 'candle',
34
- :chmrg => '7',
35
- :chhig => '100',
36
- :chwid => '150'
29
+ custom_params = { symbol: 'abc',
30
+ webmasterId: '321',
31
+ chscale: '2d',
32
+ chpcon: 'off',
33
+ chtype: 'candle',
34
+ chmrg: '7',
35
+ chhig: '100',
36
+ chwid: '150'
37
37
  }
38
38
 
39
- url = Quotemedia::Chart.new(custom_params).url
39
+ url = Chart.new(custom_params).url
40
40
  custom_params.each do |k,v|
41
41
  url.should match(/#{k}=#{v}/)
42
42
  end
@@ -1,10 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Quotemedia do
3
+ describe QuoteMedia do
4
4
  before(:all) do
5
- @url = Quotemedia.create_chart_url(:symbol => 'abc')
5
+ @url = QuoteMedia.create_chart_url(symbol: 'abc')
6
6
  end
7
7
 
8
+ # TODO These tests are redundant.
8
9
  describe '#create_chart_url' do
9
10
  it "should give a url string" do
10
11
  @url.class.should == String
@@ -13,7 +14,7 @@ describe Quotemedia do
13
14
 
14
15
  it "should raise an error if not given a symbol" do
15
16
  lambda do
16
- Quotemedia.create_chart_url
17
+ QuoteMedia.create_chart_url
17
18
  end.should raise_error
18
19
  end
19
20
 
@@ -23,7 +24,7 @@ describe Quotemedia do
23
24
  end
24
25
 
25
26
  it "should replace default parameters with given parameters" do
26
- Quotemedia.create_chart_url(:symbol => 'abc', :webmasterId => '321', :chgrdon => 'off').should match(/webmasterId=321.+chgrdon=off/)
27
+ QuoteMedia.create_chart_url(symbol: 'abc', webmasterId: '321', chgrdon: 'off').should match(/webmasterId=321.+chgrdon=off/)
27
28
  end
28
29
  end
29
30
  end
metadata CHANGED
@@ -1,57 +1,60 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: quotemedia
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.1.e
5
- prerelease: 6
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Chenoa Siegenthaler
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-14 00:00:00.000000000 -05:00
12
+
13
+ date: 2011-11-28 00:00:00 -05:00
13
14
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
16
17
  name: rake
17
- requirement: &2156711540 !ruby/object:Gem::Requirement
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
18
20
  none: false
19
- requirements:
21
+ requirements:
20
22
  - - ~>
21
- - !ruby/object:Gem::Version
23
+ - !ruby/object:Gem::Version
22
24
  version: 0.9.2.2
23
25
  type: :development
24
- prerelease: false
25
- version_requirements: *2156711540
26
- - !ruby/object:Gem::Dependency
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
27
28
  name: rspec
28
- requirement: &2156711040 !ruby/object:Gem::Requirement
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
29
31
  none: false
30
- requirements:
32
+ requirements:
31
33
  - - ~>
32
- - !ruby/object:Gem::Version
34
+ - !ruby/object:Gem::Version
33
35
  version: 2.5.0
34
36
  type: :development
35
- prerelease: false
36
- version_requirements: *2156711040
37
+ version_requirements: *id002
37
38
  description: A thin wrapper to Quotemedia apis
38
- email:
39
+ email:
39
40
  - cowmanifestation@gmail.com
40
41
  executables: []
42
+
41
43
  extensions: []
44
+
42
45
  extra_rdoc_files: []
43
- files:
46
+
47
+ files:
44
48
  - .gitignore
45
49
  - .rspec
46
50
  - .rvmrc
47
- - .travis.yml
48
51
  - Gemfile
49
52
  - LICENSE
50
53
  - README.rdoc
51
54
  - Rakefile
52
55
  - configure
56
+ - lib/chart.rb
53
57
  - lib/quotemedia.rb
54
- - lib/quotemedia/chart.rb
55
58
  - lib/quotemedia/version.rb
56
59
  - quotemedia.gemspec
57
60
  - spec/lib/chart_spec.rb
@@ -60,29 +63,32 @@ files:
60
63
  has_rdoc: true
61
64
  homepage: https://github.com/cowmanifestation/quotemedia
62
65
  licenses: []
66
+
63
67
  post_install_message:
64
68
  rdoc_options: []
65
- require_paths:
69
+
70
+ require_paths:
66
71
  - lib
67
- required_ruby_version: !ruby/object:Gem::Requirement
72
+ required_ruby_version: !ruby/object:Gem::Requirement
68
73
  none: false
69
- requirements:
70
- - - ! '>='
71
- - !ruby/object:Gem::Version
72
- version: '0'
73
- required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: "0"
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
79
  none: false
75
- requirements:
76
- - - ! '>'
77
- - !ruby/object:Gem::Version
78
- version: 1.3.1
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: "0"
79
84
  requirements: []
85
+
80
86
  rubyforge_project: quotemedia
81
87
  rubygems_version: 1.6.2
82
88
  signing_key:
83
89
  specification_version: 3
84
90
  summary: Quotemedia api wrapper
85
- test_files:
91
+ test_files:
86
92
  - spec/lib/chart_spec.rb
87
93
  - spec/lib/quotemedia_spec.rb
88
94
  - spec/spec_helper.rb
data/.travis.yml DELETED
@@ -1,3 +0,0 @@
1
- rvm:
2
- - 1.8.7
3
- - 1.9.2
@@ -1,76 +0,0 @@
1
- module Quotemedia
2
- class Chart
3
- # QuoteMedia chart parameters reference:
4
- # http://www.quotemedia.com/content_solutions/module_resources.php
5
- # QuoteMedia Chart Builder: http://www.quotemedia.com/demoarea/chartbuilder-cookiebased.php
6
-
7
- # Default styling here that Chris (designer) selected
8
- CHART_DEFAULTS = {
9
- :webmasterId => "500",
10
-
11
- # We don't want a default symbol - each chart should have its own.
12
- # symbol: nil, # i.e. ^DOW
13
-
14
- # This is the chart title; you can specify whatever you want, or leave it empty.
15
- # QuoteMedia makes suggestions based on the symbol which can be seen when using the QuoteMedia Chart Builder - http://www.quotemedia.com/demoarea/chartbuilder-cookiebased.php
16
- # Or it can be left empty, in which case the symbol will be used as the title, unless the title (chton) is off.
17
- #chsym: nil,
18
- # date range - for example, 1d, 5d, 1y etc.
19
- :chscale => '5d',
20
- # previous close is on/off
21
- :chpcon => 'on',
22
- # Chart type - Options: bar, candle, compare, dot, hlc, line, mountain, ohlc, LineChart, BarChart, CandleStickChart, AreaChart, FinancialLine, FinancialBar, FinancialCandleStick
23
- :chtype => 'AreaChart',
24
- # The frame around the image canvas on/off
25
- :chfrmon => 'off',
26
- # frame color
27
- :chfrm => '',
28
- # border around plot area on/off
29
- :chbdron => 'off',
30
- # border color around plot area
31
- :chbdr => '',
32
- # background color
33
- :chbg => 'ffffff00', # transparent
34
- # background color of chart plot area
35
- :chbgch => 'ffffff00', # transparent
36
- # line color
37
- :chln => '465665',
38
- # primary fill color for area charts, and candlestick (and volume bars)
39
- :chfill => '1B57AA',
40
- # gradient fill color turns on gradient-fill area charts
41
- :chfill2 => 'c0c9d2',
42
- # plot area grid on/of
43
- :chgrdon => 'on',
44
- # grid color
45
- :chgrd => 'cccccc',
46
- # chart title is visible on/off
47
- :chton => 'on',
48
- # chart title color
49
- :chtcol => '000000',
50
- # xy label and tick color
51
- :chxyc => '111111',
52
- # previous close line color
53
- :chpccol => 'ee0000',
54
- # margin padding
55
- :chmrg => '2',
56
- # chart height
57
- :chhig => '250',
58
- # chart width
59
- :chwid => '380',
60
- }
61
-
62
- def initialize(params)
63
- unless params[:symbol]
64
- raise ArgumentError, "No symbol specified."
65
- end
66
-
67
- @chart_params = CHART_DEFAULTS.merge(params)
68
- end
69
-
70
- def url
71
- url = 'http://app.quotemedia.com/quotetools/getChart.go?'
72
-
73
- url << @chart_params.to_a.map {|a| a.join("=")}.join("&")
74
- end
75
- end
76
- end