peach-ruby 0.4.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22044ce025121dc6f98a9b9847815caff80ef0f16089368616b048f02e145d37
4
- data.tar.gz: ead484f3c4c9427e918fe819d5d128f0c900104b8dbfa1d6a12f03942b68715e
3
+ metadata.gz: 0b4fad84458d23aa4e454f489e0b68097d750113a0ecda05eb9b30c7edabaa66
4
+ data.tar.gz: d6c955cc91402dbc04c0760ee2d0f3fb499592beb28dc17c37cc373e5189d089
5
5
  SHA512:
6
- metadata.gz: f2a7f243046a6c61cf7ef62f5ebe3d321f2b0491a3460620f3940592e99593624388e46b5513ff6297777085554030e9cedcdf61ec9720c655291fea2a07ab80
7
- data.tar.gz: 5ba357f84e83d4d638fe3cadea472a08275b2b6d1eda30fc4b133a76dfa3edc181cfb3fb1995912c40891a3a37764650d165464ba71dc141d0e4fb7cbfa3ac08
6
+ metadata.gz: d0fa371fff331a1388be7a4791d5d551e7ece663b7918d5e4398306ee8b03898c25d6f4445d4d4f0a004c7328aa5b2966de8fa433105769b7fd406d4a443412c
7
+ data.tar.gz: 36576ba3e90d985b382b9dd9b86b723bff0768ba2eb84bef38e9f4003d98d797128e1dbfab654e7992b80932ec10c757c63019cca3599e5ff94876cc30dc7fdd
data/README.md CHANGED
@@ -45,10 +45,41 @@ Peach::TemplateMessage.deliver('wat_1234abcd', { foo: 'bar' }, contact)
45
45
 
46
46
  ## Development
47
47
 
48
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
+ ### Install dependencies
49
49
 
50
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
50
+ ```bash
51
+ bin/setup
52
+ ```
53
+
54
+ ### Run tests
55
+
56
+ ```bash
57
+ bundle exec rake spec
58
+ ```
59
+
60
+ ### Use the interactive prompt
61
+
62
+ ```bash
63
+ bin/console
64
+ ```
65
+
66
+ ### Install gem locally
67
+
68
+ ```bash
69
+ bundle exec rake install
70
+ ```
71
+
72
+ ### Release a new version
73
+
74
+ We use the [rubygems/release-gem@v1](https://github.com/rubygems/release-gem) action, which creates the tags and pushes the `.gem` file to [rubygems.org](https://rubygems.org) for us.
75
+
76
+ What we need to do then is:
77
+ 1. Update version number in `version.rb`
78
+ 2. Run `bundle install` to update `Gemfile.lock` with the new gem version
79
+ 3. Add and commit changes and create a Pull Request
80
+
81
+ The GitHub Action then should ideally take care of the rest.
51
82
 
52
83
  ## Contributing
53
84
 
54
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/peach-ruby.
85
+ Bug reports and pull requests are welcome on GitHub at https://github.com/trypeach-io/peach-ruby.
@@ -9,7 +9,8 @@ module Peach
9
9
 
10
10
  APP_EXECUTION_TYPES = {
11
11
  init: 'app_execution.init',
12
- in_progress: 'app_execution.in_progress'
12
+ in_progress: 'app_execution.in_progress',
13
+ reply_received: 'app_execution.reply_received'
13
14
  }.freeze
14
15
 
15
16
  def initialize(raw_params)
@@ -26,6 +27,10 @@ module Peach
26
27
  in_progress_request? @type
27
28
  end
28
29
 
30
+ def reply_received?
31
+ reply_received_request? @type
32
+ end
33
+
29
34
  private
30
35
 
31
36
  def parse_params(raw_params)
@@ -86,6 +91,10 @@ module Peach
86
91
  def in_progress_request?(type)
87
92
  type == APP_EXECUTION_TYPES[:in_progress]
88
93
  end
94
+
95
+ def reply_received_request?(type)
96
+ type == APP_EXECUTION_TYPES[:reply_received]
97
+ end
89
98
  end
90
99
  end
91
100
  end
@@ -11,11 +11,11 @@ module Peach
11
11
  @changes = []
12
12
  end
13
13
 
14
- def add_action(action, *args)
14
+ def add_action(action, *args, **kwargs)
15
15
  raise Peach::BadResponseError, "Action '#{action}' is not supported" unless respond_to?(action, true)
16
-
16
+
17
17
  change = { action: action }
18
- change.merge! send(action, *args)
18
+ change.merge! send(action, *args, **kwargs)
19
19
  @changes << change
20
20
  end
21
21
 
@@ -42,6 +42,12 @@ module Peach
42
42
  { prompt: prompt }
43
43
  end
44
44
 
45
+ def send_template_message(system_name, data: {})
46
+ template_message = { system_name: system_name }
47
+ template_message[:data] = data unless data.empty?
48
+ { template_message: template_message }
49
+ end
50
+
45
51
  def handoff(user_id: nil, group_id: nil, text: nil)
46
52
  handoff = {}
47
53
  handoff[:message] = { text: text } if text
data/lib/peach/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Peach
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peach-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peach Developers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-11 00:00:00.000000000 Z
11
+ date: 2024-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debug