pager_duty-connection 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 888b568573fb527b4a30f4d87eea9717c5f6b830
4
+ data.tar.gz: ff435a108de8e6e7bb5fc00a02773a2de0ea4801
5
+ SHA512:
6
+ metadata.gz: 2c907052ec333a9a7665d6aa6575e8ba4199203ea4c62dc44cd5a2b5793fca9e369302fa9ab394752dc257467d528b0550bdbba845cd38e3bd3b557a7a6b8586
7
+ data.tar.gz: ce2965873258d77ce6f6b3cc4bbbd7fde41773f30a9209f0da8a3adc58e5a5e4f80a08b1e2877398ca56410bf64dc5cc8beca43b2e318cb4ffdb5fe66205ea9a
data/README.md CHANGED
@@ -50,10 +50,10 @@ pagerduty = PagerDuty::Connection.new(account, token)
50
50
 
51
51
  # 4 main methods: get, post, put, and delete:
52
52
 
53
- response = pagerduty.get('some/relative/path', :some => 'request', :parameter => 'to pass'
54
- response = pagerduty.post('some/relative/path', :some => 'request', :parameter => 'to pass'
55
- response = pagerduty.delete('some/relative/path', :some => 'request', :parameter => 'to pass'
56
- response = pagerduty.put('some/relative/path', :some => 'request', :parameter => 'to pass'
53
+ response = pagerduty.get('some/relative/path', :some => 'request', :parameter => 'to pass')
54
+ response = pagerduty.post('some/relative/path', :some => 'request', :parameter => 'to pass')
55
+ response = pagerduty.delete('some/relative/path', :some => 'request', :parameter => 'to pass')
56
+ response = pagerduty.put('some/relative/path', :some => 'request', :parameter => 'to pass')
57
57
 
58
58
  # use something like irb or pry to poke around the responses
59
59
  # the contents will vary a bit between call, ie:
@@ -29,7 +29,7 @@ module PagerDuty
29
29
  class RaiseApiErrorOnNon200 < Faraday::Middleware
30
30
  def call(env)
31
31
  response = @app.call env
32
- if response.status != 200
32
+ unless [200, 201, 204].include?(response.status)
33
33
  url = response.env[:url].to_s
34
34
  if error = response.body['error']
35
35
  # TODO May Need to check error.errors too
@@ -61,20 +61,41 @@ module PagerDuty
61
61
  end
62
62
 
63
63
  class ParseTimeStrings < Faraday::Middleware
64
- TIME_KEYS = %w(start end created_on last_status_change_on started_at created_at last_incident_timestamp)
65
-
66
- OBJECT_KEYS = %w(override entry incident alert service)
64
+ TIME_KEYS = %w(
65
+ created_at
66
+ created_on
67
+ end
68
+ end_time
69
+ last_incident_timestamp
70
+ last_status_change_on
71
+ start
72
+ started_at
73
+ start_time
74
+ )
75
+
76
+ OBJECT_KEYS = %w(
77
+ alert
78
+ entry
79
+ incident
80
+ log_entry
81
+ maintenance_window
82
+ note
83
+ override
84
+ service
85
+ )
67
86
 
68
87
  def call(env)
69
88
  response = @app.call env
70
89
 
71
- OBJECT_KEYS.each do |key|
72
- object = env[:body][key]
73
- parse_object_times(object) if object
74
-
75
- collection_key = key.pluralize
76
- collection = env[:body][collection_key]
77
- parse_collection_times(collection) if collection
90
+ if env[:body]
91
+ OBJECT_KEYS.each do |key|
92
+ object = env[:body][key]
93
+ parse_object_times(object) if object
94
+
95
+ collection_key = key.pluralize
96
+ collection = env[:body][collection_key]
97
+ parse_collection_times(collection) if collection
98
+ end
78
99
  end
79
100
 
80
101
  response
@@ -133,7 +154,7 @@ module PagerDuty
133
154
  end
134
155
 
135
156
  def post(path, options = {})
136
- run_request(:put, path, options)
157
+ run_request(:post, path, options)
137
158
  end
138
159
 
139
160
  def delete(path, options = {})
@@ -1,5 +1,5 @@
1
1
  module PagerDuty
2
2
  class Connection
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -20,5 +20,5 @@ Gem::Specification.new do |gem|
20
20
  gem.add_dependency "faraday", "~> 0.8.6"
21
21
  gem.add_dependency "faraday_middleware", "~> 0.9.0"
22
22
  gem.add_dependency "activesupport", "~> 3.2"
23
- gem.add_dependency "hashie", "~> 1.2"
23
+ gem.add_dependency "hashie", ">= 1.2", "< 2.2"
24
24
  end
metadata CHANGED
@@ -1,80 +1,77 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pager_duty-connection
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Josh Nichols
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-14 00:00:00.000000000 Z
11
+ date: 2014-07-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: faraday
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.8.6
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.8.6
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: faraday_middleware
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
33
  version: 0.9.0
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
40
  version: 0.9.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: activesupport
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: '3.2'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: '3.2'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: hashie
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ~>
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '1.2'
62
+ - - "<"
63
+ - !ruby/object:Gem::Version
64
+ version: '2.2'
70
65
  type: :runtime
71
66
  prerelease: false
72
67
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
68
  requirements:
75
- - - ~>
69
+ - - ">="
76
70
  - !ruby/object:Gem::Version
77
71
  version: '1.2'
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: '2.2'
78
75
  description: Ruby API wrapper for the PagerDuty REST API
79
76
  email:
80
77
  - josh@technicalpickles.com
@@ -82,7 +79,7 @@ executables: []
82
79
  extensions: []
83
80
  extra_rdoc_files: []
84
81
  files:
85
- - .gitignore
82
+ - ".gitignore"
86
83
  - Gemfile
87
84
  - LICENSE.txt
88
85
  - README.md
@@ -96,28 +93,26 @@ files:
96
93
  - pager_duty-connection.gemspec
97
94
  homepage: http://github.com/technicalpickles/pager_duty-connection
98
95
  licenses: []
96
+ metadata: {}
99
97
  post_install_message:
100
98
  rdoc_options: []
101
99
  require_paths:
102
100
  - lib
103
101
  required_ruby_version: !ruby/object:Gem::Requirement
104
- none: false
105
102
  requirements:
106
- - - ! '>='
103
+ - - ">="
107
104
  - !ruby/object:Gem::Version
108
105
  version: '0'
109
106
  required_rubygems_version: !ruby/object:Gem::Requirement
110
- none: false
111
107
  requirements:
112
- - - ! '>='
108
+ - - ">="
113
109
  - !ruby/object:Gem::Version
114
110
  version: '0'
115
111
  requirements: []
116
112
  rubyforge_project:
117
- rubygems_version: 1.8.23
113
+ rubygems_version: 2.2.2
118
114
  signing_key:
119
- specification_version: 3
115
+ specification_version: 4
120
116
  summary: Written with the power of faraday, pager_duty-connection tries to be a simple
121
117
  and usable Ruby API wrapper for the PagerDuty REST API
122
118
  test_files: []
123
- has_rdoc: