tam 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/README.mkd +58 -0
- data/Rakefile +31 -0
- data/lib/tam/api/location.rb +26 -0
- data/lib/tam/api/oauth.rb +55 -0
- data/lib/tam/api/sms.rb +41 -0
- data/lib/tam/api.rb +73 -0
- data/lib/tam/configuration.rb +83 -0
- data/lib/tam/error.rb +40 -0
- data/lib/tam/railtie.rb +30 -0
- data/lib/tam/user.rb +12 -0
- data/lib/tam/version.rb +4 -0
- data/lib/tam.rb +17 -0
- data/tam.gemspec +38 -0
- metadata +142 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Nokia Siemens Networks
|
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.mkd
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
The telco asset marketplace Ruby gem
|
2
|
+
====================================
|
3
|
+
A Ruby wrapper for the Telco Asset Marketplace REST APIs
|
4
|
+
|
5
|
+
Installation
|
6
|
+
------------
|
7
|
+
gem install tam
|
8
|
+
|
9
|
+
Documentation
|
10
|
+
-------------
|
11
|
+
<https://code.telcoassetmarketplace.com>
|
12
|
+
|
13
|
+
How to Use
|
14
|
+
----------
|
15
|
+
If you are using rails then:
|
16
|
+
|
17
|
+
1. Add the tam gem to your Gemfile
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'tam'
|
21
|
+
```
|
22
|
+
|
23
|
+
2. Create a tam.yml file in config with following contents:
|
24
|
+
|
25
|
+
```yaml
|
26
|
+
development: &defaults
|
27
|
+
consumer_key: # the consumer key generated in telcoassetmarketplace.com for you application
|
28
|
+
consumer_secret: # the consumer secret generated in telcoassetmarketplace.com for you application
|
29
|
+
consumer_handler: # the of the class that implements the telcoassetmarketplace handler logic
|
30
|
+
test:
|
31
|
+
<<: *defaults
|
32
|
+
production:
|
33
|
+
<<: *defaults
|
34
|
+
```
|
35
|
+
|
36
|
+
3. Add following route to your routes.rb
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
match '/tamapi/(:string)' => TAM::API # you can replace 'tamapi' with any other namespace
|
40
|
+
```
|
41
|
+
|
42
|
+
4. Implement the telcoassetmarketplace handler logic (e.g.: tam_handler.rb in helpers)
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
class TamHandler
|
46
|
+
def authorized(user, session)
|
47
|
+
# should return the URL to which telcoassermarketplace should redirect
|
48
|
+
end
|
49
|
+
|
50
|
+
def denied(session)
|
51
|
+
# should return the URL to which telcoassermarketplace should redirect
|
52
|
+
end
|
53
|
+
|
54
|
+
def receive_sms(from_user, to_app, body)
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
begin
|
2
|
+
require "bundler"
|
3
|
+
Bundler.setup
|
4
|
+
rescue LoadError
|
5
|
+
$stderr.puts "You need to have Bundler installed to be able build this gem."
|
6
|
+
end
|
7
|
+
|
8
|
+
gemspec = eval(File.read(Dir["*.gemspec"].first))
|
9
|
+
|
10
|
+
|
11
|
+
desc "Validate the gemspec"
|
12
|
+
task :gemspec do
|
13
|
+
gemspec.validate
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Build gem locally"
|
17
|
+
task :build => :gemspec do
|
18
|
+
system "gem build #{gemspec.name}.gemspec"
|
19
|
+
FileUtils.mkdir_p "pkg"
|
20
|
+
FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", "pkg"
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Install gem locally"
|
24
|
+
task :install => :build do
|
25
|
+
system "gem install pkg/#{gemspec.name}-#{gemspec.version}"
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "Clean automatically generated files"
|
29
|
+
task :clean do
|
30
|
+
FileUtils.rm_rf "pkg"
|
31
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'tam/user'
|
3
|
+
require 'tam/error'
|
4
|
+
|
5
|
+
# SMS part of the telco asset marketplace REST API
|
6
|
+
module TAM
|
7
|
+
class API
|
8
|
+
# Find the location (coordinates) of a user
|
9
|
+
#
|
10
|
+
# @return [Hash]
|
11
|
+
# {"body"=>
|
12
|
+
# {"latitude"=>51.618,
|
13
|
+
# "timestamp"=>1302185772456,
|
14
|
+
# "accuracy"=>100,
|
15
|
+
# "longitude"=>23.9063},
|
16
|
+
# "status"=>{"code"=>0, "message"=>"Request was handled succesfully"}}
|
17
|
+
def self.getcoord(user)
|
18
|
+
begin
|
19
|
+
response = dispatch_to_tam(:get, '/api/1/location/getcoord', user)
|
20
|
+
JSON.parse response
|
21
|
+
rescue TAM::ServiceUnavailable
|
22
|
+
raise TAM::ServiceUnavailable.new 'The location service is not available. If you are using the service on a persona, i.e.: through the sandbox, then remember to set the location of the persona'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'sinatra'
|
2
|
+
require 'oauth'
|
3
|
+
require 'tam/error'
|
4
|
+
require 'tam/user'
|
5
|
+
|
6
|
+
# OAUTH part of the telco asset marketplace REST API
|
7
|
+
module TAM
|
8
|
+
class API
|
9
|
+
enable :sessions
|
10
|
+
|
11
|
+
# Authorizes a user of telco asset marketplace to use your application
|
12
|
+
# After the OAUTH flow is finished then the configured consumer_handler.authorized(user, session)
|
13
|
+
# or consumer_handler.denied(session) are invoked
|
14
|
+
get '/*/authorize' do
|
15
|
+
consumer = TAM::API.create_oauth_consumer
|
16
|
+
request_token = consumer.get_request_token
|
17
|
+
session[:request_token] = request_token
|
18
|
+
|
19
|
+
oauth_callback_url = url('/' + TAM.callback_path + '/oauth_callback')
|
20
|
+
redirect request_token.authorize_url(:oauth_callback => oauth_callback_url)
|
21
|
+
end
|
22
|
+
|
23
|
+
# OAUTH callback for telco asset marketplace
|
24
|
+
# @private
|
25
|
+
get '/*/oauth_callback' do
|
26
|
+
if params[:denied].nil?
|
27
|
+
consumer = TAM::API.create_oauth_consumer
|
28
|
+
request_token = session[:request_token]
|
29
|
+
verifier = params[:oauth_verifier]
|
30
|
+
access_token = request_token.get_access_token(:oauth_verifier => verifier)
|
31
|
+
user = User.new(access_token.token, access_token.secret)
|
32
|
+
redirect dispatch_to_handler('authorized', user, session)
|
33
|
+
else
|
34
|
+
redirect dispatch_to_handler('denied', session)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
def self.create_oauth_consumer
|
40
|
+
if TAM.consumer_key.nil? or TAM.consumer_secret.nil?
|
41
|
+
raise OAuthConsumerAttributesMissing.new
|
42
|
+
end
|
43
|
+
|
44
|
+
OAuth::Consumer.new(TAM.consumer_key, TAM.consumer_secret,
|
45
|
+
{
|
46
|
+
:site => TAM.site,
|
47
|
+
:request_token_path => TAM.request_token_path,
|
48
|
+
:access_token_path => TAM.access_token_path,
|
49
|
+
:authorize_path => TAM.authorize_path,
|
50
|
+
:scheme => TAM.oauth_scheme,
|
51
|
+
:http_method => TAM.oauth_http_method
|
52
|
+
})
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/tam/api/sms.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'sinatra'
|
2
|
+
require 'oauth'
|
3
|
+
require 'json'
|
4
|
+
require 'tam/user'
|
5
|
+
|
6
|
+
# SMS part of the telco asset marketplace REST API
|
7
|
+
module TAM
|
8
|
+
class API
|
9
|
+
# URL handler for receiving SMS
|
10
|
+
# After receiving an SMS, the configured
|
11
|
+
# consumer_handler.receive_sms(from_user, to_app, body)
|
12
|
+
# is invoked
|
13
|
+
#
|
14
|
+
# @private
|
15
|
+
post "/*/receive_sms" do
|
16
|
+
request.body.rewind # in case someone already read it
|
17
|
+
|
18
|
+
data = JSON.parse request.body.read
|
19
|
+
|
20
|
+
access_token = data["access_token"]
|
21
|
+
token_secret = data["token_secret"]
|
22
|
+
from_user = User.new(access_token, token_secret)
|
23
|
+
to_app = data["to"]
|
24
|
+
body = data["body"]
|
25
|
+
begin
|
26
|
+
dispatch_to_handler('receive_sms', from_user, to_app, body)
|
27
|
+
response.status = 200
|
28
|
+
return ''
|
29
|
+
rescue Error => error
|
30
|
+
response.status = 500
|
31
|
+
return error.message
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Sends an SMS
|
36
|
+
def self.send_sms(from_app, to_user, body)
|
37
|
+
payload = JSON.generate({'body' => body, 'from' => from_app})
|
38
|
+
dispatch_to_tam(:post, '/api/1/sms/send', to_user, payload)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/tam/api.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'sinatra'
|
2
|
+
require 'oauth'
|
3
|
+
require 'tam/error'
|
4
|
+
require 'tam/user'
|
5
|
+
|
6
|
+
module TAM
|
7
|
+
# Wrapper for the telco asset marketplace REST API
|
8
|
+
#
|
9
|
+
# @note All methods have been separated into modules and follow the same grouping used in {https://code.telcoassetmarketplace.com the telco asset marketplace API Documentation}.
|
10
|
+
# @see http://code.telcoassetmarketplace.com
|
11
|
+
class API < Sinatra::Base
|
12
|
+
# Require api method modules after initializing the API class in
|
13
|
+
# order to avoid a superclass mismatch error, allowing those modules to be
|
14
|
+
# API-namespaced.
|
15
|
+
require 'tam/api/oauth'
|
16
|
+
require 'tam/api/sms'
|
17
|
+
require 'tam/api/location'
|
18
|
+
|
19
|
+
# Dispatches the request to the telco asset marketplace handler configured by
|
20
|
+
# this gem client
|
21
|
+
def dispatch_to_handler(method, *args)
|
22
|
+
if TAM.consumer_handler.nil?
|
23
|
+
LOGGER.error 'Application has not configured the telco asset marketplace consumer_handler'
|
24
|
+
raise InvalidConsumerHandler.new 'Application has not configured the telco asset marketplace consumer_handler'
|
25
|
+
end
|
26
|
+
|
27
|
+
if TAM.consumer_handler.respond_to?(method)
|
28
|
+
begin
|
29
|
+
return TAM.consumer_handler.send(method, *args)
|
30
|
+
rescue TAM::Error => error
|
31
|
+
LOGGER.error 'Application has suffered an internal error: ' + error.message + ', ' + error.body
|
32
|
+
raise error
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
# Dispatches the request to the telco asset marketplace REST API
|
39
|
+
def self.dispatch_to_tam(http_method, endpoint, user, payload='')
|
40
|
+
consumer = create_oauth_consumer
|
41
|
+
access_token = OAuth::AccessToken.new(consumer, user.access_token, user.token_secret)
|
42
|
+
|
43
|
+
if (http_method == :get)
|
44
|
+
response = access_token.send(http_method, endpoint, {'Content-Type' => 'application/json'})
|
45
|
+
else
|
46
|
+
response = access_token.send(http_method, endpoint, payload, {'Content-Type' => 'application/json'})
|
47
|
+
end
|
48
|
+
|
49
|
+
if response.class == Net::HTTPOK
|
50
|
+
return response.body
|
51
|
+
elsif response.class == Net::HTTPUnauthorized
|
52
|
+
LOGGER.error 'Request not authorized ' + response.message + ', ' + response.body
|
53
|
+
raise RequestNotAuthorized.new(response.message, response.body)
|
54
|
+
elsif response.class == Net::HTTPBadRequest
|
55
|
+
if response.body.include? 'consumer_key_unknown'
|
56
|
+
LOGGER.error 'Configured telco asset marketplace consumer_key is not valid: ' + response.message + ', ' + response.body
|
57
|
+
raise InvalidConsumerKey.new(response.message, response.body)
|
58
|
+
elsif response.body.include? 'signature_invalid'
|
59
|
+
LOGGER.error 'Configured telco asset marketplace consumer_secret is not valid: ' + response.message + ', ' + response.body
|
60
|
+
raise InvalidConsumerSecret.new(response.message, response.body)
|
61
|
+
else
|
62
|
+
raise UnexpectedError.new(response.message, response.body)
|
63
|
+
end
|
64
|
+
elsif response.class == Net::HTTPServiceUnavailable
|
65
|
+
LOGGER.error 'telco asset marketplace service ' + endpoint + ' not available'
|
66
|
+
raise ServiceUnavailable.new(response.message, response.body)
|
67
|
+
else
|
68
|
+
raise UnexpectedError.new(response.message, response.body)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module TAM
|
2
|
+
# Defines constants and methods related to configuration
|
3
|
+
module Configuration
|
4
|
+
# An array of valid keys in the options hash when configuring a {TAM::API}
|
5
|
+
VALID_OPTIONS_KEYS = [
|
6
|
+
:consumer_key,
|
7
|
+
:consumer_secret,
|
8
|
+
:consumer_handler,
|
9
|
+
:site,
|
10
|
+
:request_token_path,
|
11
|
+
:access_token_path,
|
12
|
+
:authorize_path,
|
13
|
+
:oauth_scheme,
|
14
|
+
:oauth_http_method,
|
15
|
+
:callback_path].freeze
|
16
|
+
|
17
|
+
# @private
|
18
|
+
attr_accessor *VALID_OPTIONS_KEYS
|
19
|
+
|
20
|
+
def consumer_handler=(consumer_handler)
|
21
|
+
if consumer_handler.class == String
|
22
|
+
begin
|
23
|
+
@consumer_handler = Object.const_get(consumer_handler).new
|
24
|
+
rescue NameError => error
|
25
|
+
LOGGER.error 'Application has provided an invalid telco asset marketplace consumer_handler: ' + TAM.consumer_handler
|
26
|
+
raise InvalidConsumerHandler.new 'Application has provided an invalid telco asset marketplace consumer_handler: ' + TAM.consumer_handler
|
27
|
+
end
|
28
|
+
else
|
29
|
+
@consumer_handler = consumer_handler
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def consumer_handler
|
34
|
+
@consumer_handler
|
35
|
+
end
|
36
|
+
|
37
|
+
# When this module is extended, set all configuration options to their default values
|
38
|
+
def self.extended(base)
|
39
|
+
base.reset
|
40
|
+
end
|
41
|
+
|
42
|
+
# Convenience method to allow configuration options to be set in a block
|
43
|
+
def configure
|
44
|
+
yield self
|
45
|
+
end
|
46
|
+
|
47
|
+
def configure(config)
|
48
|
+
unless config.empty?
|
49
|
+
self.consumer_key = config['consumer_key'] if config['consumer_key']
|
50
|
+
self.consumer_secret = config['consumer_secret'] if config['consumer_secret']
|
51
|
+
self.consumer_handler = config['consumer_handler'] if config['consumer_handler']
|
52
|
+
self.site = config['site'] if config['site']
|
53
|
+
self.request_token_path = config['request_token_path'] if config['request_token_path']
|
54
|
+
self.access_token_path = config['access_token_path'] if config['access_token_path']
|
55
|
+
self.authorize_path = config['authorize_path'] if config['authorize_path']
|
56
|
+
self.oauth_scheme = config['oauth_scheme'] if config['oauth_scheme']
|
57
|
+
self.oauth_http_method = config['oauth_http_method'] if config['oauth_http_method']
|
58
|
+
self.callback_path = config['callback_path'] if config['callback_path']
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Create a hash of options and their values
|
63
|
+
def options
|
64
|
+
Hash[VALID_OPTIONS_KEYS.map {|key| [key, send(key)] }]
|
65
|
+
end
|
66
|
+
|
67
|
+
# Reset all configuration options to defaults
|
68
|
+
def reset
|
69
|
+
self.consumer_key = nil
|
70
|
+
self.consumer_secret = nil
|
71
|
+
self.consumer_handler = nil
|
72
|
+
self.site = 'https://telcoassetmarketplace.com'
|
73
|
+
self.request_token_path = '/api/1/oauth/request_token'
|
74
|
+
self.access_token_path = '/api/1/oauth/access_token'
|
75
|
+
self.authorize_path = '/web/authorize'
|
76
|
+
self.oauth_scheme = :query_string
|
77
|
+
self.oauth_http_method = :get
|
78
|
+
self.callback_path = 'tamapi'
|
79
|
+
self
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
data/lib/tam/error.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
module TAM
|
2
|
+
# Custom error class for rescuing from all telco asset marketplace errors
|
3
|
+
class Error < StandardError
|
4
|
+
attr_reader :body
|
5
|
+
|
6
|
+
def initialize(message, body = '')
|
7
|
+
@body = body
|
8
|
+
super message
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# Raised when client tries to use any of the API methods that require OAUTH
|
13
|
+
# without configuring the consumer_key or consumer_secret
|
14
|
+
class OAuthConsumerAttributesMissing < Error
|
15
|
+
def initialize
|
16
|
+
super 'consumer_key or consumer_secret not configured'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Raised when client tries to use any of the API methods without user authorization
|
21
|
+
class RequestNotAuthorized < Error; end
|
22
|
+
|
23
|
+
# Raised when client performs a wrong OAUTH interaction (this is a super-class)
|
24
|
+
class OAuthError < Error; end
|
25
|
+
|
26
|
+
# Raised when client is using an invalid consumer_key
|
27
|
+
class InvalidConsumerKey < OAuthError; end
|
28
|
+
|
29
|
+
# Raised when client is using an invalid consumer_secret
|
30
|
+
class InvalidConsumerSecret < OAuthError; end
|
31
|
+
|
32
|
+
# Raised when client is using an invalid consumer_handler
|
33
|
+
class InvalidConsumerHandler < Error; end
|
34
|
+
|
35
|
+
class UnexpectedError < Error; end
|
36
|
+
|
37
|
+
# Raised when one of the telco asset marketplace services is not available
|
38
|
+
class ServiceUnavailable < Error; end
|
39
|
+
end
|
40
|
+
|
data/lib/tam/railtie.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
module TAM
|
4
|
+
class TamRailtie < Rails::Railtie
|
5
|
+
initializer "tam.boot" do
|
6
|
+
configure_with_yaml
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
# Attempts to load the telco asset marketplace configuration from config/tam.yml
|
12
|
+
# in a rails 3 application.
|
13
|
+
# Besides using a tam.yml, developers can also configure directly TAM settings, e.g.:
|
14
|
+
# TAM.consumer_key = 'h42woy35tl08o44l'
|
15
|
+
def configure_with_yaml
|
16
|
+
cfg = load_config(File.join(Rails.root, 'config', 'tam.yml')).freeze
|
17
|
+
TAM.configure(cfg)
|
18
|
+
end
|
19
|
+
|
20
|
+
def load_config(yaml_file)
|
21
|
+
return {} unless File.exist?(yaml_file)
|
22
|
+
cfg = YAML::load(File.open(yaml_file))
|
23
|
+
if defined? Rails
|
24
|
+
cfg = cfg[Rails.env]
|
25
|
+
end
|
26
|
+
cfg
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
data/lib/tam/user.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
module TAM
|
2
|
+
# Represents an end-user of telco asset marketplace (a subscriber)
|
3
|
+
class User
|
4
|
+
attr_accessor :access_token
|
5
|
+
attr_accessor :token_secret
|
6
|
+
|
7
|
+
def initialize(access_token, token_secret)
|
8
|
+
@access_token = access_token
|
9
|
+
@token_secret = token_secret
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/tam/version.rb
ADDED
data/lib/tam.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'tam/railtie' if defined? ::Rails::Railtie
|
2
|
+
require 'tam/configuration'
|
3
|
+
require 'tam/api'
|
4
|
+
|
5
|
+
module TAM
|
6
|
+
extend Configuration
|
7
|
+
|
8
|
+
# If in rails environment then we use the rails default logger
|
9
|
+
# otherwise we create one that points to the standard output
|
10
|
+
LOGGER =
|
11
|
+
if defined? Rails
|
12
|
+
RAILS_DEFAULT_LOGGER
|
13
|
+
else
|
14
|
+
Logger.new(STDOUT)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
data/tam.gemspec
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# coding: UTF-8
|
2
|
+
require File.expand_path('../lib/tam/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.add_runtime_dependency('sinatra', '~> 1.2.1')
|
6
|
+
s.add_runtime_dependency('json', '~> 1.5')
|
7
|
+
s.add_runtime_dependency('oauth', '~> 0.4.3')
|
8
|
+
|
9
|
+
s.name = "tam"
|
10
|
+
s.version = TAM::VERSION.dup
|
11
|
+
s.platform = Gem::Platform::RUBY
|
12
|
+
s.authors = ["Carlos Manzanares"]
|
13
|
+
s.email = ["developers@telcoassetmarketplace.com"]
|
14
|
+
s.homepage = "https://github.com/tamdeveloper/telco-asset-marketplace-gem"
|
15
|
+
s.description = %q{The Ruby gem for the telco asset marketplace REST APIs}
|
16
|
+
s.summary = "telco asset marketplace Ruby gem"
|
17
|
+
s.rubyforge_project = s.name
|
18
|
+
|
19
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if s.respond_to? :required_rubygems_version=
|
20
|
+
|
21
|
+
s.require_path = 'lib'
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
+
s.files = `git ls-files`.split("\n")
|
24
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
|
+
|
26
|
+
s.post_install_message =<<eos
|
27
|
+
********************************************************************************
|
28
|
+
|
29
|
+
Visit our community pages for up-to-date information on
|
30
|
+
telco asset marketplace:
|
31
|
+
https://code.telcoassetmarketplace.com/
|
32
|
+
Notice that in order to use this gem you will also need to register as a
|
33
|
+
developer in telco asset marketplace:
|
34
|
+
https://telcoassetmarketplace.com
|
35
|
+
|
36
|
+
********************************************************************************
|
37
|
+
eos
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tam
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Carlos Manzanares
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-06-06 00:00:00 +03:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: sinatra
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 29
|
31
|
+
segments:
|
32
|
+
- 1
|
33
|
+
- 2
|
34
|
+
- 1
|
35
|
+
version: 1.2.1
|
36
|
+
requirement: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: json
|
39
|
+
type: :runtime
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 5
|
47
|
+
segments:
|
48
|
+
- 1
|
49
|
+
- 5
|
50
|
+
version: "1.5"
|
51
|
+
requirement: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: oauth
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 9
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
- 4
|
65
|
+
- 3
|
66
|
+
version: 0.4.3
|
67
|
+
requirement: *id003
|
68
|
+
description: The Ruby gem for the telco asset marketplace REST APIs
|
69
|
+
email:
|
70
|
+
- developers@telcoassetmarketplace.com
|
71
|
+
executables: []
|
72
|
+
|
73
|
+
extensions: []
|
74
|
+
|
75
|
+
extra_rdoc_files: []
|
76
|
+
|
77
|
+
files:
|
78
|
+
- .gitignore
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE
|
81
|
+
- README.mkd
|
82
|
+
- Rakefile
|
83
|
+
- lib/tam.rb
|
84
|
+
- lib/tam/api.rb
|
85
|
+
- lib/tam/api/location.rb
|
86
|
+
- lib/tam/api/oauth.rb
|
87
|
+
- lib/tam/api/sms.rb
|
88
|
+
- lib/tam/configuration.rb
|
89
|
+
- lib/tam/error.rb
|
90
|
+
- lib/tam/railtie.rb
|
91
|
+
- lib/tam/user.rb
|
92
|
+
- lib/tam/version.rb
|
93
|
+
- tam.gemspec
|
94
|
+
has_rdoc: true
|
95
|
+
homepage: https://github.com/tamdeveloper/telco-asset-marketplace-gem
|
96
|
+
licenses: []
|
97
|
+
|
98
|
+
post_install_message: |
|
99
|
+
********************************************************************************
|
100
|
+
|
101
|
+
Visit our community pages for up-to-date information on
|
102
|
+
telco asset marketplace:
|
103
|
+
https://code.telcoassetmarketplace.com/
|
104
|
+
Notice that in order to use this gem you will also need to register as a
|
105
|
+
developer in telco asset marketplace:
|
106
|
+
https://telcoassetmarketplace.com
|
107
|
+
|
108
|
+
********************************************************************************
|
109
|
+
|
110
|
+
rdoc_options: []
|
111
|
+
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
hash: 3
|
120
|
+
segments:
|
121
|
+
- 0
|
122
|
+
version: "0"
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
hash: 23
|
129
|
+
segments:
|
130
|
+
- 1
|
131
|
+
- 3
|
132
|
+
- 6
|
133
|
+
version: 1.3.6
|
134
|
+
requirements: []
|
135
|
+
|
136
|
+
rubyforge_project: tam
|
137
|
+
rubygems_version: 1.3.7
|
138
|
+
signing_key:
|
139
|
+
specification_version: 3
|
140
|
+
summary: telco asset marketplace Ruby gem
|
141
|
+
test_files: []
|
142
|
+
|