deployment-tracker-client 0.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.
@@ -0,0 +1,78 @@
1
+ require 'logger'
2
+ require 'json'
3
+
4
+ module SwaggerClient
5
+ module Swagger
6
+ class << self
7
+ attr_accessor :logger
8
+
9
+ # A Swagger configuration object. Must act like a hash and return sensible
10
+ # values for all Swagger configuration options. See Swagger::Configuration.
11
+ attr_accessor :configuration
12
+
13
+ attr_accessor :resources
14
+
15
+ # Call this method to modify defaults in your initializers.
16
+ #
17
+ # @example
18
+ # Swagger.configure do |config|
19
+ # config.api_key['api_key'] = '1234567890abcdef' # api key authentication
20
+ # config.username = 'wordlover' # http basic authentication
21
+ # config.password = 'i<3words' # http basic authentication
22
+ # config.format = 'json' # optional, defaults to 'json'
23
+ # end
24
+ #
25
+ def configure
26
+ yield(configuration) if block_given?
27
+
28
+ # Configure logger. Default to use Rails
29
+ self.logger ||= configuration.logger || (defined?(Rails) ? Rails.logger : Logger.new(STDOUT))
30
+
31
+ # remove :// from scheme
32
+ configuration.scheme.sub!(/:\/\//, '')
33
+
34
+ # remove http(s):// and anything after a slash
35
+ configuration.host.sub!(/https?:\/\//, '')
36
+ configuration.host = configuration.host.split('/').first
37
+
38
+ # Add leading and trailing slashes to base_path
39
+ configuration.base_path = "/#{configuration.base_path}".gsub(/\/+/, '/')
40
+ configuration.base_path = "" if configuration.base_path == "/"
41
+ end
42
+
43
+ def authenticated?
44
+ Swagger.configuration.auth_token.present?
45
+ end
46
+
47
+ def de_authenticate
48
+ Swagger.configuration.auth_token = nil
49
+ end
50
+
51
+ def authenticate
52
+ return if Swagger.authenticated?
53
+
54
+ if Swagger.configuration.username.blank? || Swagger.configuration.password.blank?
55
+ raise ClientError, "Username and password are required to authenticate."
56
+ end
57
+
58
+ request = Swagger::Request.new(
59
+ :get,
60
+ "account/authenticate/{username}",
61
+ :params => {
62
+ :username => Swagger.configuration.username,
63
+ :password => Swagger.configuration.password
64
+ }
65
+ )
66
+
67
+ response_body = request.response.body
68
+ Swagger.configuration.auth_token = response_body['token']
69
+ end
70
+ end
71
+ end
72
+
73
+ class ServerError < StandardError
74
+ end
75
+
76
+ class ClientError < StandardError
77
+ end
78
+ end
@@ -0,0 +1,12 @@
1
+ # Swagger common files
2
+ require_relative 'swagger_client/monkey'
3
+ require_relative 'swagger_client/swagger'
4
+ require_relative 'swagger_client/swagger/configuration'
5
+ require_relative 'swagger_client/swagger/request'
6
+ require_relative 'swagger_client/swagger/response'
7
+ require_relative 'swagger_client/swagger/version'
8
+
9
+ module SwaggerClient
10
+ # Initialize the default configuration
11
+ Swagger.configuration ||= Swagger::Configuration.new
12
+ end
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: deployment-tracker-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Cimpress MCP Infrastructure
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: typhoeus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.2'
20
+ - - '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 0.2.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '0.2'
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 0.2.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: addressable
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: '2.2'
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: 2.2.4
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ~>
48
+ - !ruby/object:Gem::Version
49
+ version: '2.2'
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: 2.2.4
53
+ - !ruby/object:Gem::Dependency
54
+ name: json
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ version: '1.4'
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 1.4.6
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '1.4'
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: 1.4.6
73
+ - !ruby/object:Gem::Dependency
74
+ name: bundler
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ version: '1.6'
80
+ type: :development
81
+ prerelease: false
82
+ version_requirements: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ~>
85
+ - !ruby/object:Gem::Version
86
+ version: '1.6'
87
+ - !ruby/object:Gem::Dependency
88
+ name: rake
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '10.0'
94
+ type: :development
95
+ prerelease: false
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ~>
99
+ - !ruby/object:Gem::Version
100
+ version: '10.0'
101
+ description:
102
+ email:
103
+ - mcp_infrastructure@cimpress.com
104
+ executables: []
105
+ extensions: []
106
+ extra_rdoc_files: []
107
+ files:
108
+ - .gitignore
109
+ - Gemfile
110
+ - LICENSE.txt
111
+ - README.md
112
+ - Rakefile
113
+ - codegen_conf.json
114
+ - deployment-tracker-client.rb.gemspec
115
+ - examples/basic.rb
116
+ - lib/deployment-tracker-client.rb
117
+ - lib/deployment-tracker-client/api/default_api.rb
118
+ - lib/deployment-tracker-client/models/base_object.rb
119
+ - lib/deployment-tracker-client/models/deployment.rb
120
+ - lib/deployment-tracker-client/models/error_response.rb
121
+ - lib/deployment-tracker-client/models/log_message.rb
122
+ - lib/deployment-tracker-client/models/object_response.rb
123
+ - lib/deployment-tracker-client/models/server.rb
124
+ - lib/deployment-tracker-client/version.rb
125
+ - lib/swagger_client.rb
126
+ - lib/swagger_client/monkey.rb
127
+ - lib/swagger_client/swagger.rb
128
+ - lib/swagger_client/swagger/configuration.rb
129
+ - lib/swagger_client/swagger/request.rb
130
+ - lib/swagger_client/swagger/response.rb
131
+ - lib/swagger_client/swagger/version.rb
132
+ homepage: https://github.com/Cimpress-MCP/deployment-tracker-client.rb
133
+ licenses:
134
+ - Apache 2
135
+ metadata: {}
136
+ post_install_message:
137
+ rdoc_options: []
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - '>='
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ required_rubygems_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ requirements: []
151
+ rubyforge_project:
152
+ rubygems_version: 2.0.14
153
+ signing_key:
154
+ specification_version: 4
155
+ summary: Ruby API client for deployment-tracker
156
+ test_files: []