line-bot-api 1.16.0 → 1.17.0

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: a645b77594506a826cd1009e65bed3f4af60674579d3d23403ca32136cd697f7
4
- data.tar.gz: cdeee7ee13ce1c099342573e4514b57e49cb08dd1f8835a609a22c9f8810a52d
3
+ metadata.gz: e837c0acd52ebd33855c78b8708ad54ab2837dc76576bb386bbe4861eeae20e3
4
+ data.tar.gz: 9e175c41953a8603f0a1b0e35285160fe2ed63cf028296a94272a6d65dac4a9f
5
5
  SHA512:
6
- metadata.gz: f83a596fc0a844e0d4e237e197e00c8afba3c7cfc39f136897b78645cac659b87cd3103c701227ccaeffdac692af2f9a89e9250b3cc3d97c9c460078ae629c42
7
- data.tar.gz: 26f4b4ba5a7b23afb4da95bdbf3a3d4b5dd5e31e7ebfe919046944fae1ceed5c3c66e011fe3609bce511ad2523bd2721a78f30afc1a9e3021ac710723b5426ae
6
+ metadata.gz: 303b7cd0c88d07dd31fa5d4ee3d0784ba7999fb4677bd9bf3a801adad54d8926e0697ae87dc0a457593849fba0d30e2ddbeb4eba647adac5974115ad81a56b58
7
+ data.tar.gz: 1ddbcb86b9737d3d7b106489768fa9f1af38608a5eda8d0c59dd7713da4ba6a41e675677b99e26f8f6060be09e24df36a3e24bea721b2faad9d44e4ef38b144f
@@ -19,6 +19,7 @@ module Line
19
19
  module API
20
20
  DEFAULT_ENDPOINT = "https://api.line.me/v2"
21
21
  DEFAULT_BLOB_ENDPOINT = "https://api-data.line.me/v2"
22
+ DEFAULT_LIFF_ENDPOINT = "https://api.line.me/liff/v1"
22
23
 
23
24
  DEFAULT_HEADERS = {
24
25
  'Content-Type' => 'application/json; charset=UTF-8',
@@ -15,7 +15,7 @@
15
15
  module Line
16
16
  module Bot
17
17
  module API
18
- VERSION = "1.16.0"
18
+ VERSION = "1.17.0"
19
19
  end
20
20
  end
21
21
  end
@@ -66,6 +66,10 @@ module Line
66
66
  end
67
67
  end
68
68
 
69
+ def liff_endpoint
70
+ @liff_endpoint ||= API::DEFAULT_LIFF_ENDPOINT
71
+ end
72
+
69
73
  # @return [Hash]
70
74
  def credentials
71
75
  {
@@ -631,6 +635,192 @@ module Line
631
635
  get(endpoint, endpoint_path, credentials)
632
636
  end
633
637
 
638
+ # Gets a bot's basic information.
639
+ #
640
+ # @return [Net::HTTPResponse]
641
+ def get_bot_info
642
+ channel_token_required
643
+
644
+ endpoint_path = '/bot/info'
645
+ get(endpoint, endpoint_path, credentials)
646
+ end
647
+
648
+ def get_liff_apps
649
+ channel_token_required
650
+
651
+ endpoint_path = '/apps'
652
+ get(liff_endpoint, endpoint_path, credentials)
653
+ end
654
+
655
+ def create_liff_app(app)
656
+ channel_token_required
657
+
658
+ endpoint_path = '/apps'
659
+ post(liff_endpoint, endpoint_path, app.to_json, credentials)
660
+ end
661
+
662
+ def update_liff_app(liff_id, app)
663
+ channel_token_required
664
+
665
+ endpoint_path = "/apps/#{liff_id}"
666
+ put(liff_endpoint, endpoint_path, app.to_json, credentials)
667
+ end
668
+
669
+ def delete_liff_app(liff_id)
670
+ channel_token_required
671
+
672
+ endpoint_path = "/apps/#{liff_id}"
673
+ delete(liff_endpoint, endpoint_path, credentials)
674
+ end
675
+
676
+ # Create an audience group by uploading user_ids
677
+ #
678
+ # Parameters are described here.
679
+ # https://developers.line.biz/en/reference/messaging-api/#create-upload-audience-group
680
+ #
681
+ # @param params [Hash] options
682
+ #
683
+ # @return [Net::HTTPResponse] This response includes an audience_group_id.
684
+ def create_user_id_audience(params)
685
+ channel_token_required
686
+
687
+ endpoint_path = '/bot/audienceGroup/upload'
688
+ post(endpoint, endpoint_path, params.to_json, credentials)
689
+ end
690
+
691
+ # Update an audience group
692
+ #
693
+ # Parameters are described here.
694
+ # https://developers.line.biz/en/reference/messaging-api/#update-upload-audience-group
695
+ #
696
+ # @param params [Hash] options
697
+ #
698
+ # @return [Net::HTTPResponse] This response includes an audience_group_id.
699
+ def update_user_id_audience(params)
700
+ channel_token_required
701
+
702
+ endpoint_path = '/bot/audienceGroup/upload'
703
+ put(endpoint, endpoint_path, params.to_json, credentials)
704
+ end
705
+
706
+ # Create an audience group of users that clicked a URL in a message sent in the past
707
+ #
708
+ # Parameters are described here.
709
+ # https://developers.line.biz/en/reference/messaging-api/#create-click-audience-group
710
+ #
711
+ # @param params [Hash] options
712
+ #
713
+ # @return [Net::HTTPResponse] This response includes an audience_group_id.
714
+ def create_click_audience(params)
715
+ channel_token_required
716
+
717
+ endpoint_path = '/bot/audienceGroup/click'
718
+ post(endpoint, endpoint_path, params.to_json, credentials)
719
+ end
720
+
721
+ # Create an audience group of users that opened a message sent in the past
722
+ #
723
+ # Parameters are described here.
724
+ # https://developers.line.biz/en/reference/messaging-api/#create-imp-audience-group
725
+ #
726
+ # @param params [Hash] options
727
+ #
728
+ # @return [Net::HTTPResponse] This response includes an audience_group_id.
729
+ def create_impression_audience(params)
730
+ channel_token_required
731
+
732
+ endpoint_path = '/bot/audienceGroup/imp'
733
+ post(endpoint, endpoint_path, params.to_json, credentials)
734
+ end
735
+
736
+ # Rename an existing audience group
737
+ #
738
+ # @param audience_group_id [Integer]
739
+ # @param description [String]
740
+ #
741
+ # @return [Net::HTTPResponse]
742
+ def rename_audience(audience_group_id, description)
743
+ channel_token_required
744
+
745
+ endpoint_path = "/bot/audienceGroup/#{audience_group_id}/updateDescription"
746
+ body = {description: description}
747
+ put(endpoint, endpoint_path, body.to_json, credentials)
748
+ end
749
+
750
+ # Delete an existing audience group
751
+ #
752
+ # Parameters are described here.
753
+ # https://developers.line.biz/en/reference/messaging-api/#delete-audience-group
754
+ #
755
+ # @param audience_group_id [Integer]
756
+ #
757
+ # @return [Net::HTTPResponse]
758
+ def delete_audience(audience_group_id)
759
+ channel_token_required
760
+
761
+ endpoint_path = "/bot/audienceGroup/#{audience_group_id}"
762
+ delete(endpoint, endpoint_path, credentials)
763
+ end
764
+
765
+ # Get audience group data
766
+ #
767
+ # Parameters are described here.
768
+ # https://developers.line.biz/en/reference/messaging-api/#get-audience-group
769
+ #
770
+ # @param audience_group_id [Integer]
771
+ #
772
+ # @return [Net::HTTPResponse]
773
+ def get_audience(audience_group_id)
774
+ channel_token_required
775
+
776
+ endpoint_path = "/bot/audienceGroup/#{audience_group_id}"
777
+ get(endpoint, endpoint_path, credentials)
778
+ end
779
+
780
+ # Get data for more than one audience group
781
+ #
782
+ # Parameters are described here.
783
+ # https://developers.line.biz/en/reference/messaging-api/#get-audience-groups
784
+ #
785
+ # @param params [Hash] key name `page` is required
786
+ #
787
+ # @return [Net::HTTPResponse]
788
+ def get_audiences(params)
789
+ channel_token_required
790
+
791
+ endpoint_path = "/bot/audienceGroup/list?" + URI.encode_www_form(params)
792
+ get(endpoint, endpoint_path, credentials)
793
+ end
794
+
795
+ # Get the authority level of the audience
796
+ #
797
+ # Parameters are described here.
798
+ # https://developers.line.biz/en/reference/messaging-api/#get-authority-level
799
+ #
800
+ # @return [Net::HTTPResponse]
801
+ def get_audience_authority_level
802
+ channel_token_required
803
+
804
+ endpoint_path = "/bot/audienceGroup/authorityLevel"
805
+ get(endpoint, endpoint_path, credentials)
806
+ end
807
+
808
+ # Change the authority level of the audience
809
+ #
810
+ # Parameters are described here.
811
+ # https://developers.line.biz/en/reference/messaging-api/#change-authority-level
812
+ #
813
+ # @param authority_level [String] value must be `PUBLIC` or `PRIVATE`
814
+ #
815
+ # @return [Net::HTTPResponse]
816
+ def update_audience_authority_level(authority_level)
817
+ channel_token_required
818
+
819
+ endpoint_path = "/bot/audienceGroup/authorityLevel"
820
+ body = {authorityLevel: authority_level}
821
+ put(endpoint, endpoint_path, body.to_json, credentials)
822
+ end
823
+
634
824
  # Fetch data, get content of specified URL.
635
825
  #
636
826
  # @param endpoint_base [String]
@@ -656,6 +846,19 @@ module Line
656
846
  httpclient.post(endpoint_base + endpoint_path, payload, headers)
657
847
  end
658
848
 
849
+ # Put data, get content of specified URL.
850
+ #
851
+ # @param endpoint_base [String]
852
+ # @param endpoint_path [String]
853
+ # @param payload [String or NilClass]
854
+ # @param headers [Hash]
855
+ #
856
+ # @return [Net::HTTPResponse]
857
+ def put(endpoint_base, endpoint_path, payload = nil, headers = {})
858
+ headers = API::DEFAULT_HEADERS.merge(headers)
859
+ httpclient.put(endpoint_base + endpoint_path, payload, headers)
860
+ end
861
+
659
862
  # Delete content of specified URL.
660
863
  #
661
864
  # @param endpoint_base [String]
@@ -57,6 +57,11 @@ module Line
57
57
  http(uri).post(uri.request_uri, payload, header)
58
58
  end
59
59
 
60
+ def put(url, payload, header = {})
61
+ uri = URI(url)
62
+ http(uri).put(uri.request_uri, payload, header)
63
+ end
64
+
60
65
  def delete(url, header = {})
61
66
  uri = URI(url)
62
67
  http(uri).delete(uri.request_uri, header)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: line-bot-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 1.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - LINE Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-13 00:00:00.000000000 Z
11
+ date: 2020-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -121,7 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubygems_version: 3.1.2
124
+ rubyforge_project:
125
+ rubygems_version: 2.7.6
125
126
  signing_key:
126
127
  specification_version: 4
127
128
  summary: SDK of the LINE Messaging API