pager_duty-connection 0.1.0 → 0.2.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: 023f927c20d23f46e093121970baec2c6bd7d7b9
4
- data.tar.gz: 3199758e3e1c97a4133a2a4df7c1baddf0291776
3
+ metadata.gz: b49a8ad70aa198241f8afcb8371dd05a8712ddbd
4
+ data.tar.gz: 2289369bc4346458b5073f3f36c57a2499978bb5
5
5
  SHA512:
6
- metadata.gz: 43d990dd1d1f56cdb81cc634912c3a2ad568dd9b2d89dcfec49377984a83fc60a46d03a6958fa754d02e9f151a52e7a1d2d7f28ac9d8b3ff0109e5842263e5ba
7
- data.tar.gz: 7eced22a214afcb5cb46afbe94734942bcfa40a9066e057ce0525d889a6e26eb371be4fe5374572af6d5d7b97a19f71f282f17ab7338d7a3eab86a7de14b9293
6
+ metadata.gz: bfa193c9691bd50973c71827f66c811827b3f9353b3ff89bce0768bad2383e943a7328b75eb011b7920deac7a352fd89fa67f7a77733ea152ba63abd9ab62c83
7
+ data.tar.gz: ba0c41b2de447447e538b9ff8ea0c3c08bd0a338df34befc87baa0ad89013b71ad08b332e319634db9fc069b6fb538c12c5c36b88e3af91d48b5fab5f8bec0a5
@@ -1,5 +1,6 @@
1
1
  require 'faraday'
2
2
  require 'faraday_middleware'
3
+ require 'active_support'
3
4
  require 'active_support/core_ext'
4
5
  require 'active_support/time_with_zone'
5
6
 
@@ -44,25 +45,24 @@ module PagerDuty
44
45
  end
45
46
  end
46
47
 
47
- class ConvertTimesParametersToISO8601 < Faraday::Middleware
48
+ class ConvertTimesParametersToISO8601 < Faraday::Middleware
48
49
  TIME_KEYS = [:since, :until]
49
50
  def call(env)
50
51
 
51
52
  body = env[:body]
52
53
  TIME_KEYS.each do |key|
53
- if body.has_key?(key)
54
+ if body.has_key?(key)
54
55
  body[key] = body[key].iso8601 if body[key].respond_to?(:iso8601)
55
56
  end
56
57
  end
57
58
 
58
59
  response = @app.call env
59
60
  end
60
-
61
-
62
61
  end
63
62
 
64
63
  class ParseTimeStrings < Faraday::Response::Middleware
65
64
  TIME_KEYS = %w(
65
+ at
66
66
  created_at
67
67
  created_on
68
68
  end
@@ -85,6 +85,12 @@ module PagerDuty
85
85
  service
86
86
  )
87
87
 
88
+ NESTED_COLLECTION_KEYS = %w(
89
+ acknowledgers
90
+ assigned_to
91
+ pending_actions
92
+ )
93
+
88
94
  def parse(body)
89
95
  case body
90
96
  when Hash, ::Hashie::Mash
@@ -106,6 +112,11 @@ module PagerDuty
106
112
  def parse_collection_times(collection)
107
113
  collection.each do |object|
108
114
  parse_object_times(object)
115
+
116
+ NESTED_COLLECTION_KEYS.each do |key|
117
+ object_collection = object[key]
118
+ parse_collection_times(object_collection) if object_collection
119
+ end
109
120
  end
110
121
  end
111
122
 
@@ -131,7 +142,7 @@ module PagerDuty
131
142
  conn.use RaiseApiErrorOnNon200
132
143
  conn.use RaiseFileNotFoundOn404
133
144
 
134
- conn.use ConvertTimesParametersToISO8601
145
+ conn.use ConvertTimesParametersToISO8601
135
146
 
136
147
  # use json
137
148
  conn.request :json
@@ -1,5 +1,5 @@
1
1
  module PagerDuty
2
2
  class Connection
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pager_duty-connection
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Nichols
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-10 00:00:00.000000000 Z
11
+ date: 2015-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -122,9 +122,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.2.2
125
+ rubygems_version: 2.4.8
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: Written with the power of faraday, pager_duty-connection tries to be a simple
129
129
  and usable Ruby API wrapper for the PagerDuty REST API
130
130
  test_files: []
131
+ has_rdoc: