centaman 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4d80df14fdcdad6ee4ad5602bfa88ecd65be2c3
4
- data.tar.gz: 738b8b2fb153a62aeb233232abd323fc42240f7f
3
+ metadata.gz: a4bf3e4c569f27b72696e95c7b5777f82b49598f
4
+ data.tar.gz: 7bce54d011cd6aa3367a05449556dce6de4c9dc7
5
5
  SHA512:
6
- metadata.gz: c46064bb84a4d0737aa342bdf0c5fce614651c9f69b192cbe7e7682b0ec8911659cac84db2f491bda4822b3f3e7fe66121d69488d72d2abb4902b9d10df56ce8
7
- data.tar.gz: bb5c3539b3f5845ed12012f4e23c27844619acd4418a98a16a42558ce6e04959aa1775d197a1b1a70b5ada368300a6d06288836b5b47aa808e95f2e0886f9d3f
6
+ metadata.gz: 69993197b61360d3dbffc891413480b02c523c0928f31cf56e998d2738cb4f60d537fc4f1d51a45cc0cd12e06bba501615164c5d22023f55c76650a59e00cf2e
7
+ data.tar.gz: 3859b49ecbebf8e4d91fe347b16cf4f578e677edaf5cea3e6f171a87620af3a3c7995eed3d089fdbb5d2adda57389446b5a38fd129efd6b5db5265edadfa5587
data/README.md CHANGED
@@ -28,9 +28,9 @@ TODO: Write usage instructions here
28
28
 
29
29
  This gem assumes the following environment variables are defined by the application
30
30
 
31
- - CENTAMAN_API (Centaman API endpoint, ex: https://taxi.centaman.net/CentamanAPI)
32
- - API_USERNAME (Centaman API username)
33
- - API_PASSWORD (Centaman API password)
31
+ - CENTAMAN_API_URL (Centaman API endpoint, ex: https://taxi.centaman.net/CentamanAPI)
32
+ - CENTAMAN_API_USERNAME (Centaman API username)
33
+ - CENTAMAN_API_PASSWORD (Centaman API password)
34
34
  - FIXIE_URL (Optional. Used with FIXIE proxy to route outbound requests through a set of static IP addresses)
35
35
 
36
36
  ## Development
@@ -1,3 +1,4 @@
1
+ require 'httparty'
1
2
  require 'centaman/version'
2
3
  require 'centaman/wrapper'
3
4
  require 'centaman/service'
@@ -24,7 +25,6 @@ require 'centaman/object/extra'
24
25
  require 'centaman/object/gift_ticket'
25
26
  require 'centaman/object/purchased_ticket'
26
27
  require 'centaman/object/ticket_type'
27
- require 'httparty'
28
28
 
29
29
  module Centaman
30
30
  end
@@ -1,3 +1,3 @@
1
1
  module Centaman
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -8,21 +8,22 @@ module Centaman
8
8
  http_proxy FIXIE.host, FIXIE.port, FIXIE.user, FIXIE.password
9
9
  end
10
10
 
11
- attr_reader :api_username, :api_password
11
+ attr_reader :api_username, :api_password, :api_token
12
12
 
13
13
  def initialize(args = {})
14
- @api_username = ENV['API_USERNAME']
15
- @api_password = ENV['API_PASSWORD']
16
- self.class.base_uri ENV['CENTAMAN_API']
14
+ @api_username = ENV['CENTAMAN_API_USERNAME']
15
+ @api_password = ENV['CENTAMAN_API_PASSWORD']
16
+ @api_token = ENV.fetch('CENTAMAN_API_TOKEN', generate_token)
17
+ self.class.base_uri ENV['CENTAMAN_API_URL']
17
18
  after_init(args)
18
19
  end
19
20
 
20
21
  def headers
21
- { 'authorization' => "Basic #{encoded_string}", 'Content-Type' => 'application/json' }
22
+ { 'authorization' => "Basic #{api_token}", 'Content-Type' => 'application/json' }
22
23
  end
23
24
 
24
- def encoded_string
25
- @encoded_string ||= Base64.encode64("#{api_username}:#{api_password}")
25
+ def generate_token
26
+ Base64.encode64("#{api_username}:#{api_password}")
26
27
  end
27
28
 
28
29
  def options
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: centaman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - francirp
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  requirements: []
135
135
  rubyforge_project:
136
- rubygems_version: 2.5.1
136
+ rubygems_version: 2.5.2
137
137
  signing_key:
138
138
  specification_version: 4
139
139
  summary: Wrapper for the Centaman Ticketing API