Class: Cased::Policy
- Inherits:
-
Object
- Object
- Cased::Policy
- Defined in:
- lib/cased/policy.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #event(id) ⇒ Object
- #events(phrase: nil, variables: {}) ⇒ Object
-
#initialize(api_key:) ⇒ Policy
constructor
A new instance of Policy.
Constructor Details
#initialize(api_key:) ⇒ Policy
Returns a new instance of Policy.
9 10 11 12 |
# File 'lib/cased/policy.rb', line 9 def initialize(api_key:) @api_key = api_key @client = Cased::Clients.create(api_key: @api_key) end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/cased/policy.rb', line 7 def api_key @api_key end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/cased/policy.rb', line 7 def client @client end |
Instance Method Details
#event(id) ⇒ Object
18 19 20 21 |
# File 'lib/cased/policy.rb', line 18 def event(id) response = @client.get("events/#{id}") response.body end |
#events(phrase: nil, variables: {}) ⇒ Object
14 15 16 |
# File 'lib/cased/policy.rb', line 14 def events(phrase: nil, variables: {}) Query.new(@client, phrase: phrase, variables: variables) end |