Class: Bitly::API::Qrcode
- Inherits:
-
Object
- Object
- Bitly::API::Qrcode
- Includes:
- Base
- Defined in:
- lib/bitly/api/qrcode.rb,
lib/bitly/api/qrcode/scans_summary.rb,
lib/bitly/api/qrcode/paginated_list.rb
Defined Under Namespace
Classes: List, PaginatedList, ScansSummary
Instance Attribute Summary
Attributes included from Base
Class Method Summary collapse
- .attributes ⇒ Object
-
.fetch(client:, qrcode_id:) ⇒ Bitly::API::Qrcode
Return information about a QR Code [‘GET /v4/qr-codes/qrcode_id`](dev.bitly.com/api-reference/#getQRCodeByIdPublic).
-
.list_by_group(client:, group_guid:, size: nil, archived: nil, has_render_customizations: nil) ⇒ Bitly::API::Qrcode::PaginatedList
Retrieves a list of QR codes matching the filter settings.
- .time_attributes ⇒ Object
Instance Method Summary collapse
- #bitlink ⇒ Object
-
#image(format: nil) ⇒ String
Return the SVG or PNG image of a QR Code [‘GET /v4/qr-codes/qrcode_id/image`](dev.bitly.com/api-reference/#getQRCodeImagePublic).
-
#initialize(data:, client:, response: nil) ⇒ Qrcode
constructor
A new instance of Qrcode.
-
#scans_summary(unit: nil, units: nil, unit_reference: nil) ⇒ Bitly::API::Qrcode::ScansSummary
[‘GET /v4/qr-codes/qrcode_id/scans/summary`](dev.bitly.com/api-reference/#getScanMetricsForQRCode).
Methods included from Base
Constructor Details
#initialize(data:, client:, response: nil) ⇒ Qrcode
Returns a new instance of Qrcode.
93 94 95 96 97 |
# File 'lib/bitly/api/qrcode.rb', line 93 def initialize(data:, client:, response: nil) assign_attributes(data) @client = client @response = response end |
Class Method Details
.attributes ⇒ Object
16 17 18 |
# File 'lib/bitly/api/qrcode.rb', line 16 def self.attributes [:qrcode_id, :title, :archived, :serialized_content, :long_urls, :bitlink_id, :qr_code_type, :render_customizations] end |
.fetch(client:, qrcode_id:) ⇒ Bitly::API::Qrcode
Return information about a QR Code [‘GET /v4/qr-codes/qrcode_id`](dev.bitly.com/api-reference/#getQRCodeByIdPublic)
67 68 69 70 |
# File 'lib/bitly/api/qrcode.rb', line 67 def self.fetch(client:, qrcode_id:) response = client.request(path: "/qr-codes/#{qrcode_id}") new(data: response.body, client: client, response: response) end |
.list_by_group(client:, group_guid:, size: nil, archived: nil, has_render_customizations: nil) ⇒ Bitly::API::Qrcode::PaginatedList
Retrieves a list of QR codes matching the filter settings. Values are in reverse chronological order. The pagination occurs by calling the next link in the pagination response object. [‘GET /v4/groups/group_guid/qr-codes`](dev.bitly.com/api-reference/#listQRMinimal)
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/bitly/api/qrcode.rb', line 40 def self.list_by_group( client:, group_guid:, size: nil, archived: nil, has_render_customizations: nil ) params = { "size" => size, "archived" => archived, "has_render_customizations" => has_render_customizations } response = client.request(path: "/groups/#{group_guid}/qr-codes", params: params) PaginatedList.new(response: response, client: client) end |
.time_attributes ⇒ Object
19 20 21 |
# File 'lib/bitly/api/qrcode.rb', line 19 def self.time_attributes [:created, :updated] end |
Instance Method Details
#bitlink ⇒ Object
99 100 101 |
# File 'lib/bitly/api/qrcode.rb', line 99 def bitlink Bitlink.fetch(client: @client, bitlink: @bitlink_id) end |
#image(format: nil) ⇒ String
Return the SVG or PNG image of a QR Code [‘GET /v4/qr-codes/qrcode_id/image`](dev.bitly.com/api-reference/#getQRCodeImagePublic)
87 88 89 90 91 |
# File 'lib/bitly/api/qrcode.rb', line 87 def image(format: nil) params = format.nil? ? {} : {format: format} response = @client.request(path: "/qr-codes/#{qrcode_id}/image", params: params) response.body["qr_code_image"] end |
#scans_summary(unit: nil, units: nil, unit_reference: nil) ⇒ Bitly::API::Qrcode::ScansSummary
[‘GET /v4/qr-codes/qrcode_id/scans/summary`](dev.bitly.com/api-reference/#getScanMetricsForQRCode)
75 76 77 |
# File 'lib/bitly/api/qrcode.rb', line 75 def scans_summary(unit: nil, units: nil, unit_reference: nil) ScansSummary.fetch(client: @client, qrcode_id: @qrcode_id, unit: unit, units: units, unit_reference: unit_reference) end |