ticketevolution-ruby 0.7.31 → 0.7.32

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,8 +2,12 @@ require 'faraday/localhost_header'
2
2
 
3
3
  module TicketEvolution
4
4
  class Connection < Base
5
+ DEFAULT_SUBDOMAIN = 'api'
6
+ DEFAULT_URL_BASE = 'ticketevolution.com'
7
+ DEFAULT_PROTOCOL = 'https'
8
+
5
9
  cattr_reader :default_options, :expected_options, :oldest_version_in_service
6
- cattr_accessor :protocol, :url_base, :adapter
10
+ cattr_accessor :protocol, :subdomain, :url_base, :adapter
7
11
 
8
12
  @@oldest_version_in_service = 8
9
13
 
@@ -23,8 +27,9 @@ module TicketEvolution
23
27
  'logger'
24
28
  ]
25
29
 
26
- @@url_base = "ticketevolution.com"
27
- @@protocol = "https"
30
+ @@subdomain = DEFAULT_SUBDOMAIN
31
+ @@url_base = DEFAULT_URL_BASE
32
+ @@protocol = DEFAULT_PROTOCOL
28
33
 
29
34
  @@adapter = :net_http
30
35
 
@@ -46,7 +51,7 @@ module TicketEvolution
46
51
  def url
47
52
  @url ||= [].tap do |parts|
48
53
  parts << TicketEvolution::Connection.protocol
49
- parts << "://api."
54
+ parts << "://#{ TicketEvolution::Connection.subdomain }."
50
55
  parts << "#{@config[:mode]}." if @config[:mode].present? && @config[:mode].to_sym != :production
51
56
  parts << TicketEvolution::Connection.url_base
52
57
  end.join
@@ -1,3 +1,3 @@
1
1
  module TicketEvolution
2
- VERSION = '0.7.31'
2
+ VERSION = '0.7.32'
3
3
  end
@@ -141,6 +141,28 @@ describe TicketEvolution::Connection do
141
141
  end
142
142
  end
143
143
 
144
+ describe ".subdomain" do
145
+ subject { klass.subdomain }
146
+
147
+ after do
148
+ klass.subdomain = TicketEvolution::Connection::DEFAULT_SUBDOMAIN
149
+ end
150
+
151
+ it { should == "api" }
152
+
153
+ it "should allow modification of the subdomain" do
154
+ klass.subdomain = 'asdf'
155
+ klass.subdomain.should == 'asdf'
156
+ end
157
+
158
+ it "should use the subdomain in the URL" do
159
+ klass.subdomain = 'new-api'
160
+ c = klass.new(basic_options)
161
+
162
+ c.url.should match(/new-api/)
163
+ end
164
+ end
165
+
144
166
  describe ".url_base" do
145
167
  subject { klass.url_base }
146
168
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ticketevolution-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.31
4
+ version: 0.7.32
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -420,9 +420,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
420
420
  - - ! '>='
421
421
  - !ruby/object:Gem::Version
422
422
  version: '0'
423
- segments:
424
- - 0
425
- hash: -4363082675175179634
426
423
  required_rubygems_version: !ruby/object:Gem::Requirement
427
424
  none: false
428
425
  requirements: