ticket_sharing 1.1.1 → 1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1b51ca8f39acac4810a623cff359b0932a6c78d0
4
+ data.tar.gz: 965583e24ce9ce3dab466e15eeafcd91cec047f7
5
+ SHA512:
6
+ metadata.gz: 077b31ace706771d4539827c0dc1c8ba57192cfd8e7dc6b96f88c84b92f54f7ac3c1f52d11a1482595b07852318df012c9c663485f0e6b5bc8719599014d83b6
7
+ data.tar.gz: 23e7d9ea5d840f1747f52eb746b35449d99a12067dfd3376647b579e671a842fb36f06a6e4d30e116edc53e2e071f9de443e87aee39989a8861cfdf192e1f727
@@ -30,13 +30,15 @@ module TicketSharing
30
30
  end
31
31
  end
32
32
 
33
- def to_json
34
- attributes = field_list.inject({}) do |attrs, field|
33
+ def as_json(_options = {})
34
+ field_list.inject({}) do |attrs, field|
35
35
  attrs[field.to_s] = send(field)
36
36
  attrs
37
37
  end
38
+ end
38
39
 
39
- JsonSupport.encode(attributes)
40
+ def to_json(_options = {})
41
+ JsonSupport.encode(as_json)
40
42
  end
41
43
 
42
44
  end
@@ -1,14 +1,20 @@
1
- require 'yajl'
2
-
3
1
  module TicketSharing
2
+ JSON_PARSER = begin
3
+ require 'multi_json'
4
+ MultiJson
5
+ rescue LoadError
6
+ require 'json'
7
+ JSON
8
+ end
9
+
4
10
  class JsonSupport
5
11
 
6
12
  def self.encode(attributes)
7
- Yajl::Encoder.encode(attributes)
13
+ JSON_PARSER.dump(attributes)
8
14
  end
9
15
 
10
16
  def self.decode(json)
11
- Yajl::Parser.new.parse(json)
17
+ JSON_PARSER.load(json)
12
18
  end
13
19
 
14
20
  end
@@ -16,8 +16,12 @@ module TicketSharing
16
16
  end
17
17
  end
18
18
 
19
- def to_json
20
- JsonSupport.encode(@value ? @value.strftime('%Y-%m-%d %H:%M:%S %z') : nil)
19
+ def as_json(_options = {})
20
+ @value ? @value.strftime('%Y-%m-%d %H:%M:%S %z') : nil
21
+ end
22
+
23
+ def to_json(_options = {})
24
+ JsonSupport.encode(as_json)
21
25
  end
22
26
 
23
27
  # Support method to play well with active record
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ticket_sharing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
5
- prerelease:
4
+ version: 1.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Josh Lubaway
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-04 00:00:00.000000000 Z
11
+ date: 2016-05-03 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: A ruby implementation of the Networked Help Desk API
15
14
  email: josh@zendesk.com
@@ -18,6 +17,7 @@ extensions: []
18
17
  extra_rdoc_files:
19
18
  - Readme.md
20
19
  files:
20
+ - Readme.md
21
21
  - lib/ticket_sharing/actor.rb
22
22
  - lib/ticket_sharing/agreement.rb
23
23
  - lib/ticket_sharing/attachment.rb
@@ -29,32 +29,30 @@ files:
29
29
  - lib/ticket_sharing/request.rb
30
30
  - lib/ticket_sharing/ticket.rb
31
31
  - lib/ticket_sharing/time.rb
32
- - Readme.md
33
32
  homepage: https://github.com/zendesk/ticket_sharing
34
33
  licenses:
35
34
  - Apache License Version 2.0
35
+ metadata: {}
36
36
  post_install_message:
37
37
  rdoc_options:
38
- - --main
38
+ - "--main"
39
39
  - Readme.md
40
40
  require_paths:
41
41
  - lib
42
42
  required_ruby_version: !ruby/object:Gem::Requirement
43
- none: false
44
43
  requirements:
45
- - - ! '>='
44
+ - - ">="
46
45
  - !ruby/object:Gem::Version
47
46
  version: '0'
48
47
  required_rubygems_version: !ruby/object:Gem::Requirement
49
- none: false
50
48
  requirements:
51
- - - ! '>='
49
+ - - ">="
52
50
  - !ruby/object:Gem::Version
53
51
  version: '0'
54
52
  requirements: []
55
53
  rubyforge_project:
56
- rubygems_version: 1.8.25
54
+ rubygems_version: 2.4.5.1
57
55
  signing_key:
58
- specification_version: 3
56
+ specification_version: 4
59
57
  summary: Ticket sharing
60
58
  test_files: []