Class: JsonClient::Base
- Inherits:
-
Object
show all
- Extended by:
- DSL
- Defined in:
- lib/json_client/base.rb
Constant Summary
collapse
- J =
::JsonClient
- RS =
J::Requests
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from DSL
requests, requests_collector, responses, responses_collector, serializers, serializers_collector
Constructor Details
#initialize(uri_builder, config) ⇒ Base
37
38
39
40
41
42
|
# File 'lib/json_client/base.rb', line 37
def initialize(uri_builder, config)
@client_id = config[:client_id]
@secret_key = config[:secret_key]
@uri_builder = uri_builder
validate_variables
end
|
Instance Attribute Details
#client_id ⇒ Object
Returns the value of attribute client_id.
11
12
13
|
# File 'lib/json_client/base.rb', line 11
def client_id
@client_id
end
|
#secret_key ⇒ Object
Returns the value of attribute secret_key.
11
12
13
|
# File 'lib/json_client/base.rb', line 11
def secret_key
@secret_key
end
|
#uri_builder ⇒ Object
Returns the value of attribute uri_builder.
11
12
13
|
# File 'lib/json_client/base.rb', line 11
def uri_builder
@uri_builder
end
|
Instance Method Details
#create(model) ⇒ Object
52
53
54
|
# File 'lib/json_client/base.rb', line 52
def create(model)
result(:create, model)
end
|
#destroy(id) ⇒ Object
60
61
62
|
# File 'lib/json_client/base.rb', line 60
def destroy(id)
result(:destroy, nil, id)
end
|
#index ⇒ Object
44
45
46
|
# File 'lib/json_client/base.rb', line 44
def index
result(:index, nil)
end
|
#show(id) ⇒ Object
48
49
50
|
# File 'lib/json_client/base.rb', line 48
def show(id)
result(:show, nil, id)
end
|
#update(id, model) ⇒ Object
56
57
58
|
# File 'lib/json_client/base.rb', line 56
def update(id, model)
result(:update, model, id)
end
|