ticket_abstractor_client 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -25,8 +25,15 @@ Or install it yourself as:
25
25
  Initialize:
26
26
 
27
27
  require 'ticket_abstractor_client'
28
+
29
+ without security token:
30
+
28
31
  client = TicketAbstractorClient.initialize_client('http://ticket.abstractor.url')
29
32
 
33
+ with security token:
34
+
35
+ client = TicketAbstractorClient.initialize_client('http://ticket.abstractor.url', 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3')
36
+
30
37
  Access clients:
31
38
 
32
39
  client.jira
@@ -1,17 +1,18 @@
1
1
  class TicketAbstractorClient::Client
2
- def initialize(base_url)
2
+ def initialize(base_url, security_token = nil)
3
3
  @base_url = base_url
4
+ @security_token = security_token
4
5
  end
5
6
 
6
7
  def get(url, args = {}, params = {})
7
- params.merge! args: args.to_json
8
+ params.merge! args: args.to_json, security_token: @security_token
8
9
  response = RestClient.get("#{@base_url}/#{url}", params: params)
9
10
 
10
11
  JSON.parse response
11
12
  end
12
13
 
13
14
  def post(url, args = {}, params = {})
14
- params.merge! args: args.to_json
15
+ params.merge! args: args.to_json, security_token: @security_token
15
16
  response = RestClient.post("#{@base_url}/#{url}", params)
16
17
 
17
18
  JSON.parse response
@@ -1,3 +1,3 @@
1
1
  module TicketAbstractorClient
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
@@ -1,21 +1,22 @@
1
1
  module TicketAbstractorClient
2
- def self.initialize_client(url)
2
+ def self.initialize_client(url, security_token = nil)
3
3
  @url = url
4
+ @security_token = security_token
4
5
  @jira_client = @brouha_client = @itrc_client = nil
5
6
 
6
7
  self
7
8
  end
8
9
 
9
10
  def self.jira
10
- @jira_client ||= JiraClient.new(@url)
11
+ @jira_client ||= JiraClient.new(@url, @security_token)
11
12
  end
12
13
 
13
14
  def self.brouha
14
- @brouha_client ||= BrouhaClient.new(@url)
15
+ @brouha_client ||= BrouhaClient.new(@url, @security_token)
15
16
  end
16
17
 
17
18
  def self.itrc
18
- @itrc_client ||= ItrcClient.new(@url)
19
+ @itrc_client ||= ItrcClient.new(@url, @security_token)
19
20
  end
20
21
  end
21
22
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ticket_abstractor_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-14 00:00:00.000000000 Z
12
+ date: 2014-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler