moesif_api 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,71 +1,71 @@
1
-
2
-
3
- module MoesifApi
4
- class EventModel < BaseModel
5
- # API request object
6
- # @return [EventRequestModel]
7
- attr_accessor :request
8
-
9
- # API response Object
10
- # @return [EventResponseModel]
11
- attr_accessor :response
12
-
13
- # End user's auth/session token
14
- # @return [String]
15
- attr_accessor :session_token
16
-
17
- # comma separated list of tags, see documentation
18
- # @return [String]
19
- attr_accessor :tags
20
-
21
- # End user's user_id string from your app
22
- # @return [String]
23
- attr_accessor :user_id
24
-
25
- # A mapping from model property names to API property names
26
- def self.names
27
- if @hash.nil?
28
- @hash = {}
29
- @hash["request"] = "request"
30
- @hash["response"] = "response"
31
- @hash["session_token"] = "session_token"
32
- @hash["tags"] = "tags"
33
- @hash["user_id"] = "user_id"
34
- end
35
- @hash
36
- end
37
-
38
- def initialize(request = nil,
39
- response = nil,
40
- session_token = nil,
41
- tags = nil,
42
- user_id = nil)
43
- @request = request
44
- @response = response
45
- @session_token = session_token
46
- @tags = tags
47
- @user_id = user_id
48
- end
49
-
50
- # Creates an instance of the object from a hash
51
- def self.from_hash(hash)
52
- if hash == nil
53
- nil
54
- else
55
- # Extract variables from the hash
56
- request = EventRequestModel.from_hash(hash["request"]) if hash["request"]
57
- response = EventResponseModel.from_hash(hash["response"]) if hash["response"]
58
- session_token = hash["session_token"]
59
- tags = hash["tags"]
60
- user_id = hash["user_id"]
61
-
62
- # Create object from extracted values
63
- EventModel.new(request,
64
- response,
65
- session_token,
66
- tags,
67
- user_id)
68
- end
69
- end
70
- end
71
- end
1
+
2
+
3
+ module MoesifApi
4
+ class EventModel < BaseModel
5
+ # API request object
6
+ # @return [EventRequestModel]
7
+ attr_accessor :request
8
+
9
+ # API response Object
10
+ # @return [EventResponseModel]
11
+ attr_accessor :response
12
+
13
+ # End user's auth/session token
14
+ # @return [String]
15
+ attr_accessor :session_token
16
+
17
+ # comma separated list of tags, see documentation
18
+ # @return [String]
19
+ attr_accessor :tags
20
+
21
+ # End user's user_id string from your app
22
+ # @return [String]
23
+ attr_accessor :user_id
24
+
25
+ # A mapping from model property names to API property names
26
+ def self.names
27
+ if @hash.nil?
28
+ @hash = {}
29
+ @hash["request"] = "request"
30
+ @hash["response"] = "response"
31
+ @hash["session_token"] = "session_token"
32
+ @hash["tags"] = "tags"
33
+ @hash["user_id"] = "user_id"
34
+ end
35
+ @hash
36
+ end
37
+
38
+ def initialize(request = nil,
39
+ response = nil,
40
+ session_token = nil,
41
+ tags = nil,
42
+ user_id = nil)
43
+ @request = request
44
+ @response = response
45
+ @session_token = session_token
46
+ @tags = tags
47
+ @user_id = user_id
48
+ end
49
+
50
+ # Creates an instance of the object from a hash
51
+ def self.from_hash(hash)
52
+ if hash == nil
53
+ nil
54
+ else
55
+ # Extract variables from the hash
56
+ request = EventRequestModel.from_hash(hash["request"]) if hash["request"]
57
+ response = EventResponseModel.from_hash(hash["response"]) if hash["response"]
58
+ session_token = hash["session_token"]
59
+ tags = hash["tags"]
60
+ user_id = hash["user_id"]
61
+
62
+ # Create object from extracted values
63
+ EventModel.new(request,
64
+ response,
65
+ session_token,
66
+ tags,
67
+ user_id)
68
+ end
69
+ end
70
+ end
71
+ end
@@ -1,90 +1,90 @@
1
-
2
-
3
- require 'date'
4
- module MoesifApi
5
- class EventRequestModel < BaseModel
6
- # Time when request was made
7
- # @return [DateTime]
8
- attr_accessor :time
9
-
10
- # full uri of request such as https://www.example.com/my_path?param=1
11
- # @return [String]
12
- attr_accessor :uri
13
-
14
- # verb of the API request such as GET or POST
15
- # @return [String]
16
- attr_accessor :verb
17
-
18
- # Key/Value map of request headers
19
- # @return [Object]
20
- attr_accessor :headers
21
-
22
- # Optionally tag the call with your API or App version
23
- # @return [String]
24
- attr_accessor :api_version
25
-
26
- # IP Address of the client if known.
27
- # @return [String]
28
- attr_accessor :ip_address
29
-
30
- # Request body
31
- # @return [Object]
32
- attr_accessor :body
33
-
34
- # A mapping from model property names to API property names
35
- def self.names
36
- if @hash.nil?
37
- @hash = {}
38
- @hash["time"] = "time"
39
- @hash["uri"] = "uri"
40
- @hash["verb"] = "verb"
41
- @hash["headers"] = "headers"
42
- @hash["api_version"] = "api_version"
43
- @hash["ip_address"] = "ip_address"
44
- @hash["body"] = "body"
45
- end
46
- @hash
47
- end
48
-
49
- def initialize(time = nil,
50
- uri = nil,
51
- verb = nil,
52
- headers = nil,
53
- api_version = nil,
54
- ip_address = nil,
55
- body = nil)
56
- @time = time
57
- @uri = uri
58
- @verb = verb
59
- @headers = headers
60
- @api_version = api_version
61
- @ip_address = ip_address
62
- @body = body
63
- end
64
-
65
- # Creates an instance of the object from a hash
66
- def self.from_hash(hash)
67
- if hash == nil
68
- nil
69
- else
70
- # Extract variables from the hash
71
- time = DateTime.iso8601(hash["time"]) if hash["time"]
72
- uri = hash["uri"]
73
- verb = hash["verb"]
74
- headers = hash["headers"]
75
- api_version = hash["api_version"]
76
- ip_address = hash["ip_address"]
77
- body = hash["body"]
78
-
79
- # Create object from extracted values
80
- EventRequestModel.new(time,
81
- uri,
82
- verb,
83
- headers,
84
- api_version,
85
- ip_address,
86
- body)
87
- end
88
- end
89
- end
90
- end
1
+
2
+
3
+ require 'date'
4
+ module MoesifApi
5
+ class EventRequestModel < BaseModel
6
+ # Time when request was made
7
+ # @return [DateTime]
8
+ attr_accessor :time
9
+
10
+ # full uri of request such as https://www.example.com/my_path?param=1
11
+ # @return [String]
12
+ attr_accessor :uri
13
+
14
+ # verb of the API request such as GET or POST
15
+ # @return [String]
16
+ attr_accessor :verb
17
+
18
+ # Key/Value map of request headers
19
+ # @return [Object]
20
+ attr_accessor :headers
21
+
22
+ # Optionally tag the call with your API or App version
23
+ # @return [String]
24
+ attr_accessor :api_version
25
+
26
+ # IP Address of the client if known.
27
+ # @return [String]
28
+ attr_accessor :ip_address
29
+
30
+ # Request body
31
+ # @return [Object]
32
+ attr_accessor :body
33
+
34
+ # A mapping from model property names to API property names
35
+ def self.names
36
+ if @hash.nil?
37
+ @hash = {}
38
+ @hash["time"] = "time"
39
+ @hash["uri"] = "uri"
40
+ @hash["verb"] = "verb"
41
+ @hash["headers"] = "headers"
42
+ @hash["api_version"] = "api_version"
43
+ @hash["ip_address"] = "ip_address"
44
+ @hash["body"] = "body"
45
+ end
46
+ @hash
47
+ end
48
+
49
+ def initialize(time = nil,
50
+ uri = nil,
51
+ verb = nil,
52
+ headers = nil,
53
+ api_version = nil,
54
+ ip_address = nil,
55
+ body = nil)
56
+ @time = time
57
+ @uri = uri
58
+ @verb = verb
59
+ @headers = headers
60
+ @api_version = api_version
61
+ @ip_address = ip_address
62
+ @body = body
63
+ end
64
+
65
+ # Creates an instance of the object from a hash
66
+ def self.from_hash(hash)
67
+ if hash == nil
68
+ nil
69
+ else
70
+ # Extract variables from the hash
71
+ time = DateTime.iso8601(hash["time"]) if hash["time"]
72
+ uri = hash["uri"]
73
+ verb = hash["verb"]
74
+ headers = hash["headers"]
75
+ api_version = hash["api_version"]
76
+ ip_address = hash["ip_address"]
77
+ body = hash["body"]
78
+
79
+ # Create object from extracted values
80
+ EventRequestModel.new(time,
81
+ uri,
82
+ verb,
83
+ headers,
84
+ api_version,
85
+ ip_address,
86
+ body)
87
+ end
88
+ end
89
+ end
90
+ end
@@ -1,72 +1,72 @@
1
-
2
-
3
- require 'date'
4
- module MoesifApi
5
- class EventResponseModel < BaseModel
6
- # Time when response received
7
- # @return [DateTime]
8
- attr_accessor :time
9
-
10
- # HTTP Status code such as 200
11
- # @return [Integer]
12
- attr_accessor :status
13
-
14
- # Key/Value map of response headers
15
- # @return [Object]
16
- attr_accessor :headers
17
-
18
- # Response body
19
- # @return [Object]
20
- attr_accessor :body
21
-
22
- # IP Address from the response, such as the server IP Address
23
- # @return [String]
24
- attr_accessor :ip_address
25
-
26
- # A mapping from model property names to API property names
27
- def self.names
28
- if @hash.nil?
29
- @hash = {}
30
- @hash["time"] = "time"
31
- @hash["status"] = "status"
32
- @hash["headers"] = "headers"
33
- @hash["body"] = "body"
34
- @hash["ip_address"] = "ip_address"
35
- end
36
- @hash
37
- end
38
-
39
- def initialize(time = nil,
40
- status = nil,
41
- headers = nil,
42
- body = nil,
43
- ip_address = nil)
44
- @time = time
45
- @status = status
46
- @headers = headers
47
- @body = body
48
- @ip_address = ip_address
49
- end
50
-
51
- # Creates an instance of the object from a hash
52
- def self.from_hash(hash)
53
- if hash == nil
54
- nil
55
- else
56
- # Extract variables from the hash
57
- time = DateTime.iso8601(hash["time"]) if hash["time"]
58
- status = hash["status"]
59
- headers = hash["headers"]
60
- body = hash["body"]
61
- ip_address = hash["ip_address"]
62
-
63
- # Create object from extracted values
64
- EventResponseModel.new(time,
65
- status,
66
- headers,
67
- body,
68
- ip_address)
69
- end
70
- end
71
- end
72
- end
1
+
2
+
3
+ require 'date'
4
+ module MoesifApi
5
+ class EventResponseModel < BaseModel
6
+ # Time when response received
7
+ # @return [DateTime]
8
+ attr_accessor :time
9
+
10
+ # HTTP Status code such as 200
11
+ # @return [Integer]
12
+ attr_accessor :status
13
+
14
+ # Key/Value map of response headers
15
+ # @return [Object]
16
+ attr_accessor :headers
17
+
18
+ # Response body
19
+ # @return [Object]
20
+ attr_accessor :body
21
+
22
+ # IP Address from the response, such as the server IP Address
23
+ # @return [String]
24
+ attr_accessor :ip_address
25
+
26
+ # A mapping from model property names to API property names
27
+ def self.names
28
+ if @hash.nil?
29
+ @hash = {}
30
+ @hash["time"] = "time"
31
+ @hash["status"] = "status"
32
+ @hash["headers"] = "headers"
33
+ @hash["body"] = "body"
34
+ @hash["ip_address"] = "ip_address"
35
+ end
36
+ @hash
37
+ end
38
+
39
+ def initialize(time = nil,
40
+ status = nil,
41
+ headers = nil,
42
+ body = nil,
43
+ ip_address = nil)
44
+ @time = time
45
+ @status = status
46
+ @headers = headers
47
+ @body = body
48
+ @ip_address = ip_address
49
+ end
50
+
51
+ # Creates an instance of the object from a hash
52
+ def self.from_hash(hash)
53
+ if hash == nil
54
+ nil
55
+ else
56
+ # Extract variables from the hash
57
+ time = DateTime.iso8601(hash["time"]) if hash["time"]
58
+ status = hash["status"]
59
+ headers = hash["headers"]
60
+ body = hash["body"]
61
+ ip_address = hash["ip_address"]
62
+
63
+ # Create object from extracted values
64
+ EventResponseModel.new(time,
65
+ status,
66
+ headers,
67
+ body,
68
+ ip_address)
69
+ end
70
+ end
71
+ end
72
+ end
@@ -1,44 +1,44 @@
1
-
2
-
3
- module MoesifApi
4
- class StatusModel < BaseModel
5
- # Status of Call
6
- # @return [Boolean]
7
- attr_accessor :status
8
-
9
- # Location
10
- # @return [String]
11
- attr_accessor :region
12
-
13
- # A mapping from model property names to API property names
14
- def self.names
15
- if @hash.nil?
16
- @hash = {}
17
- @hash["status"] = "status"
18
- @hash["region"] = "region"
19
- end
20
- @hash
21
- end
22
-
23
- def initialize(status = nil,
24
- region = nil)
25
- @status = status
26
- @region = region
27
- end
28
-
29
- # Creates an instance of the object from a hash
30
- def self.from_hash(hash)
31
- if hash == nil
32
- nil
33
- else
34
- # Extract variables from the hash
35
- status = hash["status"]
36
- region = hash["region"]
37
-
38
- # Create object from extracted values
39
- StatusModel.new(status,
40
- region)
41
- end
42
- end
43
- end
44
- end
1
+
2
+
3
+ module MoesifApi
4
+ class StatusModel < BaseModel
5
+ # Status of Call
6
+ # @return [Boolean]
7
+ attr_accessor :status
8
+
9
+ # Location
10
+ # @return [String]
11
+ attr_accessor :region
12
+
13
+ # A mapping from model property names to API property names
14
+ def self.names
15
+ if @hash.nil?
16
+ @hash = {}
17
+ @hash["status"] = "status"
18
+ @hash["region"] = "region"
19
+ end
20
+ @hash
21
+ end
22
+
23
+ def initialize(status = nil,
24
+ region = nil)
25
+ @status = status
26
+ @region = region
27
+ end
28
+
29
+ # Creates an instance of the object from a hash
30
+ def self.from_hash(hash)
31
+ if hash == nil
32
+ nil
33
+ else
34
+ # Extract variables from the hash
35
+ status = hash["status"]
36
+ region = hash["region"]
37
+
38
+ # Create object from extracted values
39
+ StatusModel.new(status,
40
+ region)
41
+ end
42
+ end
43
+ end
44
+ end
@@ -1,22 +1,22 @@
1
-
2
-
3
- module MoesifApi
4
- class MoesifAPIClient
5
- # Singleton access to api controller
6
- # @return [ApiController] Returns the controller instance
7
- def api
8
- ApiController.instance
9
- end
10
-
11
- # Singleton access to health controller
12
- # @return [HealthController] Returns the controller instance
13
- def health
14
- HealthController.instance
15
- end
16
-
17
- # Initializer with authentication and configuration parameters
18
- def initialize(application_id)
19
- Configuration.application_id = application_id
20
- end
21
- end
22
- end
1
+
2
+
3
+ module MoesifApi
4
+ class MoesifAPIClient
5
+ # Singleton access to api controller
6
+ # @return [ApiController] Returns the controller instance
7
+ def api
8
+ ApiController.instance
9
+ end
10
+
11
+ # Singleton access to health controller
12
+ # @return [HealthController] Returns the controller instance
13
+ def health
14
+ HealthController.instance
15
+ end
16
+
17
+ # Initializer with authentication and configuration parameters
18
+ def initialize(application_id)
19
+ Configuration.application_id = application_id
20
+ end
21
+ end
22
+ end
data/lib/moesif_api.rb CHANGED
@@ -1,33 +1,33 @@
1
-
2
- require 'openssl'
3
- require 'json'
4
- require 'unirest'
5
-
6
- # Exceptions
7
- require_relative 'moesif_api/exceptions/api_exception.rb'
8
-
9
- # Helper Files
10
- require_relative 'moesif_api/api_helper.rb'
11
- require_relative 'moesif_api/configuration.rb'
12
- require_relative 'moesif_api/moesif_api_client.rb'
13
-
14
- # Http
15
- require_relative 'moesif_api/http/http_call_back.rb'
16
- require_relative 'moesif_api/http/http_client.rb'
17
- require_relative 'moesif_api/http/http_method_enum.rb'
18
- require_relative 'moesif_api/http/http_request.rb'
19
- require_relative 'moesif_api/http/http_response.rb'
20
- require_relative 'moesif_api/http/http_context.rb'
21
- require_relative 'moesif_api/http/unirest_client.rb'
22
-
23
- # Models
24
- require_relative 'moesif_api/models/base_model.rb'
25
- require_relative 'moesif_api/models/event_request_model.rb'
26
- require_relative 'moesif_api/models/event_model.rb'
27
- require_relative 'moesif_api/models/event_response_model.rb'
28
- require_relative 'moesif_api/models/status_model.rb'
29
-
30
- # Controllers
31
- require_relative 'moesif_api/controllers/base_controller.rb'
32
- require_relative 'moesif_api/controllers/api_controller.rb'
33
- require_relative 'moesif_api/controllers/health_controller.rb'
1
+
2
+ require 'openssl'
3
+ require 'json'
4
+ require 'unirest'
5
+
6
+ # Exceptions
7
+ require_relative 'moesif_api/exceptions/api_exception.rb'
8
+
9
+ # Helper Files
10
+ require_relative 'moesif_api/api_helper.rb'
11
+ require_relative 'moesif_api/configuration.rb'
12
+ require_relative 'moesif_api/moesif_api_client.rb'
13
+
14
+ # Http
15
+ require_relative 'moesif_api/http/http_call_back.rb'
16
+ require_relative 'moesif_api/http/http_client.rb'
17
+ require_relative 'moesif_api/http/http_method_enum.rb'
18
+ require_relative 'moesif_api/http/http_request.rb'
19
+ require_relative 'moesif_api/http/http_response.rb'
20
+ require_relative 'moesif_api/http/http_context.rb'
21
+ require_relative 'moesif_api/http/unirest_client.rb'
22
+
23
+ # Models
24
+ require_relative 'moesif_api/models/base_model.rb'
25
+ require_relative 'moesif_api/models/event_request_model.rb'
26
+ require_relative 'moesif_api/models/event_model.rb'
27
+ require_relative 'moesif_api/models/event_response_model.rb'
28
+ require_relative 'moesif_api/models/status_model.rb'
29
+
30
+ # Controllers
31
+ require_relative 'moesif_api/controllers/base_controller.rb'
32
+ require_relative 'moesif_api/controllers/api_controller.rb'
33
+ require_relative 'moesif_api/controllers/health_controller.rb'