genability 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/.yardopts +10 -0
- data/Gemfile +18 -0
- data/HISTORY.md +7 -0
- data/LICENSE.md +20 -0
- data/README.md +79 -0
- data/Rakefile +42 -0
- data/VERSION +1 -0
- data/genability.gemspec +123 -0
- data/lib/faraday/request/url_encoding_fix.rb +19 -0
- data/lib/faraday/response/raise_http_4xx.rb +44 -0
- data/lib/faraday/response/raise_http_5xx.rb +25 -0
- data/lib/genability.rb +29 -0
- data/lib/genability/api.rb +26 -0
- data/lib/genability/client.rb +24 -0
- data/lib/genability/client/helpers.rb +57 -0
- data/lib/genability/client/load_serving_entity.rb +77 -0
- data/lib/genability/client/price.rb +53 -0
- data/lib/genability/client/season.rb +27 -0
- data/lib/genability/client/tariff.rb +80 -0
- data/lib/genability/client/territory.rb +80 -0
- data/lib/genability/client/time_of_use.rb +66 -0
- data/lib/genability/client/zip_code.rb +28 -0
- data/lib/genability/configuration.rb +82 -0
- data/lib/genability/connection.rb +41 -0
- data/lib/genability/error.rb +21 -0
- data/lib/genability/request.rb +46 -0
- data/lib/mashie_extensions.rb +32 -0
- data/spec/cassettes/load_serving_entities.yml +163 -0
- data/spec/cassettes/load_serving_entity.yml +28 -0
- data/spec/cassettes/prices.yml +55 -0
- data/spec/cassettes/seasons.yml +28 -0
- data/spec/cassettes/tariff.yml +28 -0
- data/spec/cassettes/tariffs.yml +82 -0
- data/spec/cassettes/territories.yml +28 -0
- data/spec/cassettes/territory.yml +28 -0
- data/spec/cassettes/time_of_use.yml +30 -0
- data/spec/cassettes/time_of_uses.yml +28 -0
- data/spec/cassettes/zipcode.yml +28 -0
- data/spec/client/load_serving_entity_spec.rb +72 -0
- data/spec/client/price_spec.rb +41 -0
- data/spec/client/season_spec.rb +30 -0
- data/spec/client/tariff_spec.rb +52 -0
- data/spec/client/territory_spec.rb +40 -0
- data/spec/client/time_of_use_spec.rb +42 -0
- data/spec/client/zip_code_spec.rb +30 -0
- data/spec/configuration.yml.sample +3 -0
- data/spec/faraday/response_spec.rb +31 -0
- data/spec/genability_spec.rb +138 -0
- data/spec/spec_helper.rb +78 -0
- metadata +236 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.yardopts
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem "faraday", "~> 0.6"
|
4
|
+
gem "faraday_middleware", "~> 0.6"
|
5
|
+
gem "hashie", "~> 1.0.0"
|
6
|
+
gem "multi_json", "~> 1.0.0"
|
7
|
+
gem "chronic", "~> 0.4.0"
|
8
|
+
|
9
|
+
group :development do
|
10
|
+
gem "rspec", "~> 2.6.0"
|
11
|
+
gem "yard", "~> 0.7.0"
|
12
|
+
gem "bundler", "~> 1.0.0"
|
13
|
+
gem "jeweler", "~> 1.6.2"
|
14
|
+
gem "simplecov", "~> 0.4"
|
15
|
+
gem "vcr", "~> 1.10.0"
|
16
|
+
gem "webmock", "~> 1.6.0"
|
17
|
+
end
|
18
|
+
|
data/HISTORY.md
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Matthew Solt
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
The Genability Ruby Gem
|
2
|
+
====================
|
3
|
+
A Ruby wrapper for the Genability power pricing and related APIs - learn more at [https://developer.genability.com](https://developer.genability.com)
|
4
|
+
|
5
|
+
Installation
|
6
|
+
------------
|
7
|
+
gem install genability
|
8
|
+
|
9
|
+
Documentation
|
10
|
+
-------------
|
11
|
+
[http://rdoc.info/gems/genability](http://rdoc.info/gems/genability)
|
12
|
+
|
13
|
+
Usage Examples
|
14
|
+
--------------
|
15
|
+
require "rubygems"
|
16
|
+
require "genability"
|
17
|
+
|
18
|
+
# Configure during client initialization
|
19
|
+
client = Genability::Client.new(:application_id = 'ValidAppId', :application_key => 'ValidAppKey')
|
20
|
+
|
21
|
+
# Or use the block configuration method
|
22
|
+
# register an app at https://developer.genability.com
|
23
|
+
Genability.configure do |config|
|
24
|
+
config.application_id = 'ValidAppId'
|
25
|
+
config.application_key = 'ValidAppKey'
|
26
|
+
end
|
27
|
+
|
28
|
+
# Get a list of load serving entities
|
29
|
+
Genability.load_serving_entities
|
30
|
+
|
31
|
+
# Get one load serving entity
|
32
|
+
Genability.load_serving_entity(2756)
|
33
|
+
|
34
|
+
# Get a list of tariffs
|
35
|
+
Genability.tariffs
|
36
|
+
|
37
|
+
# Get one tariff
|
38
|
+
Genability.tariff(512)
|
39
|
+
|
40
|
+
# Get the prices for a specified tariff
|
41
|
+
Genability.prices(520)
|
42
|
+
|
43
|
+
# Get the territories for a load serving entity
|
44
|
+
Genability.territories(:lse_id => 734)
|
45
|
+
|
46
|
+
# Get the details of one territory
|
47
|
+
Genability.territory(3539)
|
48
|
+
|
49
|
+
# Get a list of seasons for a load serving entity
|
50
|
+
Genability.seasons(734)
|
51
|
+
|
52
|
+
# Get a particular time of use group for a given load serving entity
|
53
|
+
Genability.time_of_uses(2756, 1)
|
54
|
+
|
55
|
+
# Get the intervals for the particular time of use group of a given load serving entity
|
56
|
+
Genability.time_of_use_intervals(2756, 1)
|
57
|
+
|
58
|
+
# Get information about a zipcode
|
59
|
+
Genability.zipcode('48322')
|
60
|
+
|
61
|
+
# Please see the documentation for available options and the tests for additional examples
|
62
|
+
|
63
|
+
|
64
|
+
Contributing to Genability
|
65
|
+
-------------------------
|
66
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
67
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
68
|
+
* Fork the project
|
69
|
+
* Start a feature/bugfix branch
|
70
|
+
* Commit and push until you are happy with your contribution
|
71
|
+
* Make sure to add documentation
|
72
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
73
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
74
|
+
|
75
|
+
Copyright
|
76
|
+
---------
|
77
|
+
Copyright (c) 2011 Matthew Solt.
|
78
|
+
See [LICENSE](https://github.com/activefx/genability/blob/master/LICENSE.md) for details.
|
79
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "genability"
|
18
|
+
gem.homepage = "http://github.com/activefx/genability"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Ruby client for the Genability API}
|
21
|
+
gem.description = %Q{Ruby client for the Genability power pricing and related APIs - learn more at https://developer.genability.com}
|
22
|
+
gem.email = "mattsolt@gmail.com"
|
23
|
+
gem.authors = ["Matthew Solt"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
+
spec.rcov = true
|
37
|
+
end
|
38
|
+
|
39
|
+
task :default => :spec
|
40
|
+
|
41
|
+
require 'yard'
|
42
|
+
YARD::Rake::YardocTask.new
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/genability.gemspec
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{genability}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = [%q{Matthew Solt}]
|
12
|
+
s.date = %q{2011-07-01}
|
13
|
+
s.description = %q{Ruby client for the Genability power pricing and related APIs - learn more at https://developer.genability.com}
|
14
|
+
s.email = %q{mattsolt@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.md",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
".yardopts",
|
23
|
+
"Gemfile",
|
24
|
+
"HISTORY.md",
|
25
|
+
"LICENSE.md",
|
26
|
+
"README.md",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"genability.gemspec",
|
30
|
+
"lib/faraday/request/url_encoding_fix.rb",
|
31
|
+
"lib/faraday/response/raise_http_4xx.rb",
|
32
|
+
"lib/faraday/response/raise_http_5xx.rb",
|
33
|
+
"lib/genability.rb",
|
34
|
+
"lib/genability/api.rb",
|
35
|
+
"lib/genability/client.rb",
|
36
|
+
"lib/genability/client/helpers.rb",
|
37
|
+
"lib/genability/client/load_serving_entity.rb",
|
38
|
+
"lib/genability/client/price.rb",
|
39
|
+
"lib/genability/client/season.rb",
|
40
|
+
"lib/genability/client/tariff.rb",
|
41
|
+
"lib/genability/client/territory.rb",
|
42
|
+
"lib/genability/client/time_of_use.rb",
|
43
|
+
"lib/genability/client/zip_code.rb",
|
44
|
+
"lib/genability/configuration.rb",
|
45
|
+
"lib/genability/connection.rb",
|
46
|
+
"lib/genability/error.rb",
|
47
|
+
"lib/genability/request.rb",
|
48
|
+
"lib/mashie_extensions.rb",
|
49
|
+
"spec/cassettes/load_serving_entities.yml",
|
50
|
+
"spec/cassettes/load_serving_entity.yml",
|
51
|
+
"spec/cassettes/prices.yml",
|
52
|
+
"spec/cassettes/seasons.yml",
|
53
|
+
"spec/cassettes/tariff.yml",
|
54
|
+
"spec/cassettes/tariffs.yml",
|
55
|
+
"spec/cassettes/territories.yml",
|
56
|
+
"spec/cassettes/territory.yml",
|
57
|
+
"spec/cassettes/time_of_use.yml",
|
58
|
+
"spec/cassettes/time_of_uses.yml",
|
59
|
+
"spec/cassettes/zipcode.yml",
|
60
|
+
"spec/client/load_serving_entity_spec.rb",
|
61
|
+
"spec/client/price_spec.rb",
|
62
|
+
"spec/client/season_spec.rb",
|
63
|
+
"spec/client/tariff_spec.rb",
|
64
|
+
"spec/client/territory_spec.rb",
|
65
|
+
"spec/client/time_of_use_spec.rb",
|
66
|
+
"spec/client/zip_code_spec.rb",
|
67
|
+
"spec/configuration.yml.sample",
|
68
|
+
"spec/faraday/response_spec.rb",
|
69
|
+
"spec/genability_spec.rb",
|
70
|
+
"spec/spec_helper.rb"
|
71
|
+
]
|
72
|
+
s.homepage = %q{http://github.com/activefx/genability}
|
73
|
+
s.licenses = [%q{MIT}]
|
74
|
+
s.require_paths = [%q{lib}]
|
75
|
+
s.rubygems_version = %q{1.8.5}
|
76
|
+
s.summary = %q{Ruby client for the Genability API}
|
77
|
+
|
78
|
+
if s.respond_to? :specification_version then
|
79
|
+
s.specification_version = 3
|
80
|
+
|
81
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
82
|
+
s.add_runtime_dependency(%q<faraday>, ["~> 0.6"])
|
83
|
+
s.add_runtime_dependency(%q<faraday_middleware>, ["~> 0.6"])
|
84
|
+
s.add_runtime_dependency(%q<hashie>, ["~> 1.0.0"])
|
85
|
+
s.add_runtime_dependency(%q<multi_json>, ["~> 1.0.0"])
|
86
|
+
s.add_runtime_dependency(%q<chronic>, ["~> 0.4.0"])
|
87
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
|
88
|
+
s.add_development_dependency(%q<yard>, ["~> 0.7.0"])
|
89
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
90
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
|
91
|
+
s.add_development_dependency(%q<simplecov>, ["~> 0.4"])
|
92
|
+
s.add_development_dependency(%q<vcr>, ["~> 1.10.0"])
|
93
|
+
s.add_development_dependency(%q<webmock>, ["~> 1.6.0"])
|
94
|
+
else
|
95
|
+
s.add_dependency(%q<faraday>, ["~> 0.6"])
|
96
|
+
s.add_dependency(%q<faraday_middleware>, ["~> 0.6"])
|
97
|
+
s.add_dependency(%q<hashie>, ["~> 1.0.0"])
|
98
|
+
s.add_dependency(%q<multi_json>, ["~> 1.0.0"])
|
99
|
+
s.add_dependency(%q<chronic>, ["~> 0.4.0"])
|
100
|
+
s.add_dependency(%q<rspec>, ["~> 2.6.0"])
|
101
|
+
s.add_dependency(%q<yard>, ["~> 0.7.0"])
|
102
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
103
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
104
|
+
s.add_dependency(%q<simplecov>, ["~> 0.4"])
|
105
|
+
s.add_dependency(%q<vcr>, ["~> 1.10.0"])
|
106
|
+
s.add_dependency(%q<webmock>, ["~> 1.6.0"])
|
107
|
+
end
|
108
|
+
else
|
109
|
+
s.add_dependency(%q<faraday>, ["~> 0.6"])
|
110
|
+
s.add_dependency(%q<faraday_middleware>, ["~> 0.6"])
|
111
|
+
s.add_dependency(%q<hashie>, ["~> 1.0.0"])
|
112
|
+
s.add_dependency(%q<multi_json>, ["~> 1.0.0"])
|
113
|
+
s.add_dependency(%q<chronic>, ["~> 0.4.0"])
|
114
|
+
s.add_dependency(%q<rspec>, ["~> 2.6.0"])
|
115
|
+
s.add_dependency(%q<yard>, ["~> 0.7.0"])
|
116
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
117
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
118
|
+
s.add_dependency(%q<simplecov>, ["~> 0.4"])
|
119
|
+
s.add_dependency(%q<vcr>, ["~> 1.10.0"])
|
120
|
+
s.add_dependency(%q<webmock>, ["~> 1.6.0"])
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'addressable/uri'
|
3
|
+
|
4
|
+
# @private
|
5
|
+
module Faraday
|
6
|
+
# @private
|
7
|
+
class Request::UrlEncodingFix < Faraday::Middleware
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
url = env[:url].to_s
|
11
|
+
url.gsub!(/%3A/, ':')
|
12
|
+
env[:url] = Addressable::URI.parse(url)
|
13
|
+
@app.call(env)
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
|
3
|
+
# @private
|
4
|
+
module Faraday
|
5
|
+
# @private
|
6
|
+
class Response::RaiseHttp4xx < Response::Middleware
|
7
|
+
|
8
|
+
def on_complete(env)
|
9
|
+
case env[:status].to_i
|
10
|
+
when 400
|
11
|
+
raise Genability::BadRequest, error_message(env)
|
12
|
+
when 403
|
13
|
+
raise Genability::Forbidden, error_message(env)
|
14
|
+
when 404
|
15
|
+
raise Genability::NotFound, error_message(env)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def error_message(env)
|
22
|
+
"#{env[:method].to_s.upcase} #{env[:url].to_s} STATUS:#{env[:status]} #{error_body(env[:body])}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def error_body(body)
|
26
|
+
if body.nil?
|
27
|
+
nil
|
28
|
+
else
|
29
|
+
"ERRORS:#{body.count}#{error_details(body)}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def error_details(body)
|
34
|
+
msg = ""
|
35
|
+
body.results.each_with_index do |result, i|
|
36
|
+
msg << " #{i+1}[code:#{result.code} object_name:#{result.objectName} property_name:#{result.propertyName} message:#{result.message}]"
|
37
|
+
end
|
38
|
+
msg
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
|
3
|
+
# @private
|
4
|
+
module Faraday
|
5
|
+
# @private
|
6
|
+
class Response::RaiseHttp5xx < Response::Middleware
|
7
|
+
|
8
|
+
def on_complete(env)
|
9
|
+
case env[:status].to_i
|
10
|
+
when 500
|
11
|
+
raise Genability::ServerError, error_message(env, "Something is wrong on our end. If the problem persists please file a bug report or contact support.")
|
12
|
+
when 503
|
13
|
+
raise Genability::ServiceUnavailable, error_message(env, "The Genability API is down, please try again later.")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def error_message(env, body=nil)
|
20
|
+
"#{env[:method].to_s.upcase} #{env[:url].to_s}: #{[env[:status].to_s + ':', body].compact.join(' ')}"
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
data/lib/genability.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'genability/api'
|
2
|
+
require 'genability/client'
|
3
|
+
require 'genability/configuration'
|
4
|
+
require 'genability/error'
|
5
|
+
require 'mashie_extensions'
|
6
|
+
|
7
|
+
module Genability
|
8
|
+
extend Configuration
|
9
|
+
|
10
|
+
# Alias for Genability::Client.new
|
11
|
+
#
|
12
|
+
# @return [Genability::Client]
|
13
|
+
def self.client(options={})
|
14
|
+
Genability::Client.new(options)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Delegate to Genability::Client
|
18
|
+
def self.method_missing(method, *args, &block)
|
19
|
+
return super unless client.respond_to?(method)
|
20
|
+
client.send(method, *args, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Delegate to Genability::Client
|
24
|
+
def self.respond_to?(method)
|
25
|
+
return client.respond_to?(method) || super
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'genability/configuration'
|
2
|
+
require 'genability/connection'
|
3
|
+
require 'genability/request'
|
4
|
+
#require File.expand_path('../oauth', __FILE__)
|
5
|
+
|
6
|
+
module Genability
|
7
|
+
# @private
|
8
|
+
class API
|
9
|
+
include Connection
|
10
|
+
include Request
|
11
|
+
#include OAuth
|
12
|
+
|
13
|
+
# @private
|
14
|
+
attr_accessor *Configuration::VALID_OPTIONS_KEYS
|
15
|
+
|
16
|
+
# Creates a new API
|
17
|
+
def initialize(options={})
|
18
|
+
options = Genability.options.merge(options)
|
19
|
+
Configuration::VALID_OPTIONS_KEYS.each do |key|
|
20
|
+
send("#{key}=", options[key])
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|