pinch-api 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.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +48 -0
- data/lib/pinch.rb +24 -0
- data/lib/pinch/api_exception.rb +21 -0
- data/lib/pinch/api_helper.rb +140 -0
- data/lib/pinch/configuration.rb +23 -0
- data/lib/pinch/controllers/ticket_controller.rb +537 -0
- data/lib/pinch/controllers/webhook_controller.rb +290 -0
- data/lib/pinch/controllers/webhook_type_controller.rb +62 -0
- data/lib/pinch/custom_auth_utility.rb +17 -0
- data/lib/pinch/models/building.rb +107 -0
- data/lib/pinch/models/person.rb +80 -0
- data/lib/pinch/models/ticket.rb +130 -0
- data/lib/pinch/models/unit.rb +89 -0
- data/lib/pinch/models/webhook.rb +62 -0
- data/lib/pinch/models/webhook_type.rb +53 -0
- data/lib/pinch/pinch_client.rb +29 -0
- metadata +89 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
# This file was automatically generated for Pinch by APIMATIC v2.0 ( https://apimatic.io ) on 05/13/2016
|
2
|
+
|
3
|
+
module Pinch
|
4
|
+
class Person
|
5
|
+
|
6
|
+
# TODO: Write general description for this method
|
7
|
+
# @return [String]
|
8
|
+
attr_reader :firstname
|
9
|
+
|
10
|
+
# TODO: Write general description for this method
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :lastname
|
13
|
+
|
14
|
+
# The landline phone number of the resident or manager
|
15
|
+
# @return [String]
|
16
|
+
attr_reader :home_phone_number
|
17
|
+
|
18
|
+
# TODO: Write general description for this method
|
19
|
+
# @return [String]
|
20
|
+
attr_reader :mobile_phone_number
|
21
|
+
|
22
|
+
# Caretaker, Resident, Manager, ThirdParty
|
23
|
+
# @return [String]
|
24
|
+
attr_reader :role
|
25
|
+
|
26
|
+
def initialize(firstname = nil,
|
27
|
+
lastname = nil,
|
28
|
+
home_phone_number = nil,
|
29
|
+
mobile_phone_number = nil,
|
30
|
+
role = nil)
|
31
|
+
@firstname = firstname
|
32
|
+
@lastname = lastname
|
33
|
+
@home_phone_number = home_phone_number
|
34
|
+
@mobile_phone_number = mobile_phone_number
|
35
|
+
@role = role
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
def method_missing(method_name)
|
40
|
+
puts "There is no method called '#{method_name}'."
|
41
|
+
end
|
42
|
+
|
43
|
+
# Creates JSON of the curent object
|
44
|
+
def to_json
|
45
|
+
hash = key_map
|
46
|
+
hash.to_json
|
47
|
+
end
|
48
|
+
|
49
|
+
# Creates an instance of the object from a hash
|
50
|
+
def self.from_hash(hash)
|
51
|
+
if hash == nil
|
52
|
+
nil
|
53
|
+
else
|
54
|
+
# Extract variables from the hash
|
55
|
+
firstname = hash["firstname"]
|
56
|
+
lastname = hash["lastname"]
|
57
|
+
home_phone_number = hash["home_phone_number"]
|
58
|
+
mobile_phone_number = hash["mobile_phone_number"]
|
59
|
+
role = hash["role"]
|
60
|
+
# Create object from extracted values
|
61
|
+
Person.new(firstname,
|
62
|
+
lastname,
|
63
|
+
home_phone_number,
|
64
|
+
mobile_phone_number,
|
65
|
+
role)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Defines the key map for json serialization
|
70
|
+
def key_map
|
71
|
+
hash = {}
|
72
|
+
hash['firstname'] = firstname
|
73
|
+
hash['lastname'] = lastname
|
74
|
+
hash['home_phone_number'] = home_phone_number
|
75
|
+
hash['mobile_phone_number'] = mobile_phone_number
|
76
|
+
hash['role'] = role
|
77
|
+
hash
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# This file was automatically generated for Pinch by APIMATIC v2.0 ( https://apimatic.io ) on 05/13/2016
|
2
|
+
|
3
|
+
module Pinch
|
4
|
+
class Ticket
|
5
|
+
|
6
|
+
# TODO: Write general description for this method
|
7
|
+
# @return [String]
|
8
|
+
attr_reader :id
|
9
|
+
|
10
|
+
# TODO: Write general description for this method
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :name
|
13
|
+
|
14
|
+
# TODO: Write general description for this method
|
15
|
+
# @return [String]
|
16
|
+
attr_reader :description
|
17
|
+
|
18
|
+
# TODO: Write general description for this method
|
19
|
+
# @return [List of Person]
|
20
|
+
attr_reader :contacts
|
21
|
+
|
22
|
+
# TODO: Write general description for this method
|
23
|
+
# @return [String]
|
24
|
+
attr_reader :status
|
25
|
+
|
26
|
+
# TODO: Write general description for this method
|
27
|
+
# @return [Building]
|
28
|
+
attr_reader :building
|
29
|
+
|
30
|
+
# TODO: Write general description for this method
|
31
|
+
# @return [Unit]
|
32
|
+
attr_reader :unit
|
33
|
+
|
34
|
+
# TODO: Write general description for this method
|
35
|
+
# @return [String]
|
36
|
+
attr_reader :access
|
37
|
+
|
38
|
+
# TODO: Write general description for this method
|
39
|
+
# @return [String]
|
40
|
+
attr_reader :agency
|
41
|
+
|
42
|
+
# TODO: Write general description for this method
|
43
|
+
# @return [String]
|
44
|
+
attr_reader :manager
|
45
|
+
|
46
|
+
def initialize(id = nil,
|
47
|
+
name = nil,
|
48
|
+
description = nil,
|
49
|
+
contacts = nil,
|
50
|
+
status = nil,
|
51
|
+
building = nil,
|
52
|
+
unit = nil,
|
53
|
+
access = nil,
|
54
|
+
agency = nil,
|
55
|
+
manager = nil)
|
56
|
+
@id = id
|
57
|
+
@name = name
|
58
|
+
@description = description
|
59
|
+
@contacts = contacts
|
60
|
+
@status = status
|
61
|
+
@building = building
|
62
|
+
@unit = unit
|
63
|
+
@access = access
|
64
|
+
@agency = agency
|
65
|
+
@manager = manager
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
def method_missing(method_name)
|
70
|
+
puts "There is no method called '#{method_name}'."
|
71
|
+
end
|
72
|
+
|
73
|
+
# Creates JSON of the curent object
|
74
|
+
def to_json
|
75
|
+
hash = key_map
|
76
|
+
hash.to_json
|
77
|
+
end
|
78
|
+
|
79
|
+
# Creates an instance of the object from a hash
|
80
|
+
def self.from_hash(hash)
|
81
|
+
if hash == nil
|
82
|
+
nil
|
83
|
+
else
|
84
|
+
# Extract variables from the hash
|
85
|
+
id = hash["id"]
|
86
|
+
name = hash["name"]
|
87
|
+
description = hash["description"]
|
88
|
+
# Parameter is an array, so we need to iterate through it
|
89
|
+
contacts = nil
|
90
|
+
if hash["contacts"] != nil
|
91
|
+
contacts = Array.new
|
92
|
+
hash["contacts"].each{|structure| contacts << Person.from_hash(structure)}
|
93
|
+
end
|
94
|
+
status = hash["status"]
|
95
|
+
building = Building.from_hash(hash["building"])
|
96
|
+
unit = Unit.from_hash(hash["unit"])
|
97
|
+
access = hash["access"]
|
98
|
+
agency = hash["agency"]
|
99
|
+
manager = hash["manager"]
|
100
|
+
# Create object from extracted values
|
101
|
+
Ticket.new(id,
|
102
|
+
name,
|
103
|
+
description,
|
104
|
+
contacts,
|
105
|
+
status,
|
106
|
+
building,
|
107
|
+
unit,
|
108
|
+
access,
|
109
|
+
agency,
|
110
|
+
manager)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
# Defines the key map for json serialization
|
115
|
+
def key_map
|
116
|
+
hash = {}
|
117
|
+
hash['id'] = id
|
118
|
+
hash['name'] = name
|
119
|
+
hash['description'] = description
|
120
|
+
hash['contacts'] = contacts.map(&:key_map)
|
121
|
+
hash['status'] = status
|
122
|
+
hash['building'] = building.key_map
|
123
|
+
hash['unit'] = unit.key_map
|
124
|
+
hash['access'] = access
|
125
|
+
hash['agency'] = agency
|
126
|
+
hash['manager'] = manager
|
127
|
+
hash
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# This file was automatically generated for Pinch by APIMATIC v2.0 ( https://apimatic.io ) on 05/13/2016
|
2
|
+
|
3
|
+
module Pinch
|
4
|
+
class Unit
|
5
|
+
|
6
|
+
# TODO: Write general description for this method
|
7
|
+
# @return [Integer]
|
8
|
+
attr_reader :id
|
9
|
+
|
10
|
+
# TODO: Write general description for this method
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :reference
|
13
|
+
|
14
|
+
# TODO: Write general description for this method
|
15
|
+
# @return [String]
|
16
|
+
attr_reader :tenant_name
|
17
|
+
|
18
|
+
# TODO: Write general description for this method
|
19
|
+
# @return [String]
|
20
|
+
attr_reader :floor_number
|
21
|
+
|
22
|
+
# TODO: Write general description for this method
|
23
|
+
# @return [String]
|
24
|
+
attr_reader :kind
|
25
|
+
|
26
|
+
# TODO: Write general description for this method
|
27
|
+
# @return [String]
|
28
|
+
attr_reader :french_floor_number
|
29
|
+
|
30
|
+
def initialize(id = nil,
|
31
|
+
reference = nil,
|
32
|
+
tenant_name = nil,
|
33
|
+
floor_number = nil,
|
34
|
+
kind = nil,
|
35
|
+
french_floor_number = nil)
|
36
|
+
@id = id
|
37
|
+
@reference = reference
|
38
|
+
@tenant_name = tenant_name
|
39
|
+
@floor_number = floor_number
|
40
|
+
@kind = kind
|
41
|
+
@french_floor_number = french_floor_number
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
def method_missing(method_name)
|
46
|
+
puts "There is no method called '#{method_name}'."
|
47
|
+
end
|
48
|
+
|
49
|
+
# Creates JSON of the curent object
|
50
|
+
def to_json
|
51
|
+
hash = key_map
|
52
|
+
hash.to_json
|
53
|
+
end
|
54
|
+
|
55
|
+
# Creates an instance of the object from a hash
|
56
|
+
def self.from_hash(hash)
|
57
|
+
if hash == nil
|
58
|
+
nil
|
59
|
+
else
|
60
|
+
# Extract variables from the hash
|
61
|
+
id = hash["id"]
|
62
|
+
reference = hash["reference"]
|
63
|
+
tenant_name = hash["tenant_name"]
|
64
|
+
floor_number = hash["floor_number"]
|
65
|
+
kind = hash["kind"]
|
66
|
+
french_floor_number = hash["french_floor_number"]
|
67
|
+
# Create object from extracted values
|
68
|
+
Unit.new(id,
|
69
|
+
reference,
|
70
|
+
tenant_name,
|
71
|
+
floor_number,
|
72
|
+
kind,
|
73
|
+
french_floor_number)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Defines the key map for json serialization
|
78
|
+
def key_map
|
79
|
+
hash = {}
|
80
|
+
hash['id'] = id
|
81
|
+
hash['reference'] = reference
|
82
|
+
hash['tenant_name'] = tenant_name
|
83
|
+
hash['floor_number'] = floor_number
|
84
|
+
hash['kind'] = kind
|
85
|
+
hash['french_floor_number'] = french_floor_number
|
86
|
+
hash
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# This file was automatically generated for Pinch by APIMATIC v2.0 ( https://apimatic.io ) on 05/13/2016
|
2
|
+
|
3
|
+
module Pinch
|
4
|
+
class Webhook
|
5
|
+
|
6
|
+
# TODO: Write general description for this method
|
7
|
+
# @return [Integer]
|
8
|
+
attr_reader :id
|
9
|
+
|
10
|
+
# TODO: Write general description for this method
|
11
|
+
# @return [String]
|
12
|
+
attr_accessor :url
|
13
|
+
|
14
|
+
# TODO: Write general description for this method
|
15
|
+
# @return [Integer]
|
16
|
+
attr_accessor :webhook_type
|
17
|
+
|
18
|
+
def initialize(id = nil,
|
19
|
+
url = nil,
|
20
|
+
webhook_type = nil)
|
21
|
+
@id = id
|
22
|
+
@url = url
|
23
|
+
@webhook_type = webhook_type
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
def method_missing(method_name)
|
28
|
+
puts "There is no method called '#{method_name}'."
|
29
|
+
end
|
30
|
+
|
31
|
+
# Creates JSON of the curent object
|
32
|
+
def to_json
|
33
|
+
hash = key_map
|
34
|
+
hash.to_json
|
35
|
+
end
|
36
|
+
|
37
|
+
# Creates an instance of the object from a hash
|
38
|
+
def self.from_hash(hash)
|
39
|
+
if hash == nil
|
40
|
+
nil
|
41
|
+
else
|
42
|
+
# Extract variables from the hash
|
43
|
+
id = hash["id"]
|
44
|
+
url = hash["url"]
|
45
|
+
webhook_type = hash["webhook_type"]
|
46
|
+
# Create object from extracted values
|
47
|
+
Webhook.new(id,
|
48
|
+
url,
|
49
|
+
webhook_type)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Defines the key map for json serialization
|
54
|
+
def key_map
|
55
|
+
hash = {}
|
56
|
+
hash['id'] = id
|
57
|
+
hash['url'] = url
|
58
|
+
hash['webhook_type'] = webhook_type
|
59
|
+
hash
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# This file was automatically generated for Pinch by APIMATIC v2.0 ( https://apimatic.io ) on 05/13/2016
|
2
|
+
|
3
|
+
module Pinch
|
4
|
+
class WebhookType
|
5
|
+
|
6
|
+
# TODO: Write general description for this method
|
7
|
+
# @return [Integer]
|
8
|
+
attr_accessor :id
|
9
|
+
|
10
|
+
# TODO: Write general description for this method
|
11
|
+
# @return [String]
|
12
|
+
attr_accessor :name
|
13
|
+
|
14
|
+
def initialize(id = nil,
|
15
|
+
name = nil)
|
16
|
+
@id = id
|
17
|
+
@name = name
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def method_missing(method_name)
|
22
|
+
puts "There is no method called '#{method_name}'."
|
23
|
+
end
|
24
|
+
|
25
|
+
# Creates JSON of the curent object
|
26
|
+
def to_json
|
27
|
+
hash = key_map
|
28
|
+
hash.to_json
|
29
|
+
end
|
30
|
+
|
31
|
+
# Creates an instance of the object from a hash
|
32
|
+
def self.from_hash(hash)
|
33
|
+
if hash == nil
|
34
|
+
nil
|
35
|
+
else
|
36
|
+
# Extract variables from the hash
|
37
|
+
id = hash["id"]
|
38
|
+
name = hash["name"]
|
39
|
+
# Create object from extracted values
|
40
|
+
WebhookType.new(id,
|
41
|
+
name)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Defines the key map for json serialization
|
46
|
+
def key_map
|
47
|
+
hash = {}
|
48
|
+
hash['id'] = id
|
49
|
+
hash['name'] = name
|
50
|
+
hash
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# This file was automatically generated for Pinch by APIMATIC v2.0 ( https://apimatic.io ) on 05/13/2016
|
2
|
+
|
3
|
+
module Pinch
|
4
|
+
class PinchClient
|
5
|
+
# Singleton access to webhook_type controller
|
6
|
+
# @return [WebhookTypeController] Returns the controller instance
|
7
|
+
def webhook_type
|
8
|
+
WebhookTypeController.instance
|
9
|
+
end
|
10
|
+
|
11
|
+
# Singleton access to webhook controller
|
12
|
+
# @return [WebhookController] Returns the controller instance
|
13
|
+
def webhook
|
14
|
+
WebhookController.instance
|
15
|
+
end
|
16
|
+
|
17
|
+
# Singleton access to ticket controller
|
18
|
+
# @return [TicketController] Returns the controller instance
|
19
|
+
def ticket
|
20
|
+
TicketController.instance
|
21
|
+
end
|
22
|
+
|
23
|
+
# Initializer with authentication and configuration parameters
|
24
|
+
def initialize(x_api_token: nil, x_api_email: nil)
|
25
|
+
Configuration.x_api_token = x_api_token
|
26
|
+
Configuration.x_api_email = x_api_email
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|