Comments (4)
Hi! You could do that as follows:
stub_dynamodb_client.stub_responses(
:get_item,
[
{ item: {"post_id" => 1 } },
{ item: {"comment_id" => 2 } },
],
)
To demostrate via repl:
[13] pry(Aws)> stub_dynamodb_client.get_item(table_name: '', key: {})
[Aws::DynamoDB::Client 200 0.000822 0 retries] get_item(table_name:"foo",key:{})
=> #<struct Aws::DynamoDB::Types::GetItemOutput item={"post_id"=>0.1e1}, consumed_capacity=nil>
[14] pry(Aws)>
[14] pry(Aws)> stub_dynamodb_client.get_item(table_name: '', key: {})
[Aws::DynamoDB::Client 200 0.000596 0 retries] get_item(table_name:"foo",key:{})
=> #<struct Aws::DynamoDB::Types::GetItemOutput item={"comment_id"=>0.2e1}, consumed_capacity=nil>
I noticed that the linked docs for V2. Here's a link to V3 incase you are using that version.
The last section in the documentation, noted as "Stubbing Multiple Responses" expands on the multiple stub responses so I suggest checking that out. Hope this helps!
from aws-sdk-ruby.
@jterapin wow, thanks you <3
from aws-sdk-ruby.
This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
from aws-sdk-ruby.
I believe also instead of an array you can pass multiple hash arguments.
from aws-sdk-ruby.
Related Issues (20)
- Aws::Errors::MissingCredentialsError exception in ECS when using TaskRoleArn HOT 10
- Gem displays deprecation warning in ruby 3.3 HOT 7
- Report errors leading to failure to abort multipart upload HOT 3
- Unclear or incorrect parameters for call to get_queue_attributes HOT 2
- `AWS_EC2_METADATA_SERVICE_ENDPOINT` port is ignored HOT 4
- Fix Seahorse::Client::Plugin::PluginOption shape variation warnings HOT 6
- Rekognition `GetContentModeration` response differs from documentation HOT 7
- NameError: uninitialized constant Aws::Rest::ContentTypeHandler after upgrading aws-sdk-s3 from 1.146.1 to 1.147.0 HOT 7
- SimpleDB gem issues with aws-sdk-core >= 3.192.0 HOT 4
- EC2::Client#describe_security_groups undocumented & unchecked options limitation. HOT 10
- Seahorse http connection pool may crash after fork(2) HOT 7
- aws-eventstream not available in Ruby 3.2 lambda runtime HOT 6
- presigned_url always adds content-type to signed headers HOT 3
- Aws::EC2::Resources raises `InvalidParameterCombination` when some parameters are specified HOT 2
- aws-sdk-core >= 3.192.0 may be not compatible with AWS SQS APIs in XML format HOT 8
- In Ruby, S3 get_object_attributes() breaks in aws-sdk-core v3.192.0 and newer. HOT 5
- Content Type error in BedrockRuntime client on latest aws-sdk-core version HOT 5
- CloudFront KeyValueStore can't work HOT 3
- aws-sdk-s3: intermittent SignatureDoesNotMatch errors HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sdk-ruby.