File tree Expand file tree Collapse file tree 3 files changed +36
-3
lines changed
Expand file tree Collapse file tree 3 files changed +36
-3
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ def bitlinks
171171 #
172172 # @return [Bitly::API::Qrcode::List]
173173 def qrcodes
174- Bitly ::API ::Qrcode . list ( client : @client , group_guid : guid )
174+ Bitly ::API ::Qrcode . list_by_group ( client : @client , group_guid : guid )
175175 end
176176
177177 ##
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ def self.time_attributes
3737 # One of "on", "off" or "both". Defaults to "both".
3838 #
3939 # @return [Bitly::API::Qrcode::PaginatedList]
40- def self . list (
40+ def self . list_by_group (
4141 client :,
4242 group_guid :,
4343 size : nil ,
Original file line number Diff line number Diff line change 33RSpec . describe Bitly ::API ::Bitlink do
44 let ( :client ) { instance_double ( Bitly ::API ::Client ) }
55 let ( :qrcode_id ) { "the_qrcode_id" }
6+ let ( :group_guid ) { "the_group_guid" }
67 let ( :qrcode_data ) {
78 {
89 "qrcode_id" => qrcode_id ,
9- "group_guid" => "the_group_guid" ,
10+ "group_guid" => group_guid ,
1011 "title" => "The title" ,
1112 "render_customizations" => {
1213 "background_color" => "#ffffff" ,
119120 expect ( qrcode . image ( format : "png" ) ) . to eq ( "data:image/svg+xml;base64,..." )
120121 end
121122 end
123+
124+ describe "#list_by_group" do
125+ let ( :pagination ) {
126+ {
127+ "next" => "https://api-ssl.bit.ly/v4/groups/def456/qr-codes?page=2" ,
128+ "prev" => "" ,
129+ "total" => 100 ,
130+ "page" => 1 ,
131+ "size" => 50
132+ }
133+ }
134+ let ( :response ) {
135+ Bitly ::HTTP ::Response . new (
136+ status : "200" ,
137+ body : { qr_codes : [ qrcode_data ] , pagination : pagination } . to_json ,
138+ headers : { }
139+ )
140+ }
141+
142+ it "fetches a list of QR codes by group" do
143+ expect ( client ) . to receive ( :request )
144+ . with ( path : "/groups/#{ group_guid } /qr-codes" , params : {
145+ "archived" => nil ,
146+ "has_render_customizations" => nil ,
147+ "size" => nil
148+ } )
149+ . and_return ( response )
150+
151+ qrcodes = Bitly ::API ::Qrcode . list_by_group ( client : client , group_guid : group_guid )
152+ expect ( qrcodes . to_a . first . qrcode_id ) . to eq ( qrcode_id )
153+ end
154+ end
122155end
You can’t perform that action at this time.
0 commit comments