ruby-montage 1.0.0 → 1.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e3dfa2aad01ef822edd6bc91a7b316694912d0f
4
- data.tar.gz: 08a3fc32a12b85d0144b8be7855c01cdd2a2d4b6
3
+ metadata.gz: 19af8eb700ad25dbe263925210cbef5ba33706ce
4
+ data.tar.gz: b8a16d26ef94490a98a9edf8f84a004baa099f4e
5
5
  SHA512:
6
- metadata.gz: 4b7a79943fbca4d1ca5b7bcf1abc72e9383881a6def914937dc9c6aad289e396a45d3458c39ee6620dcf68829ee05fe37f13ff7b8d96d1c353c36e3665448454
7
- data.tar.gz: a1cc37f0d95359cefaab29a32a6b51fcacb717df19e486df23c1780651a684d743330415d595a6a5f02d6526daeebe3d8441a575a39c7367e919161fd75e0759
6
+ metadata.gz: c581ceddddbb15fbbbd81f48581a82976511117f13f5f255b501d43e0ced7c05e652743db0212a81b7cff5c9f5c3ae3a3efc6371e0f72453a54119c8b83e341a
7
+ data.tar.gz: d36fb3e6f5f25d9824ee073e67115da38268a5b732a59637525efddfa96c045f5e4311d29fd3755c7bcc1256f41367347ef9b7984f32bd82f43ef6314a04d3d7
@@ -18,7 +18,8 @@ module Montage
18
18
  :password,
19
19
  :domain,
20
20
  :api_version,
21
- :environment
21
+ :environment,
22
+ :test_url
22
23
 
23
24
  # Initializes the client instance
24
25
  #
@@ -29,12 +30,14 @@ module Montage
29
30
  # - +domain+ -> Project subdomain, required for initialization
30
31
  # - +api_version+ -> API version to query against, defaults to 1
31
32
  # - +environment+ -> Specifies desired environment for requests, defaults
32
- # to 'production'. Valid options are 'development' and 'production'.
33
+ # to 'production'. Valid options are 'development', 'production', and 'test'.
34
+ # - +test_url+ -> Test URL. Required when environment is set to 'test'.
33
35
  # * *Returns* :
34
36
  # - A valid Montage::Client instance
35
37
  # * *Raises* :
36
38
  # - +MissingAttributeError+ -> If the domain attribute is not specified
37
39
  # - +InvalidEnvironment+ -> If the environment attribute is not set to 'production' or 'development'
40
+ # - +MissingAttributeError+ -> If the test_url is not provided when environment is 'test'
38
41
  #
39
42
  def initialize
40
43
  @api_version = 1
@@ -42,6 +45,7 @@ module Montage
42
45
  yield(self) if block_given?
43
46
  fail MissingAttributeError, "You must declare the domain attribute" unless @domain
44
47
  fail InvalidEnvironment, "Valid options are 'production' and 'development'" unless environment_valid?
48
+ fail MissingAttributeError, "You must include a test_url for the 'test' environment" unless test_environment_valid?
45
49
  end
46
50
 
47
51
  # Verifies the Montage::Client instance environment
@@ -50,7 +54,17 @@ module Montage
50
54
  # - A boolean
51
55
  #
52
56
  def environment_valid?
53
- %w(production development).include?(@environment)
57
+ %w(test production development).include?(@environment)
58
+ end
59
+
60
+ # Verifies that the test_url is supplied when the environment is set to test
61
+ #
62
+ # * *Returns* :
63
+ # - A boolean
64
+ #
65
+ def test_environment_valid?
66
+ return true unless @environment == "test"
67
+ !!@test_url
54
68
  end
55
69
 
56
70
  # Generates a base url for requests using the supplied environment and domain
@@ -59,8 +73,11 @@ module Montage
59
73
  # - A string containing the constructed url
60
74
  #
61
75
  def default_url_prefix
62
- return "https://#{domain}.dev.montagehot.club" if @environment == "development"
63
- return "https://#{domain}.mntge.com" if @environment == "production"
76
+ case @environment
77
+ when "development" then "https://#{domain}.dev.montagehot.club"
78
+ when "production" then "https://#{domain}.mntge.com"
79
+ when "test" then @test_url
80
+ end
64
81
  end
65
82
 
66
83
  # Attempts to authenticate with the Montage API
@@ -1,3 +1,3 @@
1
1
  module Montage
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-montage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dphaener
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-01 00:00:00.000000000 Z
11
+ date: 2016-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler