stage-ruby 0.0.02 → 0.0.03

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5fca366a510de64357d0fe5b697797ea9ce0915fbde30e1cbff1c5c0a131a311
4
- data.tar.gz: de34dfc043afd1b479f595536a34de81f8bde868e62aa32e7942f2a5980089b0
3
+ metadata.gz: a8d7dd1333a2e7a46ab3a03c46d6de8408b365980d779926698c884137b2d93e
4
+ data.tar.gz: 1e4ec0c51ca67372c5b803fcfbe73243422ae360898083a63665299547d62fce
5
5
  SHA512:
6
- metadata.gz: 693fae7376e6b09005bc78d00d03450fb1e427a15ed066a562000ddcc244bbe2b9a72c6bd2f44930acbec084d64ebbfa74e9a0b40d07fef6db6a72c1bde0408b
7
- data.tar.gz: 28fa37e7a9be6100109ea9b570346a28a5a096450525d742afcc5cfb8d7b42c109773a6090574fb79dead0536ac542315fc64ce5f6a7313ea9b4e5646929b32f
6
+ metadata.gz: 1b694ed28479e23f7ffa1d99806ac9dd2750908f5ba0e0bc4a37228d6e43c9164a4953e805a23e51227e37bbb92619369e19d4c2210c0c4fc02a188b9bfd3162
7
+ data.tar.gz: 1ea07c3cb282a46d09d36a5aeb7e0fb5c9b7f7de18ff0991af675a8f410f49dd06ee3eea0a2bf432bf83b6aeacbd91df49cdcda2969dee8789b13daa9aa9c475
data/README.md CHANGED
@@ -47,7 +47,9 @@ rvm use 3.0.0@stage-ruby
47
47
  bundle install
48
48
  ```
49
49
 
50
- ### 1.2. Build Gem and Install Locally
50
+ ### 1.2. Build and Publish `stage-ruby` Gem Locally
51
+
52
+ To build and publish `stage-ruby` gem locally for development or test, follow these steps:
51
53
 
52
54
  1. Build Ruby code into a gem:
53
55
 
@@ -61,19 +63,43 @@ gem build stage-ruby.gemspec
61
63
  gem install ./stage-ruby-{VERSION}.gem
62
64
  ```
63
65
 
64
- ## 2. Using `stage-ruby` Gem
66
+ To find the installation directory, run the following command: `rvm gemdir`.
67
+
68
+ ### 1.3. Build and Publish `stage-ruby` Gem to RubyGems.org
69
+
70
+ Before proceeding, please see the RubyGems's documentation on how to publish a gem
71
+ [here](https://guides.rubygems.org/publishing/). To build and publish `stage-ruby` gem to
72
+ [RubyGems.org](https://guides.rubygems.org/), follow these steps:
73
+
74
+ 1. Either create an account on RubyGems.org or use an existing account (username: `dennis_stage`, password: see
75
+ the password stored in Doppler's `RUBY_GEMS_PASSWORD`, under the `general` environment).
65
76
 
66
- To use a locally installed `stage-ruby` gem, add the following to your project's Gemfile, where `{GEM_DIR}` is your
67
- local gem installation directory (run `rvm gemdir` to find out):
77
+ 2. Build Ruby code into a gem:
68
78
 
69
79
  ```shell
70
- gem 'stage-ruby', "~> 0.0.01", :path => '{GEM_DIR}'
80
+ gem build stage-ruby.gemspec
71
81
  ```
72
82
 
73
- To use the `stage-ruby` that's uploaded to a gem service, add the following to your project's Gemfile, where `{VERSION}`
74
- is the gem's version number:
83
+ 2. Push `stage-ruby` to RubyGems.org, where `{VERSION}` is the gem's version number (enter your username and password
84
+ when prompted):
75
85
 
86
+ ```shell
87
+ gem push stage-ruby-{VERSION}.gem
76
88
  ```
89
+
90
+ ## 2. Using `stage-ruby` Gem
91
+
92
+ When the `stage-ruby` gem is installed locally, add the following to your project's Gemfile, where `{VERSION}` is
93
+ the gem's version number, and `{GEM_DIR}` is your local gem installation directory (again, `rvm gemdir` to find out):
94
+
95
+ ```ruby
96
+ gem 'stage-ruby', '~> {VERSION}', :path => '{GEM_DIR}'
97
+ ```
98
+
99
+ To use the `stage-ruby` from RubyGems.org, add the following to your project's Gemfile, where `{VERSION}` is the gem's
100
+ version number:
101
+
102
+ ```ruby
77
103
  gem 'stage-ruby', '~> {VERSION}'
78
104
  ```
79
105
 
@@ -105,7 +131,8 @@ begin
105
131
  new_user = api_instance.create_user(user_identifier, feature_identifier: 'BASIC_PLAN')
106
132
  p "Created user: #{new_user}"
107
133
 
108
- result = api_instance.has_access(user_identifier, feature_identifier: 'BASIC_PLAN')
134
+ mark_accessed = true
135
+ result = api_instance.has_access(user_identifier, feature_identifier: 'BASIC_PLAN', mark_accessed)
109
136
  p "User #{user_identifier} has access to plan: #{result}"
110
137
 
111
138
  updated_user = api_instance.update_user_plan(user_identifier, feature_identifier: 'PRO_PLAN')
@@ -121,8 +148,9 @@ end
121
148
  | Class | Method | HTTP request | Description |
122
149
  |-------------------|-----------------------------------------------------------|-----------------------------------------------------|--------------------------------------------------------|
123
150
  | *Stage::StageApi* | [**create_user**](docs/StageApi.md#create_user) | **POST** /sdk-api/v1/users | Creates a user and assigning it to a pre-defined role. |
151
+ | *Stage::StageApi* | [**get_plans**](docs/StageApi.md#get_plans) | **GET** /sdk-api/v1/plans | Gets all plans. |
124
152
  | *Stage::StageApi* | [**has_access**](docs/StageApi.md#has_access) | **GET** /sdk-api/v1/users/{userIdentifier}/features | Checks if a user has access to the identified feature. |
125
- | *Stage::StageApi* | [**update_user_plan**](docs/StageApi.md#update_user_plan) | **PUT** /sdk-api/v1/users/{userIdentifier}/plans | Updates a user's plan.. |
153
+ | *Stage::StageApi* | [**update_user_plan**](docs/StageApi.md#update_user_plan) | **PUT** /sdk-api/v1/users/{userIdentifier}/plans | Updates a user's plan. |
126
154
 
127
155
  ## 5. Documentation for Models
128
156
 
@@ -130,8 +158,11 @@ end
130
158
  - [Stage::AccessForm](docs/AccessForm.md)
131
159
  - [Stage::ClientUserForm](docs/ClientUserForm.md)
132
160
  - [Stage::ClientUserObjectForm](docs/ClientUserObjectForm.md)
161
+ - [Stage::FeatureObjectForm](docs/FeatureObjectForm.md)
133
162
  - [Stage::Field](docs/Field.md)
163
+ - [Stage::PlanObjectForm](docs/PlanObjectForm.md)
134
164
  - [Stage::StageError](docs/StageError.md)
165
+ - [Stage::StageUserObjectForm](docs/StageUserObjectForm.md)
135
166
 
136
167
  ## 6. Documentation for Authorization
137
168
 
@@ -140,4 +171,3 @@ end
140
171
  - **Type**: API key
141
172
  - **API key parameter name**: Authorization
142
173
  - **Location**: HTTP header
143
-
@@ -5,6 +5,7 @@ Name | Type | Description | Notes
5
5
  ------------ | ------------- | ------------- | -------------
6
6
  **arena_id** | **Integer** | The Arena ID of the client user. | [optional]
7
7
  **created_at** | **DateTime** | The creation date. | [optional]
8
+ **created_by** | [**StageUserObjectForm**](StageUserObjectForm.md) | | [optional]
8
9
  **deleted** | **BOOLEAN** | A boolean value indicating whether the client user is deleted or not. | [optional]
9
10
  **id** | **Integer** | The ID of the client user. | [optional]
10
11
  **identifier** | **String** | A client user identifier. | [optional]
@@ -0,0 +1,11 @@
1
+ # Stage::FeatureObjectForm
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **description** | **String** | Feature description. | [optional]
7
+ **identifier** | **String** | Feature identifier. | [optional]
8
+ **limit** | **Integer** | Feature limit. | [optional]
9
+ **name** | **String** | Feature name. | [optional]
10
+ **order** | **Integer** | Feature order. | [optional]
11
+
@@ -0,0 +1,12 @@
1
+ # Stage::PlanObjectForm
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **description** | **String** | Plan description. | [optional]
7
+ **features** | [**Array<FeatureObjectForm>**](FeatureObjectForm.md) | Features associated to this plan. | [optional]
8
+ **identifier** | **String** | Plan identifier. | [optional]
9
+ **name** | **String** | Plan name. | [optional]
10
+ **order** | **Integer** | Plan order. | [optional]
11
+ **stripe_product_id** | **String** | Stripe product identifier. | [optional]
12
+
data/docs/StageApi.md CHANGED
@@ -5,8 +5,9 @@ All URIs are relative to *//localhost:8080/*
5
5
  Method | HTTP request | Description
6
6
  ------------- | ------------- | -------------
7
7
  [**create_user**](StageApi.md#create_user) | **POST** /sdk-api/v1/users | Creates a user and assigning it to a pre-defined role.
8
+ [**get_plans**](StageApi.md#get_plans) | **GET** /sdk-api/v1/plans | Gets all plans.
8
9
  [**has_access**](StageApi.md#has_access) | **GET** /sdk-api/v1/users/{userIdentifier}/features | Checks if a user has access to the identified feature.
9
- [**update_user_plan**](StageApi.md#update_user_plan) | **PUT** /sdk-api/v1/users/{userIdentifier}/plans | Updates a user's plan..
10
+ [**update_user_plan**](StageApi.md#update_user_plan) | **PUT** /sdk-api/v1/users/{userIdentifier}/plans | Updates a user's plan.
10
11
 
11
12
  # **create_user**
12
13
  > ClientUserForm create_user(body)
@@ -59,8 +60,54 @@ Name | Type | Description | Notes
59
60
 
60
61
 
61
62
 
63
+ # **get_plans**
64
+ > Array<PlanObjectForm> get_plans
65
+
66
+ Gets all plans.
67
+
68
+ ### Example
69
+ ```ruby
70
+ # load the gem
71
+ require 'stage-ruby'
72
+ # setup authorization
73
+ Stage.configure do |config|
74
+ # Configure API key authorization: stage-api-token
75
+ config.api_key['Authorization'] = 'YOUR API KEY'
76
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
77
+ #config.api_key_prefix['Authorization'] = 'Bearer'
78
+ end
79
+
80
+ api_instance = Stage::StageApi.new
81
+
82
+ begin
83
+ #Gets all plans.
84
+ result = api_instance.get_plans
85
+ p result
86
+ rescue Stage::ApiError => e
87
+ puts "Exception when calling StageApi->get_plans: #{e}"
88
+ end
89
+ ```
90
+
91
+ ### Parameters
92
+ This endpoint does not need any parameter.
93
+
94
+ ### Return type
95
+
96
+ [**Array<PlanObjectForm>**](PlanObjectForm.md)
97
+
98
+ ### Authorization
99
+
100
+ [stage-api-token](../README.md#stage-api-token)
101
+
102
+ ### HTTP request headers
103
+
104
+ - **Content-Type**: Not defined
105
+ - **Accept**: application/json
106
+
107
+
108
+
62
109
  # **has_access**
63
- > AccessForm has_access(identifiers, user_identifier)
110
+ > AccessForm has_access(identifiers, user_identifier, mark_accessed)
64
111
 
65
112
  Checks if a user has access to the identified feature.
66
113
 
@@ -77,13 +124,14 @@ Stage.configure do |config|
77
124
  end
78
125
 
79
126
  api_instance = Stage::StageApi.new
80
- identifiers = ['identifiers_example'] # Array<String> | identifiers
127
+ identifiers = ['identifiers_example'] # Array<String> | The identifiers of the features being accessed.
128
+ mark_accessed = true # BOOLEAN | Whether this has-access check should mark the features as having been accessed.
81
129
  user_identifier = 'user_identifier_example' # String | The identifier of the user who is accessing the feature.
82
130
 
83
131
 
84
132
  begin
85
133
  #Checks if a user has access to the identified feature.
86
- result = api_instance.has_access(identifiers, user_identifier)
134
+ result = api_instance.has_access(identifiers, user_identifier, mark_accessed)
87
135
  p result
88
136
  rescue Stage::ApiError => e
89
137
  puts "Exception when calling StageApi->has_access: #{e}"
@@ -94,7 +142,8 @@ end
94
142
 
95
143
  Name | Type | Description | Notes
96
144
  ------------- | ------------- | ------------- | -------------
97
- **identifiers** | [**Array&lt;String&gt;**](String.md)| identifiers |
145
+ **identifiers** | [**Array&lt;String&gt;**](String.md)| The identifiers of the features being accessed. |
146
+ **mark_accessed** | **BOOLEAN**| Whether this has-access check should mark the features as having been accessed. |
98
147
  **user_identifier** | **String**| The identifier of the user who is accessing the feature. |
99
148
 
100
149
  ### Return type
@@ -115,7 +164,7 @@ Name | Type | Description | Notes
115
164
  # **update_user_plan**
116
165
  > ClientUserForm update_user_plan(bodyuser_identifier)
117
166
 
118
- Updates a user's plan..
167
+ Updates a user's plan.
119
168
 
120
169
  ### Example
121
170
  ```ruby
@@ -135,7 +184,7 @@ user_identifier = 'user_identifier_example' # String | The identifier of the use
135
184
 
136
185
 
137
186
  begin
138
- #Updates a user's plan..
187
+ #Updates a user's plan.
139
188
  result = api_instance.update_user_plan(bodyuser_identifier)
140
189
  p result
141
190
  rescue Stage::ApiError => e
@@ -0,0 +1,11 @@
1
+ # Stage::StageUserObjectForm
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **arena_id** | **Integer** | | [optional]
7
+ **deleted** | **BOOLEAN** | | [optional]
8
+ **email** | **String** | | [optional]
9
+ **id** | **Integer** | | [optional]
10
+ **password** | **String** | | [optional]
11
+
data/lib/.DS_Store ADDED
Binary file
Binary file
@@ -84,35 +84,85 @@ module Stage
84
84
  return data, status_code, headers
85
85
  end
86
86
 
87
+ # Gets all plans.
88
+ # @return [Array<PlanObjectForm>]
89
+ def get_plans()
90
+ data, _status_code, _headers = get_plans_with_http_info({})
91
+ data
92
+ end
93
+
94
+ # Gets all plans.
95
+ # @param [Hash] opts the optional parameters
96
+ # @return [Array<(Array<PlanObjectForm>, Integer, Hash)>] Array<PlanObjectForm> data, response status code and response headers
97
+ def get_plans_with_http_info(opts = {})
98
+ if @api_client.config.debugging
99
+ @api_client.config.logger.debug 'Calling API: StageApi.get_plans ...'
100
+ end
101
+ # resource path
102
+ local_var_path = PLANS_PATH
103
+
104
+ # query parameters
105
+ query_params = opts[:query_params] || {}
106
+
107
+ # header parameters
108
+ header_params = opts[:header_params] || {}
109
+ # HTTP header 'Accept' (if needed)
110
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
111
+
112
+ # form parameters
113
+ form_params = opts[:form_params] || {}
114
+
115
+ # http body (model)
116
+ post_body = opts[:body]
117
+
118
+ return_type = opts[:return_type] || 'Array<PlanObjectForm>'
119
+
120
+ auth_names = opts[:auth_names] || ['stage-api-token']
121
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
122
+ :header_params => header_params,
123
+ :query_params => query_params,
124
+ :form_params => form_params,
125
+ :body => post_body,
126
+ :auth_names => auth_names,
127
+ :return_type => return_type)
128
+
129
+ if @api_client.config.debugging
130
+ @api_client.config.logger.debug "API called: StageApi#get_plans\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
131
+ end
132
+ return data, status_code, headers
133
+ end
134
+
87
135
  # Checks if a user has access to the identified feature.
88
136
  # @param user_identifier The identifier of the user who is accessing the feature.
89
137
  # @param feature_identifiers identifiers
138
+ # @param mark_accessed Whether this has-access check should mark the features as having been accessed.
90
139
  # @return [AccessForm]
91
- def has_access_verbose(user_identifier, feature_identifiers)
92
- data, _status_code, _headers = has_access_with_http_info(user_identifier, feature_identifiers, {})
140
+ def has_access_verbose(user_identifier, feature_identifiers, mark_accessed)
141
+ data, _status_code, _headers = has_access_with_http_info(user_identifier, feature_identifiers, mark_accessed, {})
93
142
  data
94
143
  end
95
144
 
96
- def has_access(user_identifier, feature_identifier)
97
- has_access_to_all(user_identifier, [feature_identifier])
145
+ def has_access(user_identifier, feature_identifier, mark_accessed)
146
+ has_access_to_all(user_identifier, [feature_identifier], mark_accessed)
98
147
  end
99
148
 
100
- def has_access_to_any(user_identifier, feature_identifiers)
101
- data, _status_code, _headers = has_access_with_http_info(user_identifier, feature_identifiers, {})
149
+ def has_access_to_any(user_identifier, feature_identifiers, mark_accessed)
150
+ data, _status_code, _headers = has_access_with_http_info(user_identifier, feature_identifiers, mark_accessed, {})
102
151
  data.features.map { |feature| feature[:hasAccess] }.any?
103
152
  end
104
153
 
105
- def has_access_to_all(user_identifier, feature_identifiers)
106
- data, _status_code, _headers = has_access_with_http_info(user_identifier, feature_identifiers, {})
154
+ def has_access_to_all(user_identifier, feature_identifiers, mark_accessed)
155
+ data, _status_code, _headers = has_access_with_http_info(user_identifier, feature_identifiers, mark_accessed, {})
107
156
  data.features.map { |feature| feature[:hasAccess] }.all?
108
157
  end
109
158
 
110
159
  # Checks if a user has access to the identified feature.
111
- # @param feature_identifiers identifiers
112
160
  # @param user_identifier The identifier of the user who is accessing the feature.
161
+ # @param feature_identifiers identifiers
162
+ # @param mark_accessed Whether this has-access check should mark the features as having been accessed.
113
163
  # @param [Hash] opts the optional parameters
114
164
  # @return [Array<(AccessForm, Integer, Hash)>] AccessForm data, response status code and response headers
115
- def has_access_with_http_info(user_identifier, feature_identifiers, opts = {})
165
+ def has_access_with_http_info(user_identifier, feature_identifiers, mark_accessed, opts = {})
116
166
  if @api_client.config.debugging
117
167
  @api_client.config.logger.debug 'Calling API: StageApi.has_access ...'
118
168
  end
@@ -130,6 +180,7 @@ module Stage
130
180
  # query parameters
131
181
  query_params = opts[:query_params] || {}
132
182
  query_params[:'identifiers'] = @api_client.build_collection_param(feature_identifiers, :csv)
183
+ query_params[:'markAccessed'] = mark_accessed
133
184
 
134
185
  # header parameters
135
186
  header_params = opts[:header_params] || {}
@@ -159,7 +210,7 @@ module Stage
159
210
  return data, status_code, headers
160
211
  end
161
212
 
162
- # Updates a user's plan..
213
+ # Updates a user's plan.
163
214
  # @param user_identifier The identifier of the user.
164
215
  # @param plan_identifier The plan identifier.
165
216
  # @return [ClientUserForm]
@@ -176,7 +227,7 @@ module Stage
176
227
  data
177
228
  end
178
229
 
179
- # Updates a user&#x27;s plan..
230
+ # Updates a user&#x27;s plan.
180
231
  # @param user_identifier The identifier of the user.
181
232
  # @param body The payload containing the information to update a user&#x27;s plan. Only identifier and planIdentifier fields are required.
182
233
  # @param [Hash] opts the optional parameters
@@ -19,6 +19,8 @@ module Stage
19
19
  # The creation date.
20
20
  attr_accessor :created_at
21
21
 
22
+ attr_accessor :created_by
23
+
22
24
  # A boolean value indicating whether the client user is deleted or not.
23
25
  attr_accessor :deleted
24
26
 
@@ -39,6 +41,7 @@ module Stage
39
41
  {
40
42
  :'arena_id' => :'arenaId',
41
43
  :'created_at' => :'createdAt',
44
+ :'created_by' => :'createdBy',
42
45
  :'deleted' => :'deleted',
43
46
  :'id' => :'id',
44
47
  :'identifier' => :'identifier',
@@ -52,6 +55,7 @@ module Stage
52
55
  {
53
56
  :'arena_id' => :'Object',
54
57
  :'created_at' => :'Object',
58
+ :'created_by' => :'Object',
55
59
  :'deleted' => :'Object',
56
60
  :'id' => :'Object',
57
61
  :'identifier' => :'Object',
@@ -89,6 +93,10 @@ module Stage
89
93
  self.created_at = attributes[:'created_at']
90
94
  end
91
95
 
96
+ if attributes.key?(:'created_by')
97
+ self.created_by = attributes[:'created_by']
98
+ end
99
+
92
100
  if attributes.key?(:'deleted')
93
101
  self.deleted = attributes[:'deleted']
94
102
  end
@@ -130,6 +138,7 @@ module Stage
130
138
  self.class == o.class &&
131
139
  arena_id == o.arena_id &&
132
140
  created_at == o.created_at &&
141
+ created_by == o.created_by &&
133
142
  deleted == o.deleted &&
134
143
  id == o.id &&
135
144
  identifier == o.identifier &&
@@ -146,7 +155,7 @@ module Stage
146
155
  # Calculates hash code according to all attributes.
147
156
  # @return [Integer] Hash code
148
157
  def hash
149
- [arena_id, created_at, deleted, id, identifier, plan_id, plan_identifier].hash
158
+ [arena_id, created_at, created_by, deleted, id, identifier, plan_id, plan_identifier].hash
150
159
  end
151
160
 
152
161
  # Builds the object from hash